HALCON Reference Manual 10.0.2
Name
fit_circle_contour_xldfit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXld — Approximate XLD contours by circles.
fit_circle_contour_xld(Contours : : Algorithm, MaxNumPoints, MaxClosureDist, ClippingEndPoints, Iterations, ClippingFactor : Row, Column, Radius, StartPhi, EndPhi, PointOrder)
Herror fit_circle_contour_xld(const Hobject Contours, const char* Algorithm, const Hlong MaxNumPoints, double MaxClosureDist, const Hlong ClippingEndPoints, const Hlong Iterations, double ClippingFactor, double* Row, double* Column, double* Radius, double* StartPhi, double* EndPhi, char* PointOrder)
Herror T_fit_circle_contour_xld(const Hobject Contours, const Htuple Algorithm, const Htuple MaxNumPoints, const Htuple MaxClosureDist, const Htuple ClippingEndPoints, const Htuple Iterations, const Htuple ClippingFactor, Htuple* Row, Htuple* Column, Htuple* Radius, Htuple* StartPhi, Htuple* EndPhi, Htuple* PointOrder)
Herror fit_circle_contour_xld(Hobject Contours, const HTuple& Algorithm, const HTuple& MaxNumPoints, const HTuple& MaxClosureDist, const HTuple& ClippingEndPoints, const HTuple& Iterations, const HTuple& ClippingFactor, double* Row, double* Column, double* Radius, double* StartPhi, double* EndPhi, char* PointOrder)
Herror fit_circle_contour_xld(Hobject Contours, const HTuple& Algorithm, const HTuple& MaxNumPoints, const HTuple& MaxClosureDist, const HTuple& ClippingEndPoints, const HTuple& Iterations, const HTuple& ClippingFactor, HTuple* Row, HTuple* Column, HTuple* Radius, HTuple* StartPhi, HTuple* EndPhi, HTuple* PointOrder)
double HXLDCont::FitCircleContourXld(const HTuple& Algorithm, const HTuple& MaxNumPoints, const HTuple& MaxClosureDist, const HTuple& ClippingEndPoints, const HTuple& Iterations, const HTuple& ClippingFactor, double* Column, double* Radius, double* StartPhi, double* EndPhi, char* PointOrder) const
HTuple HXLDContArray::FitCircleContourXld(const HTuple& Algorithm, const HTuple& MaxNumPoints, const HTuple& MaxClosureDist, const HTuple& ClippingEndPoints, const HTuple& Iterations, const HTuple& ClippingFactor, HTuple* Column, HTuple* Radius, HTuple* StartPhi, HTuple* EndPhi, HTuple* PointOrder) const
void HOperatorSetX.FitCircleContourXld(
[in] IHUntypedObjectX* Contours, [in] VARIANT Algorithm, [in] VARIANT MaxNumPoints, [in] VARIANT MaxClosureDist, [in] VARIANT ClippingEndPoints, [in] VARIANT Iterations, [in] VARIANT ClippingFactor, [out] VARIANT* Row, [out] VARIANT* Column, [out] VARIANT* Radius, [out] VARIANT* StartPhi, [out] VARIANT* EndPhi, [out] VARIANT* PointOrder)
VARIANT HXLDContX.FitCircleContourXld(
[in] BSTR Algorithm, [in] Hlong MaxNumPoints, [in] double MaxClosureDist, [in] Hlong ClippingEndPoints, [in] Hlong Iterations, [in] double ClippingFactor, [out] VARIANT* Column, [out] VARIANT* Radius, [out] VARIANT* StartPhi, [out] VARIANT* EndPhi, [out] VARIANT* PointOrder)
static void HOperatorSet.FitCircleContourXld(HObject contours, HTuple algorithm, HTuple maxNumPoints, HTuple maxClosureDist, HTuple clippingEndPoints, HTuple iterations, HTuple clippingFactor, out HTuple row, out HTuple column, out HTuple radius, out HTuple startPhi, out HTuple endPhi, out HTuple pointOrder)
void HXLDCont.FitCircleContourXld(string algorithm, int maxNumPoints, double maxClosureDist, int clippingEndPoints, int iterations, double clippingFactor, out HTuple row, out HTuple column, out HTuple radius, out HTuple startPhi, out HTuple endPhi, out HTuple pointOrder)
void HXLDCont.FitCircleContourXld(string algorithm, int maxNumPoints, double maxClosureDist, int clippingEndPoints, int iterations, double clippingFactor, out double row, out double column, out double radius, out double startPhi, out double endPhi, out string pointOrder)
fit_circle_contour_xldfit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXld approximates the XLD contours
ContoursContoursContoursContourscontours by circles. It does not perform a segmentation of
the input contours. Thus, one has to make sure that each contour
corresponds to one and only one circle. The operator returns for
each contour the center (RowRowRowRowrow, ColumnColumnColumnColumncolumn), and the
RadiusRadiusRadiusRadiusradius.
The algorithm used for the fitting of circles can be selected via
AlgorithmAlgorithmAlgorithmAlgorithmalgorithm:
-
'algebraic'"algebraic""algebraic""algebraic""algebraic"
-
This approach minimizes the algebraic distance between the contour
points and the resulting circle.
-
'ahuber'"ahuber""ahuber""ahuber""ahuber"
-
Similar to 'algebraic'. Here the contour points are weighted to
decrease the impact of outliers based on the approach of Huber
(see below).
-
'atukey'"atukey""atukey""atukey""atukey"
-
Similar to 'algebraic'. Here the contour points are weighted to
decrease the impact of outliers based on the approach of Tukey
(see below).
-
'geometric'"geometric""geometric""geometric""geometric"
-
This approach minimizes the geometric distance
between the contour points and the resulting circle.
The distance measure is statistically optimal, but takes more
computational time.
This option is recommended if the contour
points are considerably destorted by noise.
-
'geohuber'"geohuber""geohuber""geohuber""geohuber"
-
Similar to 'geometric'. Here the contour points are weighted
to decrease the impact of outliers based on
the approach of Huber (see below).
-
'geotukey'"geotukey""geotukey""geotukey""geotukey"
-
Similar to 'geometric'. Here the contour points are weighted
to decrease the impact of outliers based on
the approach of Tukey (see below).
For '*huber' and '*tukey' a robust error statistics is used to estimate the
standard deviation of the distances from the contour points without
outliers from the approximating circle. The parameter
ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactor (a scaling factor for the standard deviation)
controls the amount of damping outliers: the smaller the value chosen for
ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactor the more outliers are detected. The detection of
outliers together with the least squares fitting can be repeated.
The parameter IterationsIterationsIterationsIterationsiterations specifies the number of iterations.
This parameter is of relevance for all
algorithms except the two based on the geometric distance, i.e. 'geohuber'
and 'geotukey', where this parameter is ignored.
In the Tukey algorithm outliers are removed, whereas in the Huber algorithm
outliers are only damped, or more precisely they are weighted linearly.
Without any robust weighting the squares of the distances are taken as
error values in the optimization, i.e. a least square formulation.
In practice, the approach of Tukey is recommended.
To reduce the computational load, the fitting of circles can be
restricted to a subset of the contour points: If a value other than
-1 is assigned to MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPoints, only up to
MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPoints points - uniformly distributed over the
contour - are used.
For circular arcs, the points on the circle closest to the start
points and end points of the original contours are chosen as start
and end points. The corresponding angles refering to the X-axis are
returned in StartPhiStartPhiStartPhiStartPhistartPhi and EndPhiEndPhiEndPhiEndPhiendPhi, see also
gen_ellipse_contour_xldgen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXld. Contours, for which the distance
between their start points and their end points is less or equal
MaxClosureDistMaxClosureDistMaxClosureDistMaxClosureDistmaxClosureDist are considered to be closed. Thus, they are
approximated by circles instead of circular arcs. Due to artefacts
in the pre-processing the start and end points of a contour might be
faulty. Therefore, it is possible to exclude
ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPoints points at the beginning and at the end of a
contour from the fitting of circles. However, they are still used
for the determination of StartPhiStartPhiStartPhiStartPhistartPhi and EndPhiEndPhiEndPhiEndPhiendPhi.
The minimun necessary number of contour points for fitting a circle
is three.
Therefore, it is required that the number of contour points is at least
3 + 2*ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPoints
.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
Algorithm for the fitting of circles.
Default value:
'algebraic'
"algebraic"
"algebraic"
"algebraic"
"algebraic"
List of values: 'algebraic'"algebraic""algebraic""algebraic""algebraic", 'ahuber'"ahuber""ahuber""ahuber""ahuber", 'atukey'"atukey""atukey""atukey""atukey", 'geometric'"geometric""geometric""geometric""geometric", 'geohuber'"geohuber""geohuber""geohuber""geohuber", 'geotukey'"geotukey""geotukey""geotukey""geotukey"
Maximum number of contour points used for the
computation (-1 for all points).
Default value: -1
Restriction: MaxNumPoints >= 3
Maximum distance between the end points of a
contour to be considered as 'closed'.
Default value: 0.0
Restriction: MaxClosureDist >= 0.0
Number of points at the beginning and at the end of the
contours to be ignored for the fitting.
Default value: 0
Restriction: ClippingEndPoints >= 0
Maximum number of iterations for the robust weighted
fitting.
Default value: 3
Restriction: Iterations >= 0
Clipping factor for the elimination of outliers
(typical: 1.0 for Huber and 2.0 for Tukey).
Default value: 2.0
List of values: 1.0, 1.5, 2.0, 2.5, 3.0
Restriction: ClippingFactor > 0
RowRowRowRowrow (output_control) circle.center.y(-array) → HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)
Row coordinate of the center of the circle.
Column coordinate of the center of the circle.
Angle of the start point [rad].
Angle of the end point [rad].
Point order along the boundary.
List of values: 'positive'"positive""positive""positive""positive", 'negative'"negative""negative""negative""negative"
fit_circle_contour_xldfit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXld returns 2 (H_MSG_TRUE) if all parameter values
are correct, and circles could be fitted to the input contours. If
the input is empty the behaviour can be set via
set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an
exception is raised.
If the parameter ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactor is chosen too small, i.e.,
all points are classified as outliers, the error 3264 is raised.
gen_contours_skeleton_xldgen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXld,
lines_gausslines_gausslines_gaussLinesGaussLinesGauss,
lines_facetlines_facetlines_facetLinesFacetLinesFacet,
edges_sub_pixedges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPix,
smooth_contours_xldsmooth_contours_xldsmooth_contours_xldSmoothContoursXldSmoothContoursXld
gen_ellipse_contour_xldgen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXld,
disp_circledisp_circledisp_circleDispCircleDispCircle,
get_points_ellipseget_points_ellipseget_points_ellipseGetPointsEllipseGetPointsEllipse
fit_ellipse_contour_xldfit_ellipse_contour_xldfit_ellipse_contour_xldFitEllipseContourXldFitEllipseContourXld,
fit_line_contour_xldfit_line_contour_xldfit_line_contour_xldFitLineContourXldFitLineContourXld
Foundation
| HALCON Reference Manual 10.0.2 |
Copyright © 1996-2011 MVTec Software GmbH |