bkCorrect
Top  Previous  Next

bkCorrect ( integer Input, integer Dark, integer Bright, integer Output
[, integer Subtract =1, integer Even =0 ] )

Use this function to correct an image background and prepare an image for optical density and transmission measurements. Uneven background, or shading is usually caused by non-uniform illumination, irregular camera response, electronic noise and optics imperfections.

In general, to perform the background correction, two auxiliary images should be prepared: dark field and bright field. Dark field is a background image captured with no light transmitted through the camera lens, and the bright field is a background image captured with the maximum light transmitted and no objects in the filed of view. It is recommended to use the grabAvrg function to acquire background images. While capturing the bright field image, the user should adjust the light intensity so that it stays just below the saturation level of the camera. That will provide the maximum dynamic range for the image acquisition.

The correction algorithm is based on the following formula:

bkcorrect

where

Ix,y    is a pixel value of the original image
Bx,y    is a pixel value of the dark field image
Wx,y    is a pixel value of the bright field image
Wmax    is a maximum value of the bright field image
Cx,y    is a new pixel value of the corrected image

After the image is corrected,
Wmax value is stored as the assigned background for further use in optical density and transmission measurements.

Only one auxiliary image can be used perform the background correction. For instance, in the experiments with fluorescent phenomena only the dark field image should be used for correction.

Parameters

Input  
 
An integer between 0 and 116 specifying the input image frame number. A value of 0 represents the DMA memory buffer of the video device. Values in the range of 100-116 correspond to hidden frames.  
 
Output  
 
An integer between 1 and 116 specifying the output image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
Dark  
 
An integer between 0 and 116 specifying the number of the frame that contains a dark field image. Values in the range of 100-116 correspond to hidden frames. The Subtract argument must be TRUE in order for the dark field image to be processed.  
 
Bright  
 
An integer between 0 and 116 specifying the number of the frame that contains a bright field image. Values in the range of 100-116 correspond to hidden frames. The Even argument must be TRUE in order for the bright field image to be processed.  
 
Subtract     
 
An optional boolean integer that selects the dark field correction mode. Must be one of the following values:  
 
FALSE=0 – do not perform dark field correction. The additive component of the correction algorithm will be disregarded.  
TRUE=1 – perform dark field correction.  
Default value: TRUE  
 
Even  
 
An optional boolean integer that selects the bright field correction mode. Must be one of the following values:  
 
FALSE=0 – do not perform bright field correction. The multiplicative component of the correction algorithm will be disregarded.  
TRUE=1 – perform dark field correction.  
Default value: FALSE  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example

This set of statements prompts the user to capture a dark and white field, and then continuously performs the background correction displaying a corrected live image in a frame #1.  
 
Dark=101  
Bright=102  
Print "Open Video window"  
Input "Press Enter to capture dark field"  
grabIm (Dark)   
Input "Press Enter to capture bright field"  
grabIm (Bright)  
Input "Press Enter to display corrected video"  
 
do  
 grabIm (0)  
 bkCorrect (0, 101, 102, 1, TRUE, TRUE)  
loop