Find Ellipse Edit ControlCognex VisionPro

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

The Find Ellipse 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 Ellipse edit control:

Cognex Caliper Cog Find Ellipse Find Ellipse 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 shape of the search area, and viewing the fitting results
  • An image display window for displaying Find Ellipse tool images and graphics

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

Cognex Caliper Cog Find Ellipse Find Ellipse Terminals

Control Buttons

Cognex Caliper Cog Find Ellipse Find Ellipse Button Bar

The following table describes the function of each button:

Table 1. Control buttons
ButtonDescriptionFunction
Cognex Caliper Cog Find Ellipse 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 Ellipse tool.
Cognex Caliper Cog Find Ellipse Caliper Control Electric
Electric modeToggles electric mode, where the Find Ellipse tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property.

Cognex Caliper Cog Find Ellipse Caliper Control Local

Local image display

Opens or closes the local image display window. A Find Ellipse 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 Ellipse tool after it fits an ellipse to the found edge points.
  • The LastRun.RegionData_Caliper<X>, where <X> represents the Caliper number.
Cognex Caliper Cog Find Ellipse 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 Ellipse 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 Ellipse 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 Ellipse Caliper Control Save As
Save AsSaves the current properties of the vision tool to a new VisionPro persistence (.vpp) file
Cognex Caliper Cog Find Ellipse Caliper Control Reset
ResetResets the vision tool to its default state.
Cognex Caliper Cog Find Ellipse Caliper Control Grid Results
Show Floating ResultsOpens a separate results window with the same contents as seen in the Point Results tab
Cognex Caliper Cog Find Ellipse Caliper Control Tool Tips
Show ToolTipsEnables or disables the display of tooltips for individual items in the edit control
Cognex Caliper Cog Find Ellipse Caliper Control Help
HelpOpens this VisionPro online help file
Settings Tab

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

Cognex Caliper Cog Find Ellipse Find Ellipse Settings Tab

Caliper

Cognex Caliper Cog Find Ellipse Settings Tab Caliper

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

Table 2. Caliper Controls
FeatureDescription
NumCalipersControls the number of Calipers to use along the expected elliptical arc segment. The tool requires a minimum of five Calipers, although using more allows the tool to generate a better fit. In addition, you should use more than five Calipers if you allow the underlying Fit Ellipse tool to ignore one or more points while calculating the best fitting ellipse. To determine which point to ignore, the Fit Ellipse tool considers all possible subsets and keeps the set that produces the best possible score.

CaliperSearchLength

Controls the amount of image perpendicular to the expected elliptical arc segment that each Caliper takes into consideration. You can use the Find Ellipse graphics to specify a general search length or use this field to enter a precise value.

Note: In general, to improve accuracy specify additional calipers rather than increasing the search length. Too long a search length can cause the found point to be shifted toward the center of the ellipse, as shown below:

Cognex Caliper Cog Find Ellipse Find Ellipse Control short strokes

CaliperProjectionLength

Controls the amount of image parallel to the expected elliptical arc segment that each Caliper takes into consideration. You can use the Find Ellipse graphics to specify a general projection length or use this field to enter a precise value.

Note: If you specify a very small value for the projection length, you may need to reduce the filter half size.

CaliperSearchDirectionControls the direction in which each Caliper searches for edges or edge pairs. By default, each Caliper starts inside the expected arc length and searches outward.
Expected Elliptical Arc

Cognex Caliper Cog Find Ellipse Elliptical Arc Settings

Use the Expected Elliptical Arc area of the Settings tab to shape the elliptical arc on which the Calipers operate.

Table 3. Arc Controls
FeatureDescription
SelectedSpaceNameNames the coordinate space for the input image.
CenterX and CenterYNames the (x, y) coordinate at the center of the elliptical arc.
RadiusXDisplays the distance from the center of the ellipse to its boundary along the ellipse's x-axis.
RadiusYDisplays the distance from the center of the ellipse to its boundary along the ellipse's y-axis.
RotationDisplays the rotation angle from the x-axis of the selected coordinate space to the x-axis of the ellipse.
AngleStart Displays the angle that specifies the start of the elliptical arc.
AngleSpan Displays the angular extent and direction of the elliptical arc.
FitToImageAdjusts the Find Ellipse graphics such that its default size is based on the image and the coordinate space for the input image.
Fitter

