WhiteBalance

Available for color In-Sight sensors and color-enabled emulators only, WhiteBalance removes color casts in a color image by calculating the image's red, green and blue (RGB) values and correcting them according to color tables stored in the In-Sight job. As a result, items that are white in the real world, for example, will appear white in the image.

The user must create the color tables by acquiring an image of a "neutral" reference (that is, one that has equal RGB values; for example, 18-18-18), while ensuring that the image does not approach saturation (255-255-255). The recommended method is to acquire an image of a blank sheet of paper.

WhiteBalance generates a histogram of each color channel (red, green and blue) and "equalizes" the color values by considering the highest value as the baseline and dividing it by each color value to produce scale factors, which are then used to create the color tables (for example, an RGB of 200-100-50 will yield scale factors of 1-2-4).

The color tables for the current sensor settings are saved in the job file. To ensure that the proper WhiteBalance information is applied, load the job before loading or acquiring an image.

Note: The WhiteBalance function references the White Balance Region in the AcquireImage property sheet, and uses the parameters of this region when calculating the white balance. For more information, see AcquireImage.

WhiteBalance Inputs

WhiteBalance(Image)

Parameter Description

Image

This argument must reference a spreadsheet cell that contains a valid color Image data structure. By default, the cell referenced is A0, which contains the Image data structure returned by AcquireImage.

Note: AcquireImage is the only function that returns a valid color Image data structure.

WhiteBalance Outputs

Returns

A WhiteBal data structure, or #ERR if any of the input parameters are invalid.

Note: The WhiteBalance function is inserted into the spreadsheet with its cell state disabled. This ensures that the image is balanced only once and will not be balanced every time the spreadsheet updates.

WhiteBalance Example

In this example, the input image of an object (a sensor lens) has a dark blue cast (below) that must be corrected.

The user first removes the object from the field of view (FOV) and replaces it with a blank sheet of paper. Next, simply inserting WhiteBalance into the spreadsheet removes the blue cast from the image; the user then clicks OK in the property sheet to confirm adding this function to the job. To create the color tables that are stored in the job file, the user acquires an image of the paper. When the object is returned to the FOV and viewed onscreen, the blue cast is completely absent (below).