CImage:SubDarkOpt


The SubDarkOpt method corrects the thermal image signature by subtracting a statistically scaled dark frame from the current image. The scaling and subtraction are iterated until the random noise is minimized in the corrected image. The result replaces the current image.

Syntax

bSuccess = CImage:SubDarkOpt( Dark )

bSuccess = CImage:SubDarkOpt( Dark, datatype )

where

    Dark is the CImage containing the thermal dark frame.

    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 adjusts the dark frame signal level by iteratively adjusting its signal level to minimize the residual noise after dark subtraction. The image header is automatically updated with the appropriate history and other keywords.

The data type of the image may be changed as part of the correction, for example, to increase the precision of the dark correction. Mira automatically handles mixing different data types between the source image and the dark frame.

Example

The following script loads an image and subtracts an optimized dark frame. The output data type is changed to "float" to maintain precision of the correction process. In practice you might maintain the dark frame in memory across a loop to process many images:

I = CImage:new()

-- create a new CImage

I:Open( sPath )

-- load the image from file sPath

Dark = CImage:new()

-- create a new CImage

Dark:Open( sDarkName )

-- load the dark frame from sDarkName

I:SubDarkOpt(Dark,"float")

-- remove the dark frame from image I

I:Save()

 -- save the correct image

Related Topics

SubDarkFrame

SubDarkScaled

CImage class