fit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXldfit_circle_contour_xld (算子)

名称

fit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXldfit_circle_contour_xld — 通过圆近似计算 XLD 轮廓。

签名

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)

void FitCircleContourXld(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)

void HXLDCont::FitCircleContourXld(const HString& Algorithm, Hlong MaxNumPoints, double MaxClosureDist, Hlong ClippingEndPoints, Hlong Iterations, double ClippingFactor, HTuple* Row, HTuple* Column, HTuple* Radius, HTuple* StartPhi, HTuple* EndPhi, HTuple* PointOrder) const

void HXLDCont::FitCircleContourXld(const HString& Algorithm, Hlong MaxNumPoints, double MaxClosureDist, Hlong ClippingEndPoints, Hlong Iterations, double ClippingFactor, double* Row, double* Column, double* Radius, double* StartPhi, double* EndPhi, HString* PointOrder) const

void HXLDCont::FitCircleContourXld(const char* Algorithm, Hlong MaxNumPoints, double MaxClosureDist, Hlong ClippingEndPoints, Hlong Iterations, double ClippingFactor, double* Row, double* Column, double* Radius, double* StartPhi, double* EndPhi, HString* PointOrder) const

void HXLDCont::FitCircleContourXld(const wchar_t* Algorithm, Hlong MaxNumPoints, double MaxClosureDist, Hlong ClippingEndPoints, Hlong Iterations, double ClippingFactor, double* Row, double* Column, double* Radius, double* StartPhi, double* EndPhi, HString* PointOrder) const   ( Windows only)

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)

def fit_circle_contour_xld(contours: HObject, algorithm: str, max_num_points: int, max_closure_dist: float, clipping_end_points: int, iterations: int, clipping_factor: float) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[str]]

def fit_circle_contour_xld_s(contours: HObject, algorithm: str, max_num_points: int, max_closure_dist: float, clipping_end_points: int, iterations: int, clipping_factor: float) -> Tuple[float, float, float, float, float, str]

描述

fit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXldFitCircleContourXldfit_circle_contour_xld approximates the XLD contours ContoursContoursContoursContourscontourscontours 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 (RowRowRowRowrowrow, ColumnColumnColumnColumncolumncolumn), and the RadiusRadiusRadiusRadiusradiusradius

The algorithm used for the fitting of circles can be selected via AlgorithmAlgorithmAlgorithmAlgorithmalgorithmalgorithm:

'algebraic'"algebraic""algebraic""algebraic""algebraic""algebraic"

This approach minimizes the algebraic distance between the contour points and the resulting circle.

'ahuber'"ahuber""ahuber""ahuber""ahuber""ahuber"

Similar to 'algebraic'"algebraic""algebraic""algebraic""algebraic""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""atukey"

Similar to 'algebraic'"algebraic""algebraic""algebraic""algebraic""algebraic". Here the contour points are weighted and outliers are ignored based on the approach of Tukey (see below).

'geometric'"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 distorted by noise.

'geohuber'"geohuber""geohuber""geohuber""geohuber""geohuber"

Similar to 'geometric'"geometric""geometric""geometric""geometric""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""geotukey"

Similar to 'geometric'"geometric""geometric""geometric""geometric""geometric". Here the contour points are weighted and outliers are ignored 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 ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactorclipping_factor (a scaling factor for the standard deviation) controls the amount of outliers: the smaller the value chosen for ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactorclipping_factor the more outliers are detected. 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.

The parameter IterationsIterationsIterationsIterationsiterationsiterations specifies the number of iterations for the algorithms 'algebraic'"algebraic""algebraic""algebraic""algebraic""algebraic", 'ahuber'"ahuber""ahuber""ahuber""ahuber""ahuber" and 'atukey'"atukey""atukey""atukey""atukey""atukey". This parameter is ignored for the algorithms 'geometric'"geometric""geometric""geometric""geometric""geometric", 'geohuber'"geohuber""geohuber""geohuber""geohuber""geohuber" and 'geotukey'"geotukey""geotukey""geotukey""geotukey""geotukey". If IterationsIterationsIterationsIterationsiterationsiterations is set to zero, the algorithm does not perform iterative improvements on the fitted circle, but only checks if the initial guess was already close enough depending on the chosen treatment of outliers.

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 MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPointsmax_num_points, only up to MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPointsmax_num_points 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 referring to the X-axis are returned in StartPhiStartPhiStartPhiStartPhistartPhistart_phi and EndPhiEndPhiEndPhiEndPhiendPhiend_phi, see also gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXldGenEllipseContourXldgen_ellipse_contour_xld。Contours, for which the distance between their start points and their end points is less or equal MaxClosureDistMaxClosureDistMaxClosureDistMaxClosureDistmaxClosureDistmax_closure_dist are considered to be closed. Thus, they are approximated by circles instead of circular arcs. Due to artifacts in the pre-processing the start and end points of a contour might be faulty. Therefore, it is possible to exclude ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPointsclipping_end_points 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 StartPhiStartPhiStartPhiStartPhistartPhistart_phi and EndPhiEndPhiEndPhiEndPhiendPhiend_phi

