elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld (算子)

名称

elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld — 等值线或多边形椭圆的参数。

签名

elliptic_axis_xld(XLD : : : Ra, Rb, Phi)

Herror elliptic_axis_xld(const Hobject XLD, double* Ra, double* Rb, double* Phi)

Herror T_elliptic_axis_xld(const Hobject XLD, Htuple* Ra, Htuple* Rb, Htuple* Phi)

void EllipticAxisXld(const HObject& XLD, HTuple* Ra, HTuple* Rb, HTuple* Phi)

HTuple HXLD::EllipticAxisXld(HTuple* Rb, HTuple* Phi) const

double HXLD::EllipticAxisXld(double* Rb, double* Phi) const

static void HOperatorSet.EllipticAxisXld(HObject XLD, out HTuple ra, out HTuple rb, out HTuple phi)

HTuple HXLD.EllipticAxisXld(out HTuple rb, out HTuple phi)

double HXLD.EllipticAxisXld(out double rb, out double phi)

def elliptic_axis_xld(xld: HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]

def elliptic_axis_xld_s(xld: HObject) -> Tuple[float, float, float]

描述

算子 elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXldelliptic_axis_xld calculates the radii and the orientations of the ellipses having the same orientation and the same aspect ratio as the input contours or polygons. The length of the major radius RaRaRaRarara and the minor radius RbRbRbRbrbrb as well as the orientation of the main axis with regard to the horizontal (PhiPhiPhiPhiphiphi) are determined. The angle is indicated in radians.假设轮廓或多边形是闭合的。 If this is not the case elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXldelliptic_axis_xld will artificially close the contours or polygons.

Calculation: If the moments , and are normalized and passed to the area (see moments_xldmoments_xldMomentsXldMomentsXldMomentsXldmoments_xld), the radii RaRaRaRarara and RbRbRbRbrbrb are calculated as: The orientation PhiPhiPhiPhiphiphi is defined by:

需要注意的是,elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXldelliptic_axis_xld 仅在轮廓或多边形在平面上包围区域时才会返回有效结果。特别需要注意的是,轮廓或多边形不得自相交。当传递开放轮廓或多边形时,这一点尤为重要,因为它们会被自动闭合,从而可能产生自相交的情况。可使用 test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld 检测轮廓或多边形是否自相交。 If the contour or polygon intersects itself, useful values for the ellipse parameters can be calculated with elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld

如果传递多个轮廓或多边形,结果将按其在 XLDXLDXLDXLDXLDxld 中的顺序存储为元组。

执行信息

参数

XLDXLDXLDXLDXLDxld (输入对象)  xld(-array) objectHXLDHObjectHXLDHobject

待检查的轮廓或多边形。

RaRaRaRarara (输出控制)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Major radius.

Assertion: Ra >= 0.0

RbRbRbRbrbrb (输出控制)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Minor radius.

Assertion: Rb >= 0.0 && Rb <= Ra

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

Angle between the major axis and the x axis (radians).

Assertion: - pi / 2 < Phi && Phi <= pi / 2

复杂度

If N is the number of contour or polygon points, the runtime complexity is O(N).

结果

elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXldelliptic_axis_xld 在输入不为空时返回 2 ( H_MSG_TRUE )。如果输入为空则可设置行为通过 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>)。如有必要,则抛出异常。

可能的前趋

gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXldgen_contours_skeleton_xld, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPixedges_sub_pix, threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixThresholdSubPixthreshold_sub_pix, gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld

可能的后继

area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXldarea_center_xld, gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXldGenEllipseContourXldgen_ellipse_contour_xld

替代

elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld, smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2

另见

moments_xldmoments_xldMomentsXldMomentsXldMomentsXldmoments_xld, smallest_circle_xldsmallest_circle_xldSmallestCircleXldSmallestCircleXldSmallestCircleXldsmallest_circle_xld, smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld, smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2XldSmallestRectangle2Xldsmallest_rectangle2_xld, shape_trans_xldshape_trans_xldShapeTransXldShapeTransXldShapeTransXldshape_trans_xld

参考文献

R. Haralick, L. Shapiro “Computer and Robot Vision” Addison-Wesley, 1992, pp. 73-75

模块

基础