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

bResult = CImage:SubBiasRow( method, ymin, ymax, nCoefs=nil, pixel_type=nil )

bullet.gif    method is a number that describes the type of bias correction (see Remarks).

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

bullet.gif    The optional nCoefs is the polynomial order if the polynomial fit (method 4) is used.

bullet.gif    The optional pixel_type specifies the output pixel type as a number or string.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, false is returned.

Remarks

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

Examples

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

I = new_image()

-- 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()

 

I:delete()

 

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

I = new_image()

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

I:delete()

 

Related Topics

CImage class, SubBiasFrame, SubBiasRef, SubBiasCol


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.