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.

Syntax

bSuccess = CImage:SubBiasRow( method, ymin, ymax )

bSuccess = CImage:SubBiasRow( method, ymin, ymax, nCoefs )

bSuccess = CImage:SubBiasRow( method, ymin, ymax, nCoefs, datatype )

where

    method is a number that describes the type of bias correction.

    ymin and ymax are the limits of the bias sampling rows, and are 1-based.

    nCoefs is the polynomial order if the polynomial fit (method 4) is used.

    datatype specifies the output data type as a number or string.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

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.

Examples

The following script 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:

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image from file sPath

I:SubBiasRow(4,1,12,5,"float")

-- apply method 4 with 5 coefs over rows 1 -- 12

I:Save()

 

The following script uses a median bias row computed over rows 1 through 12 and does not change the data type:

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image from file sPath

I:SubBiasRow(2,1,12)

-- apply method 2 over rows 1 -- 12

I:Save()

 -- save the result

Related Topics

SubBiasFrame

SubBiasRef

SubBiasCol

CImage class