Find Line Edit ControlCognex VisionPro

The Find Line edit control provides a graphical user interface to the CogFindLineTool vision tool, which runs a series of Caliper tools over a specified region of an image to locate multiple edge points, supplies these edge points to an underlying Fit Line tool, and ultimately returns the line that best fits those input points while generating the smallest root mean square (RMSError) error.

The Find Line edit control allows you to specify the region of the image analyzed, control the number of Calipers used, and view vision tool results. The following figure shows the Find Line edit control:

Cognex Caliper Cog Find Line Find Line Whole Control

The edit control offers the following features:

  • A row of control buttons at the top left
  • A set of function tabs for specifying a number of Calipers, the length of the search area, and viewing the fitting results
  • An image display window for displaying Find Line tool images and graphics

You can experiment with the edit control by using QuickBuild to create a CogFindLine tool. A new CogFindLine tool appears as shown in the following figure:

Cognex Caliper Cog Find Line Find Line Terminals

Control Buttons

Cognex Caliper Cog Find Line Find Line Button Bar

The following table describes the function of each button:

Table 1. Control buttons
ButtonDescriptionFunction
Cognex Caliper Cog Find Line Caliper Control Run
RunUses the current set of configured Calipers to analyze the image stored in the Current.InputImage buffer to produce a set of input points that are then passed to a Fit Line tool.
Cognex Caliper Cog Find Line Caliper Control Electric
Electric modeToggles electric mode, where the Find Line tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property.

Cognex Caliper Cog Find Line Caliper Control Local

Local image display

Opens or closes the local image display window. A Find Line tool supports the following image buffers:

  • The Current.InputImage buffer contains the current image and the set of Calipers that will search for edges.
  • The LastRun.InputImage buffer contains the results of the Find Line tool after it fits a line to the found edge points.
  • The LastRun.RegionData_Caliper<X>, where <X> represents the Caliper number.
Cognex Caliper Cog Find Line Caliper Control Float
Floating image displayOpens one or more floating image windows, which support the same image buffers as the local image display window
Cognex Caliper Cog Find Line Caliper Control Open
OpenOpens a VisionPro persistence (.vpp) file that contains a set of saved properties for this vision tool object type. VisionPro reports an error if you try to open a .vpp file for another object type.
Cognex Caliper Cog Find Line Caliper Control Save
SaveSaves the current properties of the vision tool to a VisionPro persistence (.vpp) file. The edit control allows you to choose between saving the vision tool with or without its image buffers and tool results.
Cognex Caliper Cog Find Line Caliper Control Save As
Save AsSaves the current properties of the vision tool to a new VisionPro persistence (.vpp) file
Cognex Caliper Cog Find Line Caliper Control Reset
ResetResets the vision tool to its default state.
Cognex Caliper Cog Find Line Caliper Control Grid Results
Show Floating ResultsOpens a separate results window with the same contents as seen in the Points Results tab
Cognex Caliper Cog Find Line Caliper Control Tool Tips
Show ToolTipsEnables or disables the display of tooltips for individual items in the edit control
Cognex Caliper Cog Find Line Caliper Control Help
HelpOpens this VisionPro online help file
Settings Tab

This section contains the following subsections.

Use the Settings tab to configure the Calipers and the expected line segment this Find Line tool will use. The following figure shows the default Settings tab:

Cognex Caliper Cog Find Line Find Line Settings Tab

Caliper

Cognex Caliper Cog Find Line Caliper Settings

Use the Caliper section of the Settings tab to shape all the Calipers the Find Line tool uses to locate edges or edge points.

Table 2. Caliper Controls
FeatureDescription
NumCalipersControls the number of Calipers to use along the line segment. The tool requires a minimum of two Calipers, although using more allows the tool to generate a better fit. In addition, you should use more than two Calipers if you allow the underlying Fit Line tool to ignore one or more points while calculating the best fitting line. To determine which point to ignore, the Fit Line tool considers all possible subsets and keeps the set that produces the best possible score.
CaliperSearchLengthControls the amount of image perpendicular to the expected line segment that each Caliper takes into consideration. You can use the Find Line graphics to specify a general search length or use this field to enter a precise value.
CaliperProjectionLengthControls the amount of image parallel to the expected line segment that each Caliper takes into consideration. You can use the Find Line graphics to specify a general projection length or use this field to enter a precise value. You should not specify a projection length that causes the individual Caliper tools to overlap or the tool might produce unexpected results.

CaliperSearchDirection

