CImage:SubBiasCol
The SubBiasCol method computes and subtracts a column bias vector from the image. The result replaces the current image. This is also known as a line bias method, here using line parallel to the image columns to apply the bias correction.
bResult = CImage:SubBiasCol( method, xmin, xmax, nCoefs=nil, pixel_type=nil ) |
method is a number that describes the type of bias correction (see Remarks).
xmin and xmax are the limits of the bias sampling columns, and are 1-based.
The optional nCoefs is the polynomial order if the polynomial fit (method 4) is used.
The optional pixel_type specifies the output pixel type as a number or string.
On success, this method returns true.
On failure, false is returned.
This method computes a column bias correction for the image using pixels in underscan or overscan columns. The bias is computed as a function of row number, then applied to the entire image. A number of different methods are available for computing the column bias vector; these are described in the following table:
Column Bias Methods
Method |
Description |
1 |
Uses the "Erase Line" method in which the column at xmin is subtracted from the entire image. The value of xmax is not used. |
2 |
Computes the mean value for each row between columns xmin and xmax and subtracts this column vector from the entire image. |
3 |
Computes the median value for each row between columns xmin and xmax and subtracts this column vector from the entire image. |
4 |
Fits a polynomial as a function of row number over columns xmin to xmax 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 pixel 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 loads an image from file sPath, then fits a 5-term (4th order) polynomial to the bias region stored in image columns 3 through 8. This polynomial correction is then subtracted from the image and the result is saved back to the image file. During processing, the output pixel 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 columns 3 -- 8 |
|
|
|
|
2. The following script uses a median bias column computed over columns 1 through 8 and does not change the pixel type:
|
-- create a new CImage |
|
-- load the image from file sPath |
|
-- apply method 2 over columns 1 -- 8 |
|
-- save the result |
|
|
CImage class, SubBiasFrame, SubBiasRef, SubBiasRow
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics,
Inc. All Rights Reserved.