The minimum necessary number of contour points for fitting a circle is three. Therefore, it is required that the number of contour points is at least

执行信息

参数

ContoursContoursContoursContourscontourscontours (输入对象)  xld_cont(-array) objectHXLDContHObjectHXLDContHobject

Input contours.

AlgorithmAlgorithmAlgorithmAlgorithmalgorithmalgorithm (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Algorithm for the fitting of circles.

默认值: 'algebraic' "algebraic" "algebraic" "algebraic" "algebraic" "algebraic"

值列表: 'ahuber'"ahuber""ahuber""ahuber""ahuber""ahuber", 'algebraic'"algebraic""algebraic""algebraic""algebraic""algebraic", 'atukey'"atukey""atukey""atukey""atukey""atukey", 'geohuber'"geohuber""geohuber""geohuber""geohuber""geohuber", 'geometric'"geometric""geometric""geometric""geometric""geometric", 'geotukey'"geotukey""geotukey""geotukey""geotukey""geotukey"

MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPointsmax_num_points (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum number of contour points used for the computation (-1 for all points).

默认值: -1

限制: MaxNumPoints >= 3

MaxClosureDistMaxClosureDistMaxClosureDistMaxClosureDistmaxClosureDistmax_closure_dist (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Maximum distance between the end points of a contour to be considered as 'closed'.

默认值: 0.0

限制: MaxClosureDist >= 0.0

ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPointsclipping_end_points (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of points at the beginning and at the end of the contours to be ignored for the fitting.

默认值: 0

限制: ClippingEndPoints >= 0

IterationsIterationsIterationsIterationsiterationsiterations (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Maximum number of iterations for the robust weighted fitting.

默认值: 3

限制: Iterations >= 0

ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactorclipping_factor (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Clipping factor for the elimination of outliers (typical: 1.0 for Huber and 2.0 for Tukey).

默认值: 2.0

建议值: 1.0, 1.5, 2.0, 2.5, 3.0

限制: ClippingFactor > 0

RowRowRowRowrowrow (输出控制)  circle.center.y(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Row coordinate of the center of the circle.

ColumnColumnColumnColumncolumncolumn (输出控制)  circle.center.x(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Column coordinate of the center of the circle.

RadiusRadiusRadiusRadiusradiusradius (输出控制)  circle.radius(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Radius of circle.

StartPhiStartPhiStartPhiStartPhistartPhistart_phi (输出控制)  angle.rad(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Angle of the start point [rad].

EndPhiEndPhiEndPhiEndPhiendPhiend_phi (输出控制)  angle.rad(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Angle of the end point [rad].

PointOrderPointOrderPointOrderPointOrderpointOrderpoint_order (输出控制)  string(-array) HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Point order along the boundary.

值列表: 'negative'"negative""negative""negative""negative""negative", 'positive'"positive""positive""positive""positive""positive"

结果

fit_circle_contour_xldfit_circle_contour_xldFitCircleContourXldFitCircleContourXldFitCircleContourXldfit_circle_contour_xld returns 2 ( H_MSG_TRUE) if all parameter values are correct, and circles could be fitted to the input contours. 如果输入为空则可设置行为通过 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。 If the parameter ClippingFactorClippingFactorClippingFactorClippingFactorclippingFactorclipping_factor is chosen too small, i.e., all points are classified as outliers, the error 3264 is raised.

可能的前趋

gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXldgen_contours_skeleton_xld, lines_gausslines_gaussLinesGaussLinesGaussLinesGausslines_gauss, lines_facetlines_facetLinesFacetLinesFacetLinesFacetlines_facet, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, smooth_contours_xldsmooth_contours_xldSmoothContoursXldSmoothContoursXldSmoothContoursXldsmooth_contours_xld

可能的后继

gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXldGenEllipseContourXldgen_ellipse_contour_xld, disp_circledisp_circleDispCircleDispCircleDispCircledisp_circle, get_points_ellipseget_points_ellipseGetPointsEllipseGetPointsEllipseGetPointsEllipseget_points_ellipse

另见

fit_ellipse_contour_xldfit_ellipse_contour_xldFitEllipseContourXldFitEllipseContourXldFitEllipseContourXldfit_ellipse_contour_xld, fit_line_contour_xldfit_line_contour_xldFitLineContourXldFitLineContourXldFitLineContourXldfit_line_contour_xld, fit_rectangle2_contour_xldfit_rectangle2_contour_xldFitRectangle2ContourXldFitRectangle2ContourXldFitRectangle2ContourXldfit_rectangle2_contour_xld

模块

基础