NI Vision for LabVIEW

IMAQ Extract Contour VI

  • Updated2023-02-21
  • 9 minute(s) read
Owning Palette: Contour Analysis
Requires: NI Vision Development Module

Extracts a single, best contour from an image. If the input image is calibrated, the contour will be learned with calibration.

Examples

IMAQ Extract Contour

ccclst.gif

Curve Extraction is a cluster containing information about how curves are extracted from the image.

cu32.gif

Extraction Mode specifies how the VI identifies curves in the image. Choose from the following options:

Normal (0)

(Default) Select Normal if you want the VI to make no assumptions about the uniformity of objects in the image or the image background.

Uniform Regions (1)

Select Uniform Regions if you want the VI to assume that either the objects in the image or the image background consist of uniform pixel values. This allows the VI to more accurately calculate the external curves of the objects.

ci32.gif

Edge Threshold specifies the minimum contrast a seed point must have for it to begin a curve. Valid values range from 1 to 255. The default value is 75.

cu32.gif

Edge Filter Size specifies the width of the edge filter that the VI uses to identify curves in the image. The following options are available:

Fine (0)

Sets the Edge Filter Size to fine.

Normal (1)

(Default) Sets the Edge Filter Size to normal.

Contour Tracing (2)

Sets the Edge Filter Size to contour tracing, which provides the best results for contour extraction but increases the time required to process the image.

ci32.gif

Min Length specifies the length, in pixels, of the smallest curve that you want the VI to identify. The VI ignores any curves that have a length less than this value. The default value is 25.

ci32.gif

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.

ci32.gif

Max Endpoint Gap specifies the maximum gap, in pixels, between the endpoints of a curve that the VI identifies as a closed curve. If the gap is larger than this value, the VI identifies the curve as an open curve. The default value is 10.

cbool.gif

Subpixel specifies whether to detect curve points with subpixel accuracy. The default is FALSE.

cgenclasstagrefflat.gif

Source Image is a reference to the source image.

cgenclasstagrefflat.gif

Dest Contour Image is a reference to the destination image. If this input is connected, the contour image will be the image extracted from the ROI bounding box.

ccclst.gif

ROI Descriptor is a descriptor that defines the region within which to search for contours.

c1di32.gif

Global Rectangle contains the coordinates of the bounding rectangle.

c1dcclst.gif

Contours are each of the individual shapes that define an ROI.

cenum.gif

ID refers to whether the contour is the external or internal edge of an ROI.

cu32.gif

Type is the shape type of the contour.

c1di32.gif

Coordinates indicates the relative position of the contour.

cu32.gif

Search Direction specifies the direction in which the Region of Interest (ROI) is examined.

Rect Left to Right (0)

(Default) Searches the ROI from left to right.

Rect Right to Left (1)

Searches the ROI from right to left.

Rect Top to Bottom (2)

Searches the ROI from top to bottom.

Rect Bottom to Top (3)

Searches the ROI from bottom to top.

Annulus Inner to Outer (4)

Searches the ROI from the inner radius to the outer radius. The inner radius is the radius of the inner circle defining one edge of the circular strip. The outer radius is the radius of the outer circle defining the second edge of the circular strip.

Annulus Outer to Inner (5)

Searches the ROI from the outer radius to the inner radius. The inner radius is the radius of the inner circle defining one edge of the circular strip. The outer radius is the radius of the outer circle defining the second edge of the circular strip.

Annulus Start Angle To End Angle (6)

Searches the ROI from start angle to end angle. The start angle is the first angle of the circular strip and is measured counterclockwise from the x-axis of a coordinate system centered on the center of the circle or annulus. The end angle is the second angle of the circular strip and is measured counterclockwise from the x-axis of a coordinate system centered on the center of the circle or annulus.

Annulus End Angle To Start Angle (7)

Searches the ROI from end angle to start angle. The start angle is the first angle of the circular strip and is measured counterclockwise from the x-axis of a coordinate system centered on the center of the circle or annulus. The end angle is the second angle of the circular strip and is measured counterclockwise from the x-axis of a coordinate system centered on the center of the circle or annulus.

cerrcodeclst.gif

error in (no error) describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

cenum.gif

Contour Selection selects an extracted contour based on the property you choose.

Closest To Search Start (0)

(Default) Selects the curve closest to the ROI.

Maximum Length (1)

Selects the longest curve.

Strongest Mean Gradient Change (2)

Selects the curve with the highest edge strength averaged from each point on the curve.

c1dnclst.gif

Curve Connection specifies how to connect curves. Select a maximum of 1 constraint of each type.

cu32.gif

Match Constraints specifies what criteria to use to consider two curves part of a contour.

Distance (pixel) (0)

Specifies the distance, in pixels, within which the end points of two curves must lie in order to be considered part of a contour.

Angle Difference (degrees) (1)

Specifies the range, in degrees, within which the difference between the angle of two curves, measured at the end points, must lie in order for the two curves to be considered part of a contour. This value can range from 0 to 180.

Connectivity Distance (pixel) (2)

Specifies the distance, in pixels, within which a line extended from the end point of a curve must pass the end point of another curve in order for the two curves to be considered part of a contour.

Gradient Difference (degrees) (3)

Specifies the range, in degrees, within which the gradient angles of two curves, measured at the end points, must lie in order for the two curves to be considered part of a contour. This value can range from 0 to 180.

cdbl.gif

Min is the minimum value of the range for a given Match Constraint.

cdbl.gif

Max is the maximum value of the range for a given Match Constraint.

igenclasstagrefflat.gif

Source Image Out is a reference to the source image.

igenclasstagrefflat.gif

Contour Image Out is a reference to the image containing a contour.

i1dnclst.gif

Contour Points specifies every point found on the contour.

idbl.gif

X is the x-coodrdinate of the point.

idbl.gif

Y is the y-coodrdinate of the point.

i1dnclst.gif

Source Image Points specifies every point found on the contour in the source image.

idbl.gif

X is the x-coodrdinate of the point.

idbl.gif

Y is the y-coodrdinate of the point.

ierrcodeclst.gif

error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

Examples

Refer to the following for an example that uses this VI.

  • LabVIEW\examples\Vision\Contour\Contour Analysis.vi

  • LabVIEW\examples\Vision\Contour\Contour Defect Inspection.vi

Log in to get a better experience