SceneCorrection

The SceneCorrection function helps to correct images that contain uneven lighting or shading, to produce an output image that appears to contain uniform lighting. The function produces a greyscale output image where every pixel is the result of a "local" image-enhancement technique - "mean intensity"- applied to a set of adjacent pixels ("neighbors") within the region of interest (ROI). The set of pixels is called the "processing neighborhood" and is rectangular in shape, with its height and width defined by the Number of Rows and Number of Columns parameters, respectively.

Note:
  • This function is only available on In-Sight vision systems running In-Sight firmware 4.x.x, and is not available on In-Sight vision systems running In-Sight firmware 5.1.0 and later. For a complete list of models and supported firmware versions, see Firmware Versions.
  • For In-Sight vision systems running In-Sight firmware 5.1.0 and later, this function is consolidated into the Filter function (High Pass Filter Type). For more information, see Filter.

SceneCorrection Inputs

Syntax: SceneCorrection(Image,Fixture.Row,Fixture.Column,Fixture.Theta,Region.X,Region.Y,Region.High,Region.Wide,Region.Angle,Operation,Number of Rows,Number of Columns,Timeout,Show)

Note: The Fixture and Region parameters must be defined within the bounds of the image; otherwise, the function will return #ERR.
Parameter Description

Image

This parameter must reference a spreadsheet cell that contains an Image data structure. By default, this parameter references A0, the cell containing the AcquireImage Image data structure. This parameter can also reference other Image data structures, such as those returned by the Vision Tool Image functions. For more information, see AcquireImage and Image.

Fixture

Defines the Region of Interest (ROI) relative to a Fixture input or the output of a Vision Tool function's image coordinate system. Setting the ROI relative to a Fixture ensures that if the Fixture is rotated or translated, the ROI will be rotated or translated in relation to the Fixture. For more information, see Fixture and Vision Tools Functions.

Note: The default setting is (0,0,0), the top leftmost corner of the image.

Row

The row offset, in image coordinates.

Column

The column offset, in image coordinates.

Theta

The angle of orientation, in the image coordinate system.

Region

The Region of Interest (ROI) specifies the region of the image that undergoes analysis and creates a rectangular image region that can be transformed and rotated. For more information, see Interactive Graphics Mode.

Tip: With this parameter selected, you can press the Maximize Region button on the property sheet's toolbar to maximize the region and cover the entire image.

X

The x-offset of the origin, in fixture coordinates.

Y

The y-offset of the origin, in fixture coordinates.

High

The dimension along the region's x-axis.

Wide

The dimension along the region's y-axis.

Angle

The orientation, in fixture coordinates.

Operation

Specifies the operation to perform on the processing neighborhood; the result is displayed in a greyscale output image.

0 = Mean Intensity

Specifies a "mean intensity" operation, which results in a greyscale averaging of the image. This filter simulates removing uneven lighting or shading from an image by comparing each pixel's intensity value to the average intensity of the pixels within the processing neighborhood. Areas of the image that show little or no variation will be rendered a neutral grey, regardless of the original intensity. Pixels that are darker than their surrounding pixels will be shaded darker than the neutral grey, according to how much darker they are than their surroundings. Similarly, pixels that are lighter than their surrounding pixels will be shaded lighter than the neutral grey. Edges and sharp transitions will be preserved, similar to a "high-pass" operation.

Number of Rows

Specifies the height (1–Max Image Height; default = 11) of the processing neighborhood. This value must be set as an odd number.

Note:
  • The processing neighborhood must be constructed of odd numbers, e.g. Number of Rows = 13 and Number of Columns = 13, or Number or Rows = 15 and Number of Columns = 21, etc. Even numbers may not be entered and will automatically be rejected.
  • The maximum height is the maximum height of the In-Sight vision system's image area (e.g. 480 pixels for a vision system with a 640 x 480 resolution).

Number of Columns

Specifies the width (1–Max Image Width; default = 11) of the processing neighborhood. This value must be set as an odd number.

Note:
  • The processing neighborhood must be constructed of odd numbers, e.g. Number of Rows = 13 and Number of Columns = 13, or Number or Rows = 15 and Number of Columns = 21, etc. Even numbers may not be entered and will automatically be rejected.
  • The maximum width is the maximum width of the In-Sight vision system's image area (e.g. 640 pixels for a vision system with a 640 x 480 resolution).

Timeout

Specifies the amount of time, in milliseconds (0 to 30000; default = 0), that the function will attempt to calculate the correct filter before execution is halted and an #ERR is returned. Set the parameter to 0 to specify no timeout.

Show

Specifies which graphical overlays are displayed on top of the image.

0 = hide all (default)

The input image region will be hidden, except when the cell containing the SceneCorrection function is highlighted in the spreadsheet.

1 = result graphics only

The processed image will be displayed at all times.

2 = input graphics only

The input image region will be displayed at all times.

SceneCorrection Outputs

Returns

An Image data structure containing the processed image, or #ERR if any of the input parameters are invalid.

Note: The contents of the processed image region in the Image data structure are not saved with the job.