ComputeImageSharpness

ComputeImageSharpness computes a measure of the relative focus of an input image as part of an iterative process for refocusing an In-Sight camera's lens.

ComputeImageSharpness Overview

Called the image sharpness score, this measure indicates the degree to which the image, or a region of interest (ROI), includes the smallest resolvable features in a "scene" (that is, the object and its background as captured in the image).

Operation is simple—an image is acquired, and the ComputeImageSharpness tool obtains the image sharpness score. Then, the lens is refocused, nothing else is changed within the scene and a new image is acquired and scored. The higher the score, the sharper the focus. This process is repeated until the focus is acceptable to the user.

Note: A single image sharpness score conveys no useful information about the absolute sharpness of an image; it must be compared with another image sharpness score from the same, exact scene. The scenes must be identical.

ComputeImageSharpness Inputs

Parameter Description

Image

This parameter must use Cell References in a spreadsheet cell that contains an Image data structure; by default, this parameter references A0, the cell containing the Image data structure returned by AcquireImage function. This parameter can also reference other Image data structures, such as those returned by the Vision Tool Image Functions.

Fixture

Defines the Region of Interest (ROI) relative to a Fixture input or the output of a Vision Tools 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.

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

X

The X offset, in image coordinates.

Y

The Y offset, in image coordinates.

Theta

The rotation from the image X axis, in the image coordinate system. (+/-360 degrees clockwise)

Region

Also known as the Region of Interest (ROI), specifies the region of the image that undergoes analysis. Double-click on the Region parameter to create an Interactive Graphics Mode that you can transform and rotate. Select this parameter and press the Maximize Region button on the Job Edit toolbar of the property sheet to automatically stretch the region to cover the entire image.

X

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

Y

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

Width

The dimension along the region's x-axis.

Height

The dimension along the region's y-axis.

Angle

The orientation, in fixture coordinates.

Curve Angle between sides, +/- 360 degrees clockwise

Operation

Gradient Energy: Computes image sharpness based on the energy in the local grey-level gradient of the image or the ROI. The local grey-level gradient represents the rate of change in greyscale values for a given area. An abrupt change in greyscale results in a large magnitude in the grey-level gradient and a higher image sharpness score.

Smoothness

Specifies an image-smoothing operation to help eliminate high-frequency noise that might be present in the ROI. There are three settings:

0 = None (default)

No smoothing takes place; provides the fastest performance.

1 = Smoothing Level 1

A degree of smoothing is applied to the ROI; eliminates very-high-frequency noise in the ROI.

2 = Smoothing Level 2

A further degree of smoothing is applied to the ROI; eliminates high-frequency and very-high-frequency noise in the ROI.

Show

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

0 = hide all (default)

The available graphics items will be hidden, except when the cell containing the ComputeImageSharpness function is highlighted in the spreadsheet.

1 = input graphics only

The graphics items associated with the input image region will be displayed at all times.

ComputeImageSharpness Outputs

Returns

An image sharpness score as a floating point value, or #ERR if any of the input parameters are invalid.