Documentation Portal      

What are you looking for?

Circle Fitting

Functional Guide | Reference: SetTransitionType, SetTransitionChoice, SetCircle, Measure, GetMeasuredCircle, GetCenter, GetRadius

//////////////////////////////////////////////////////////////////////
// This code snippet shows how to create a circle measurement tool, //
// adjust the transition parameters, set the nominal gauge //
// position, perform the measurement and retrieve the result. //
//////////////////////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage;
// ECircleGauge constructor
ECircleGauge circleGauge;
// Adjust the transition parameters
circleGauge.SetTransitionType(ETransitionType_Bw);
circleGauge.SetTransitionChoice(ETransitionChoice_LargestAmplitude);
// Set the Circle fitting gauge position, diameter (50 units),
// starting angle (10°), and amplitude (270°)
EPoint center(256.f, 256.f);
ECircle circle(center, 50.f, 10.f, 270.f);
circleGauge.SetCircle(circle);
// Measure
circleGauge.Measure(&srcImage);
// Get the center point coordinates and the radius of the fitted circle
float centerX = circleGauge.GetMeasuredCircle().GetCenter().GetX();
float centerY = circleGauge.GetMeasuredCircle().GetCenter().GetY();
float radius = circleGauge.GetMeasuredCircle().GetRadius();
// Save the point gauge measurement context
circleGauge.Save("myCircleGauge.gge");
'//////////////////////////////////////////////////////////////////////
'// This code snippet shows how to create a circle measurement tool, //
'// adjust the transition parameters, set the nominal gauge //
'// position, perform the measurement and retrieve the result. //
'//////////////////////////////////////////////////////////////////////
' Image constructor
Dim srcImage As New EImageBW8
' ECircleGauge constructor
Dim circleGauge As New ECircleGauge
' Adjust the transition parameters
circleGauge.TransitionType = ETransitionType_Bw
circleGauge.TransitionChoice = ETransitionChoice_LargestAmplitude
' Set the Circle fitting gauge position, diameter (50 units),
' starting angle (10°), and amplitude (270°)
circleGauge.SetCenterXY 256#, 256#
circleGauge.Diameter = 50#
circleGauge.angle = 10#
circleGauge.Amplitude = 270#
' Measure
circleGauge.Measure srcImage
' Get the center point coordinates and the radius of the fitted circle
Dim centerX As Single
Dim centerY As Single
Dim radius As Single
centerX = circleGauge.MeasuredCircle.center.x
centerY = circleGauge.MeasuredCircle.center.y
radius = circleGauge.MeasuredCircle.radius
' Save the point gauge measurement context
circleGauge.Save "myCircleGauge.gge"
//////////////////////////////////////////////////////////////////////
// This code snippet shows how to create a circle measurement tool, //
// adjust the transition parameters, set the nominal gauge //
// position, perform the measurement and retrieve the result. //
//////////////////////////////////////////////////////////////////////
// Image constructor
EImageBW8 srcImage= new EImageBW8();
// ECircleGauge constructor
ECircleGauge circleGauge= new ECircleGauge();
// Adjust the transition parameters
circleGauge.TransitionType= ETransitionType.Bw;
circleGauge.TransitionChoice= ETransitionChoice.LargestAmplitude;
// Set the Circle fitting gauge position, diameter (50 units),
// starting angle (10°), and amplitude (270°)
EPoint center= new EPoint(256.0f, 256.0f);
ECircle circle= new ECircle(center, 50.0f, 10.0f, 270.0f);
circleGauge.Circle = circle;
// Measure
circleGauge.Measure(srcImage);
// Get the center point coordinates and the radius of the fitted circle
float centerX = circleGauge.MeasuredCircle.Center.X;
float centerY = circleGauge.MeasuredCircle.Center.Y;
float radius = circleGauge.MeasuredCircle.Radius;
// Save the point gauge measurement context
circleGauge.Save("myCircleGauge.gge");

Which API shall we display?

© 2019 EURESYS s.a.  -  About Documentation  -  Open Source Licenses  -  Open eVision 2.10.0.1121