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, pixel_type=nil ) |
Dark is the CImage containing the thermal dark frame.
sKwd is a string for the header keyword containing the dark integration time.
The optional pixel_type specifies the output pixel type as a number or string.
On success, this method returns true.
On failure, false. is returned.
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.
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:
|
-- 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 |
CImage class, SubDarkFrame, SubDarkOpt
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.