Cognex Caliper Cog Find Ellipse Find Ellipse Fitter Settings

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

Table 4. Fitter Controls
FeatureDescription
FitConstraint and ExpectedOrientation Specify which ellipse fitting criteria should be used.
  • By default, the Fit Constraint: Accurate RMS Error and Fit Constraint: Orientation checkboxes are unchecked, and the ellipse is fitted without any constraints.
  • Check the Fit Constraint: Orientation checkbox to constrain the fitted ellipse to the ExpectedOrientation angle you specify in the Expected Orientation textbox.
  • Check the Fit Constraint: Accurate RMS Error checkbox to accurately measure the RMS error during ellipse fitting.
NumToIgnoreControls the number of edge points the underlying Fit Ellipse tool can ignore while calculating the best fitting ellipse. To determine which point to ignore, the Fit Ellipse tool considers all possible subsets and keeps the set that produces the best score.
DecrementNumToIgnoreAllows the Find Ellipse 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 Ellipse tool with fewer than three 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 Ellipse Find Ellipse 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. The edit control bases this measurement of the value of Edge0Position and Edge1Position
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 Ellipse Find Ellipse 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 Ellipse Caliper Control Function Buttons

Table 6. Function Buttons
ButtonDescription

Cognex Caliper Cog Find Ellipse 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 Ellipse 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 Ellipse 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 Ellipse Caliper Control Move Down

Move the currently highlighted function down 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 Ellipse 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

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

Cognex Caliper Cog Find Ellipse Find Ellipse Graphics Tab

Inputs

Cognex Caliper Cog Find Ellipse Find Ellipse Graphics Tab Inputs

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

Results

Cognex Caliper Cog Find Ellipse Find Ellipse Graphics Tab Results

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

  • Show the entire best fit ellipse.
  • Show the best fit ellipse segment.
  • Show the edge points the Fit Ellipse tool used to calculate the ellipse.
  • Show the edge points the Fit Ellipse tool ignored to calculate the ellipse.
  • 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 Ellipse Find Ellipse 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 elliptical arc segment as configured in the Current.InputImage in the LastRun.InputImage buffer.
Results Tab

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

Cognex Caliper Cog Find Ellipse Find Ellipse Results Tab

Ellipse

Cognex Caliper Cog Find Ellipse Results Tab Ellipse

Use the GetEllipse area of the Results tab to view the following results about the ellipse the tool found:

Table 8. Ellipse Results
FeatureDescription
SelectedSpaceNameDisplays the coordinate space for the input image.
CenterX and CenterYDisplays the (x, y) coordinates at the center of the ellipse.
RadiusXDisplays the distance from the center of the ellipse to its boundary measured along the rotated x-axis.
RadiusYDisplays the distance from the center of the ellipse to its boundary measured along the rotated y-axis.
RotationDisplays the rotation angle from the x-axis of the selected coordinate space to the rotated x-axis of the ellipse.
Elliptical Arc

Cognex Caliper Cog Find Ellipse Results Tab Elliptical Arc

Use the GetEllipticalArc area of the Results tab to view the following results about the elliptical arc found by the tool:

Table 9. Elliptical Arc Results
FeatureDescription
CenterX and CenterYDisplays the (x, y) coordinates at the center of the elliptical arc.
RadiusXDisplays the distance from the center of the ellipse to its boundary along the ellipse's x-axis.
RadiusYDisplays the distance from the center of the ellipse to its boundary along the ellipse's y-axis.
RotationDisplays the rotation angle from the x-axis of the selected coordinate space to the x-axis of the ellipse.
AngleStart and AngleSpanDisplays the start angle and the total span of the elliptical arc.
Point Results

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 Ellipse Find Ellipse 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 ellipse fit
DistanceToEllipseThe distance from the point to the ellipse
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.