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.
bResult = CImage:SubDarkScaled( Dark, sKwd, datatype=nil ) |
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.
The following script fragment 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:
|
-- create a new CImage |
|
-- load the image from file sPath |
|
-- create a new CImage |
|
-- load the dark frame from sDarkName |
|
-- keyword for the thermal integration time |
|
-- remove the dark frame from image I |
|
-- save the correct image |
|
-- remove the image from memory |
|
-- remove the thermal frame from memory |