Controls the direction in which each Caliper searches for edges or edge pairs. By default, the search direction is +90 degrees as measured from the expected line segment. To avoid including extraneous edges or other image features inside a Caliper, you can adjust the skew of the Calipers by specifying a different value for the search direction. You can use the Find Line graphics to modify the direction or use this field to enter a precise value.

Swap Search DirectionReverses the search direction by subtracting 180 degrees, or adding 180 degrees if the search direction is already a negative value.
Expected Line Segment

Cognex Caliper Cog Find Line Line Segment Settings

Use the Expected Line Segment area of the Settings tab to shape the line segment on which the Calipers operate.

Table 3. Segment Controls
FeatureDescription
SelectedSpaceNameNames the coordinate space for the input image.
Select ModeDetermines whether the expected line segment is determined by the 2 Points method (two [x, y] coordinates) or by the Point/Length method (a starting [x, y] coordinate followed by a line length and a measure of rotation).
StartX and StartYNames the starting (x, y) coordinate of the expected line segment
EndX and EndYNames the ending (x, y) coordinate of the expected line segment when using the 2 Points method.
Length and RotationControls the length and angle of rotation of the expected line segment when using the Point/Length method.
Fitter

Cognex Caliper Cog Find Line Fitter Settings

Use the Fitter section of the Settings tab to configure the number of points to ignore.

Table 4. Fitter Controls
FeatureDescription
NumToIgnoreControls the number of edge points the underlying Fit Line tool can ignore while calculating the best fitting line. To determine which point to ignore, the Fit Line tool considers all possible subsets and keeps the set that produces the best score.
DecrementNumToIgnoreAllows the Find Line tool to decrement the number of points to ignore for each Caliper that fails to produce a valid edge point. This feature protects an application where Caliper failures can leave the Fit Line tool with fewer than two input points. Cognex recommends you enable this option if you allow the tool to ignore any input points.
Caliper Settings Tab

Use the Caliper Settings tab to configure how the Calipers perform their image analysis. The following figure shows the default Caliper Settings tab:

Cognex Caliper Cog Find Line Find Line Caliper Settings

Table 5. Caliper Settings
FeatureDescription
EdgeModeControls whether the Calipers search for a single edge or an edge pair.
Edge0PolarityDetermines the polarity of the edge, or the first edge in an edge pair, that each Caliper searches for.
Edge1PolarityAvailable only in Edge Pair mode, this determines the polarity of the second edge.
WidthDictates the minimum distance between edges when using Edge Pair mode.
ContrastThresholdSpecifies the minimum contrast required for an edge to be considered during the scoring phase of the Caliper operation.
FilterHalfSizeInPixelsSpecifies the half-width of the filter.
Caliper Scoring Tab

Use the Caliper Scoring tab to create a collection of scoring functions for the Calipers to use. The following figure shows the default Caliper Scoring tab:

Cognex Caliper Cog Find Line Find Line Caliper Scoring

If the Edge Mode is Single Edge, the following scoring functions are available:

If the Edge Mode is Edge Pair, then these scoring functions are available:

Use the following function buttons to manage the scoring functions:

Cognex Caliper Cog Find Line Caliper Control Function Buttons

Table 6. Function Buttons
ButtonDescription

Cognex Caliper Cog Find Line Caliper Control Add Function

Add a new scoring function. A menu appears with a list of scoring functions appropriate to the current edge mode. Highlight the function that you want and a new line appears in the list of functions at the bottom of the tab. You can add more than one function of the same type.

Cognex Caliper Cog Find Line Caliper Control Delete Button

RemoveAt the currently highlighted function in the list of functions at the bottom of the tab. A verification message appears asking you to confirm deletion.

Cognex Caliper Cog Find Line Caliper Control Move Up

Move the currently highlighted function up in the list, and updates the index of the function within the collection.

Cognex Caliper Cog Find Line Caliper Control Move Down

Move the currently highlighted function up in the list, and updates the index of the function within the collection.

The following table describes the columns of the scoring function list:

Table 7. Scoring Tab Features
ColumnDescription
NThe index of the scoring function within the function collection, which is either SingleEdgeScorers or TwoEdgeScorers.
Function NameThe name of the function. You can add more than one of the same type of scoring function; the Results tab tracks the functions with both the function name and the index within the function collection.
EnabledEnables or disables this scoring function the next time the Find Line tool executes.
X0 > XcRepresents the orientation of the graph. For the function to be valid, X1 must be between or equal to X0 and Xc. This column allows you to swap X0 and Xc, if necessary.
X0, X1, Xc, Y0, Y1 The parameter values for a one-sided function, or the first set of values for a two-sided function. See each scoring function class for information about these values.
X0h > XchRepresents the orientation of the graph. Applies only to two-sided functions (the SizeDiffNormAsym function). To be valid, X1h must be between or equal to X0h and Xch. This column allows you to swap X0h and Xch, if necessary.
SetXYParametersThe second set of parameter values for a two-sided function. See each scoring function class for information about these values.
Graphics Tab

