CImage:SubBiasRow
The SubBiasRow method computes and subtracts a row bias vector from the image. The result replaces the current image. This is also known as a line bias method using line parallel to the image rows to apply the bias correction.
bResult = CImage:SubBiasRow( method, ymin, ymax, nCoefs=nil, datatype=nil ) |
This method computes a row bias correction for the image using pixels in underscan or overscan rows. The bias is computed as a function of column number, then applied to the entire image. A number of different methods are available for computing the row bias vector; these are described in the following table:
Row Bias Methods
Method |
Description |
1 |
Uses the "Erase Line" method in which the row at ymin is subtracted from the entire image. The value of ymax is not used. |
2 |
Computes the mean value for each column between rows ymin and ymax and subtracts this row vector from the entire image. |
3 |
Computes the median value for each column between rows ymin and ymax and subtracts this row vector from the entire image. |
4 |
Fits a polynomial as a function of column number over rows ymin to ymax and subtracts this fit from the entire image. The value of nCoefs specifies the fit order (e.g., nCoefs=1 means constant term only). |
This function updates the image header with the appropriate history and other keywords. The data type of the image may also be changed as part of the correction, for example, to increase the precision of the bias removal procedure.
1. The following script fragment loads an image from file sPath, then fits a 5-term (4th order) polynomial to the bias region stored in image rows 1 through 12. This polynomial correction is then subtracted from the image and the result is saved back to the image file. During processing, the output data type is changed to "float" to maintain precision of the bias correction:
|
-- create a new CImage |
|
-- load the image from file sPath |
|
-- apply method 4 with 5 coefs over rows 1 -- 12 |
|
|
|
|
2. The following script fragment uses a median bias row computed over rows 1 through 12 and does not change the data type:
|
-- create a new CImage |
|
-- load the image from file sPath |
|
-- apply method 2 over rows 1 -- 12 |
|
-- save the result |
|
|