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

bResult = CImage:SubDarkScaled( Dark, sKwd, pixel_type=nil )

bullet.gif    Dark is the CImage containing the thermal dark frame.

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

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 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, image sensors 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 pixel 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 pixel 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 pixel 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 = new_image()

-- create a new CImage

I:Open( Name )

-- load the image from file sPath

Dark = new_image()

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

I:delete()

 -- remove the image from memory

Dark:delete()

 -- remove the thermal frame from memory

Related Topics

CImage class, SubDarkFrame, SubDarkOpt


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