Fit Ellipse Edit ControlCognex VisionPro

The Fit Ellipse edit control provides a graphical user interface to the CogFitEllipseTool vision tool, which takes a set of input points and returns the ellipse that best fits those input points while generating the smallest root mean square (RMSError) error. A Fit Ellipse tool requires a minimum of five input points.

The Fit Ellipse edit control allows you to select the input points, specify a number of input points to ignore, and view vision tool results. The following figure shows the Fit Ellipse edit control:

Cognex Core Cog Fit Ellipse Fit 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 the input points, setting run-time parameters, and viewing the fitting results
  • An image display window for displaying Fit Ellipse tool images and graphics

You can experiment with the edit control by QuickBuild to create a CogFitEllipse tool. A new CogFitEllipse tool appears with the input terminals for five input points, as shown in the following figure:

Cognex Core Cog Fit Ellipse Fit Ellipse Terminals

Control Buttons

Cognex Core Cog Fit Ellipse Fit Tool Button Bar

The following table describes the function of each button:

Table 1. Control buttons
ButtonDescriptionFunction
Run Button
RunFit an ellipse to the current set of input points, taking the present set of run parameters into consideration.
Electric Button
Electric modeToggle electric mode, where the Fit Ellipse tool executes automatically when particular configuration parameters change. In electric mode, a lightning bolt appears next to every electric property.

Local Display Button

Local image display

Open or close the local image display window. A Fit Ellipse tool supports the following image buffers:

  • The Current.InputImage buffer contains the current image and the set of input points supplied to the Fit Ellipse tool.
  • The LastRun.InputImage buffer contains the results of the Fit Ellipse tool after it fits an ellipse to the set of input points.
Floating Display Button
Floating image displayOpen one or more floating image windows, which support the same image buffers as the local image display window.
Open Button
OpenOpen 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.
Save Button
SaveSave 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.
Save As Button
Save AsSave the current properties of the vision tool to a new VisionPro persistence (.vpp) file.

Reset Button

Reset

Reset the vision tool to its default state.

This tool gives you a choice between resetting to the default-constructed state, which is appropriate when you are using it in a Visual Studio.NET application, and its template-initialized state, which is appropriate for QuickBuild applications.

Results Button
Show Floating ResultsOpen a separate results window with the same contents as seen in the Results tab.
Tool Tips Button
Show ToolTipsEnable or disable the display of tooltips for individual items in the edit control.
Help Button
HelpOpen this VisionPro online help file.
Settings Tab

Use the Settings tab to specify the number of input points you want to use and the number of points you want the tool to ignore. The following figure shows the default Settings tab:

Cognex Core Cog Fit Ellipse Fit Ellipse Settings Tab

Input Points

Use the Input Points grid of the Settings tab to specify the number and (x,y) coordinates of the input points for this Fit Ellipse tool, which requires a minimum of five. Use the function buttons, shown in the following figure, to add, delete and reorder the input points:

Cognex Core Cog Fit Ellipse Fit Circle Function Buttons

The following table describes the function buttons:

Table 2. Function Buttons
ButtonDescription

Cognex Core Cog Fit Ellipse Add Point Function

AddPoint a new input point. Initially, the input point has the coordinates (0, 0), and you must reference a valid point result generated by another vision tool. With QuickBuild you can connect the output (x, y) terminals of a valid point to the input (x, y) terminals of a Fit Ellipse point. In your custom vision application you use the SetPoint method.

Cognex Core Cog Fit Ellipse Delete Point Function

DeletePoint the currently highlighted input point from the list. If you have fewer than five input points plus the number of points to ignore, the edit control displays the message Not Enough Input Points and the Fit Ellipse tool will not function properly.

Cognex Core Cog Fit Ellipse Move Up Function

Move the highlighted input point up one position in the list, although the order of input points does not affect the operation of the Fit Ellipse tool.

Cognex Core Cog Fit Ellipse Move Down Function

Move the highlighted input point down one position in the list, although the order of input points does not affect the operation of the Fit Ellipse tool.

To add an input point to the list, you can either enter an (x,y) coordinate directly or use the Tool Group edit control link the (x,y) coordinates of a point result from another tool to the (x,y) coordinates of the input parameters for the Fit Ellipse tool .

Constraint Enabled

Check the RotationConstraintEnabled checkbox to specify the rotation for the major axis of the ellipse. Use the RotationConstraint control to enter the rotation value.

Points to Ignore

Use the NumToIgnore textbox to specify the number of input points the 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 possible score. Be aware that the larger the value, the more time the tool requires to execute.

Graphics Tab

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

Cognex Core Cog Fit Ellipse Fit Ellipse Graphics Tab

The following table describes the options in the Graphics tab:

Table 3. Graphics tab options
AreaDescription
InputsControls whether or not the input points appear in the Current.InputImage image buffer.
ResultsControls which graphics appear in the LastRun.InputImage buffer.
DiagnosticsControls 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.
Results Tab

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

Cognex Core Cog Fit Ellipse Fit Ellipse Results Tab

The following table describes the information in the Results tab:

Table 4. Results tab
AreaDescription
EllipseDisplays the coordinate space for the input image, as well as the center, the radius along the x-axis and y-axis, and the angle of rotation for the major axis of the ellipse
RMS ErrorDisplays the RMS error for the fit of the ellipse

Points

Displays the following information for each input point:

  • Whether the input point was used in calculating the best fit ellipse
  • The distance from the point to the ellipse
  • The (x, y) coordinate