Assembly: Cognex.VisionPro.Caliper (in Cognex.VisionPro.Caliper.dll) Version: 69.0.0.0
Parameters
- image
- Type: Cognex.VisionPro CogImage8Grey
The image in which to locate the circle.
Return Value
Type: CogFindCircleResultsThe returned CogCircle.
| Exception | Condition |
|---|---|
| CogOperatorNoInputImageException | image is null. |
| CogImageNoPixelsException | image is not allocated. |
| CogCaliperNoScorersException | The collection of scoring functions in CaliperRunParams is null or empty or all the scoring functions are disabled and the maximum number of results specified is greater than 0. |
| CogCaliperBadScorerException | The collection of single-edge scoring functions in CaliperRunParams contains an edge pair scoring function, or the collection of edge-pair scoring functions in CaliperRunParams contains an single-edge scoring function. |
| CogFindAllCalipersFailedException | All of the calipers failed. This can happen when the values for CaliperSearchLength or CaliperProjectionLength are too small or when all of the specified caliper regions fall completely outside of the input image. |
| CogFindInvalidExpectedShapeException | The selected space of the ExpectedCircularArc is not a valid space of the input image; the selected space name of the ExpectedCircularArc is a nonqualified space name and more than one instance of it exists in the space tree of the input image; or the selected space name of the ExpectedCircularArc is not a legal space name. |
Finds a CogCircle in the provided image by fitting the highest scoring edge points found by a suite of calipers defined by the CogFindCircle.
Imports Cognex.VisionPro
Imports Cognex.VisionPro.Caliper
Imports Cognex.VisionPro.ImageProcessing
' Create a CogFindCircle operator and a results object
Dim myFCO As New CogFindCircle
Dim myArc As New CogCircularArc
Dim myFCOResults As New CogFindCircleResults
Dim i As Integer
' Configure the CogFindCircle Object
myFCO.ExpectedCircularArc = myArc
myFCO.CaliperRunParams.FilterHalfSizeInPixels = 3
myFCO.NumCalipers = 10
myFCO.CaliperProjectionLength = 25
myFCO.CaliperSearchLength = 35
myFCO.CaliperSearchDirection = CogFindCircleSearchDirectionConstants.Inward
myFCO.DecrementNumToIgnore = True
myFCO.RadiusConstraint = myArc.Radius
myFCO.RadiusConstraintEnabled = True
' Execute it
myFCOResults = myFCO.Execute(CType(myAFT.OutputImage, CogImage8Grey))
' Display the found circle
CogDisplay1.StaticGraphics.Clear()
CogDisplay1.StaticGraphics.Add(myFCOResults.GetCircle.CopyBase(CogCopyShapeConstants.All), "")
' Display some information about the result
lblRes.text = "Points found; " & myFCOResults.NumPointsFound _
& " points used; " & myFCOResults.NumPointsUsed _
& " RMS error: " & myFCOResults.RMSError
' And display some information about each individual result
For i = 0 To myFCOResults.Count - 1
LstRes.Items.Add("Point (" & myFCOResults(i).X.ToString & ", " & myFCOResults(i).Y.ToString _
& ") Found: " & myFCOResults(i).Found & " Used: " & myFCOResults(i).Used _
& " is " & myFCOResults(i).DistanceToCircle & " from found shape.")
Next iusing Cognex.VisionPro; using Cognex.VisionPro.Caliper; using Cognex.VisionPro.ImageProcessing; // Create a CogFindCircle operator and a results object CogFindCircle myFCO = new CogFindCircle(); CogCircularArc myArc = new CogCircularArc(); CogFindCircleResults myFCOResults = new CogFindCircleResults(); int i; // Configure the CogFindCircle Object myFCO.ExpectedCircularArc = myArc; myFCO.CaliperRunParams.FilterHalfSizeInPixels = 3; myFCO.NumCalipers = 10; myFCO.CaliperProjectionLength = 25; myFCO.CaliperSearchLength = 35; myFCO.CaliperSearchDirection = CogFindCircleSearchDirectionConstants.Inward; myFCO.DecrementNumToIgnore = true; myFCO.RadiusConstraint = myArc.Radius; myFCO.RadiusConstraintEnabled = true; // Execute it myFCOResults = myFCO.Execute((CogImage8Grey)myAFT.OutputImage ); // Display the found circle CogDisplay1.StaticGraphics.Clear(); CogDisplay1.StaticGraphics.Add(myFCOResults.GetCircle().CopyBase(CogCopyShapeConstants.All), ""); // Display some information about the result lblRes.Text = "Points found; " + myFCOResults.NumPointsFound + " points used; " + myFCOResults.NumPointsUsed + " RMS error: " + myFCOResults.RMSError; // And display some information about each individual result for (i = 0; i < myFCOResults.Count; i++) { LstRes.Items.Add("Point (" + myFCOResults[i].X + ", " + myFCOResults[i].Y + ") Found: " + myFCOResults[i].Found + " Used: " + myFCOResults[i].Used + " is " + myFCOResults[i].DistanceToCircle + " from found shape."); }