Working with RGB data
The CLsqFit class is designed to make it easy to fit data having either multiple channels, such as RGB intensities in an image, or regular single channel data that has a single numeric value at a given set of coordinates. Since most uses of multi-channel data involve RGB images, these terms are used interchangeably in this class description.
The CLsqFit class supports 1, 3 and 4 channel data. A fit to multi-channel data performs an independent fit to data in each channel. You can force coefficient values, change fit parameters, alter point properties, and configure data rejection independently for each channel, but the basis function and total number of fit coefficients are the same for each channel.
Fitting multi-channel RGB data uses the same class methods you would use for fitting traditional single-channel (numeric) data. However, the arguments or return values are different for the two cases:
Comparison of Methods used for Numeric Data and RGB Data
Numeric Data |
Multi-channel or RGB Data |
AddPt( 3.5, 45.2 ) |
AddPt( 3.5, "45.2" ) sets 45.2 for all channels AddPt( 3.5, "12,56,157" ) sets values for all channels |
c = GetCoef( 2 ) |
r, g, b = GetCoef( 2 ) returns 3 (actually 4) values. one for each channel |
ForceCoef( 2, 0.5 ) |
ForceCoef( 2, 0.5, 3 ) sets coefficient 2 for channel 2. |