CImage:SubBiasVal CImage:SubBiasRow

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.

Syntax

bResult = CImage:SubBiasCol( method, xmin, xmax, nCoefs=nil, datatype=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 datatype specifies the output data type as a number or string.

    On success, this method returns true.

    On failure, false is returned.

Remarks

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 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.

Examples

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 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 data type is changed to "float" to maintain precision of the bias correction:

 

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image from file sPath

I:SubBiasCol(4,3,8,5,"float")

-- apply method 4 with 5 coefs over columns 3 -- 8

I:Save()

 

I:delete()

 

2. The following script fragment uses a median bias column computed over columns 1 through 8 and does not change the data type:

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image from file sPath

I:SubBiasCol(2,1,8)

-- apply method 2 over columns 1 -- 8

I:Save()

 -- save the result

I:delete()

 

Related Topics

CImage, SubBiasFrame, SubBiasRef, SubBiasRow