Shape Detection

NI Vision Assistant

Shape Detection

Detects shapes in grayscale images.

Main Tab

The following controls are available on the Main tab.

  • Step Name—Name to give the step.
  • Reposition Region of Interest—When enabled, the step dynamically repositions the region of interest based on a coordinate system you built in a previous step.
  • Reference Coordinate System—Coordinate system to which you want to link the region of interest.
  • View Contour Lines—Displays the edges detected in the image.

Curve Settings Tab

The following controls are available on the Curve Settings tab.

  • Extraction Mode—Specifies how the algorithm identifies curves in the image.
    • Normal—Makes no assumptions about the uniformity of objects in the image or the image background.
    • Uniform Regions—Assumes that either the objects in the image or the image background consist of uniform pixel values. Use this mode to calculate the external curves of the objects with greater accuracy.
  • Edge Threshold—Specifies the minimum contrast an edge pixel must have to be considered part of a curve. This value can range from 0 to 255. The default value is 75.
  • Edge Filter Size—Specifies the kernel size to use for computing the edges in the image. The options are Normal and Fine. The default value is Normal.
  • Minimum Length—Specifies the length, in pixels, of the smallest curve you want to extract. The default value is 25.
  • Row Search Step Size—Specifies the distance, in the y direction, between the image rows that the algorithm inspects for curve seed points. Valid values range from 1 to 255. The default value is 15.
  • Column Search Step Size—Specifies the distance, in the x direction, between the image columns that the algorithm inspects for curve seed points. Valid values range from 1 to 255. The default value is 15.
  • Maximum Endpoint Gap—Specifies the maximum gap, in pixels, allowed between the endpoints of a curve for the step to identify the curve as closed. If the gap is larger than this value, the step identifies the curve as an open curve. The default value is 10.
  • View Contour Lines—Displays the edges detected in the image.

Shape Tab

The following controls are available on the Shape tab.

  • Shape Type—Specifies the type of shape to detect in the image. The options are Circles, Ellipses, Rectangles, and Lines.
  • Descriptor—Descriptor associated with the selected Shape Type.
    • Max Radius (Circles)—Maximum length of the radius of the circle to detect.
    • Min Radius (Circles)—Minimum length of the radius of the circle to detect. This value must be 3 or higher.
    • Max Major Radius (Ellipses)—Maximum length of the major radius of the ellipse to detect. This value must be greater than Max Minor Radius.
    • Min Major Radius (Ellipses)—Minimum length of the major radius of the ellipse to detect. This value must be 3 or higher, and it must be greater than Min Minor Radius.
    • Max Minor Radius (Ellipse)—Maximum length of the minor radius of the ellipse to detect.
    • Min Minor Radius (Ellipses)—Minimum length of the minor radius of the ellipse to detect. This value must be 3 or higher.
    • Max Width (Rectangles)—Maximum width of the rectangle to detect. This value must be greater than Max Height.
    • Min Width (Rectangles)—Minimum width of the rectangle to detect. This value must be 3 or higher, and it must be greater than Min Height.
    • Max Height (Rectangles)—Maximum height of the rectangle to detect.
    • Min Height (Rectangles)—Minimum height of the rectangle to detect. This value must be 3 or higher.
    • Max Length (Lines)—Maximum length of the line to detect.
    • Min Length (Lines)—Minimum length of the line to detect. This value must be 3 or higher.
  • View Contour Lines—Displays the edges detected in the image.

Settings Tab

The following controls are available on the Settings tab.

  • Minimum Score—Specifies the minimum score a detected shape can have to be considered a valid match. This value can range from 0 to 1000, where a score of 1000 indicates a perfect match.
  • Search for matches that are—Defines the match modes and ranges used to match the template.
    • Rotated—When enabled, this function searches for the shape in the angle range you specify. When disabled, this function searches for the shape regardless of shifting along the x-axis and y-axis. You may specify a second angle range if needed.
    • Scaled—When enabled, this function searches for a shape that may be scaled in the inspection image.
    • Occluded—When enabled, this function searches for a shape that may be occluded in the inspection image.
  • View Contour Lines—Displays the edges detected in the image.

Results

Displays the following information after searching the image for a shape:

  • Score—Score of each valid match. Score values can range from 0 to 1000, where a score of 1000 indicates a perfect match.
  • Radius (Circles)—Length of the radius for each detected circle.
  • Major Radius (Ellipses)—Length of the major radius for each detected ellipse.
  • Minor Radius (Ellipses)—Length of the minor radius for each detected ellipse.
  • Width (Rectangles)—Width of each detected rectangle.
  • Height (Rectangles)—Length of each detected rectangle.
  • Angle—Rotation angle, in degrees, of each detected shape.
  • Center X—X-coordinate of the center of each detected circle or ellipse.
  • Center Y—Y-coordinate of the center of each detected circle or ellipse.
  • Corner# X (Rectangles)—X-coordinate of the corner of each detected rectangle.
  • Corner# Y (Rectangles)—Y-coordinate of the corner of each detected rectangle.
  • Start Point X (Lines)—X-coordinate of the start point of each detected line.
  • Start Point Y (Lines)—Y-coordinate of the start point of each detected line.
  • End Point X (Lines)—X-coordinate of the end point of each detected line.
  • End Point Y (Lines)—Y-coordinate of the end point of each detected line.