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:
For single
channel data, the point value is passed as a number. For
multi-channel data, the point value is passed as a string of
comma-separated numbers. If an RGB string contains fewer values
than the number of channels, the last value is duplicated to the
remaining channels. For example, "45.2" becomes
"45.2,45.2,45.2".
For single
channel data, results are returned as a single number. For RGB
data, results are returned as multiple numbers, one for each
channel.
To specify a
particular data channel, as when forcing a coefficient value for
the B channel, specify the channel as an optional argument of the
method.
Numeric Data |
|
|
-- sets 45.2 for the only channels |
|
-- returns the value for the only channel |
|
-- sets coefficient 2 for the only channel |
|
-- sets 45.2 for all channels |
|
-- sets each channel to a value |
|
-- returns 3 (actually 4) values. one for each channel |
|
-- sets coefficient 2 for channel 2 |