CImage:SubDarkScaled


The SubDarkScaled method corrects the thermal image signature by subtracting a time-scaled dark frame from the current image. The scaling corrects the dark frame integration time to that of the current image. The result replaces the current image.

Syntax

bSuccess = CImage:SubDarkScaled( Dark, sKwd )

bSuccess = CImage:SubDarkScaled( Dark, sKwd, datatype )

where

    Dark is the CImage containing the thermal dark frame.

    sKwd is a string for the header keyword containing the dark integration time.

    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 scaling by the ratio of its exposure time to that of the current image. For example, if the dark frame was allowed to integrate a thermal signal for twice as long, then it is scaled by a factor of 1/2 before being applied to the image. During the inter-image period, imaging arrays are continually flushed to prevent the buildup of dark current. The keyword to use for determining the scale factor should define the time between the end of flushing and the beginning of image readout. Some camera control software uses a unique keyword such as DARKTIME or DWELL to store this time value. If these are unavailable, the EXPTIME keyword may be used. The longer the exposure time, then the better an approximation EXPTIME makes to the actual thermal integration time.

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 a scaled dark frame. The DARKTIME keyword is used to determine the scaling. 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( Name )

-- load the image from file sPath

Dark = CImage:new()

-- create a new CImage

Dark:Open( sDarkName )

-- load the dark frame from sDarkName

sKwd = "DARKTIME"

-- keyword for the thermal integration time

I:SubDarkScaled(Dark,sKwd,"float")

-- remove the dark frame from image I

I:Save()

 -- save the correct image

Related Topics

SubDarkFrame

SubDarkOpt

CImage class