This section contains the following subsections.

Use the Graphics tab to control which graphics the Find Line tool generates and displays. The following figure shows the default Graphics tab:

Cognex Caliper Cog Find Line Find Line Graphics Tab

Inputs

Cognex Caliper Cog Find Line Graphics Tab Inputs

Check the Show All Caliper checkbox to show all Caliper regions in the Current.InputImage buffer.

Results

Cognex Caliper Cog Find Line Graphics Tab Results

Display any of the following results in the LastRun.InputImage buffer:

  • Show the entire best fit line.
  • Show the best fit line segment.
  • Show the edge points the Fit Line tool used to calculate the line.
  • Show the edge points the Fit Line tool ignored to calculate the line.
  • Show the edges found by the Calipers.
  • Show the regions used by the Calipers.

Enable any of the following results to generate a LastRun.RegionData_Caliper<X> buffer for each Caliper the tool uses:

  • Create projection graphs from all the Calipers.
  • Create filtered graphs from all the Calipers.
  • Show the location of each edge on each projection graph.
Diagnostics

Cognex Caliper Cog Find Line Graphics Tab Diagnostics

Choose any of the following diagnostic graphics:

  • Control whether or not the input image is recorded as part of the diagnostic record, and whether the image is copied to the record or saved in the record as a reference.
  • Show the projection region of the image in the LastRun.RegionData_Caliper<X> buffer for each Caliper the tool uses.
  • Show the expected line segment as configured in the Current.InputImage in the LastRun.InputImage buffer.
Results Tab

This section contains the following subsections.

Use the Results tab to view the results of each execution of the Find Line tool. The following figure shows the default Results tab:

Cognex Caliper Cog Find Line Find Line Results Tab

Line

Cognex Caliper Cog Find Line Results Tab Line

Use the GetLine area of the Results tab to view the following results about the line the tool found:

Table 8. Line Results
FeatureDescription
SelectedSpaceNameDisplays the coordinate space for the input image.
X and YDisplays the (x, y) coordinates of a single point on the found line.
RotationDisplays the angle of rotation for the found line.
Line Segment

Cognex Caliper Cog Find Line Results Tab Line Segment

Use the GetLineSegment area of the Results tab to view the following results about the actual line segment determined by determining the point on the fitted line that is closest to the midpoint of the expected line, then using that as the midpoint of a segment of the expected length along the fitted line:

Table 9. Line Segment Results
FeatureDescription
SelectedSpaceNameDisplays the coordinate space for the input image.
Select ModeThe Find Line tool reports the dimensions of the actual line segment using either the 2 Points method (two [x, y] coordinates) or by the Point/Length method (a starting [x, y] coordinate followed by a line length and a measure of rotation).
StartX and StartYDisplays the starting (x, y) coordinate of the actual line segment
EndX and EndYDisplays the ending (x, y) coordinate of the expected line segment when using the 2 Points method.
Length and RotationDisplays the length and angle of rotation of the expected line segment when using the Point/Length method.
Point Results Tab

Use the Point Results tab to view information about each edge point the Calipers found. The following figure shows an example Point Results tab:

Cognex Caliper Cog Find Line Find Line Point Results Tab

The tab shows the RMSError error of the fitting operation, while the points grid gives the following information about each point result:

Table 10. Point Results
ColumnDescription
IDUnique ID for this result in the collection
UsedIndicates whether the point was used to perform the line fit
DistanceToLineThe distance from the point to the line
XThe x-coordinate of the edge point
YThe y-coordinate of the edge point
FoundIndicates whether the Caliper found an edge point or not
ScoreThe overall score of this result in the range 0.0 - 1.0
Edge0The first edge that contributed to this result. In Edge Pair mode, there is a similar column for Edge1.
WidthThe width of the result when using Edge Pair mode.
PositionA signed measurement along the search direction relative to the center of the input region.
GetContributingScoresThe remaining columns list the individual results of the enabled scoring functions within the list created on the Scoring tab. Functions are identified by both the function name and their index within the collection of scoring functions.