ClassesClasses | | Operators

elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXld (Operator)

Name

elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXld — Parameters of the equivalent ellipse of contours or polygons.

Signature

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)

Description

The operator elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXld 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 RaRaRaRara and the minor radius RbRbRbRbrb as well as the orientation of the main axis with regard to the horizontal (PhiPhiPhiPhiphi) are determined. The angle is indicated in radians. It is assumed that the contours or polygons are closed. If this is not the case area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXld will artificially close the contours or polygons.

Calculation: If the moments , and are normalized and passed to the area (see moments_xldmoments_xldMomentsXldMomentsXldMomentsXld), the radii RaRaRaRara and RbRbRbRbrb are calculated as:

The orientation PhiPhiPhiPhiphi is defined by:

It should be noted that elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXld only returns useful results if the contour or polygon encloses a region in the plane. In particular, the contour or polygon must not intersect itself. This is particularly important if open contours or polygons are passed because they are closed automatically, which can produce a self-intersection. To test whether the contours or polygons intersect themselves, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXld can be used. If the contour or polygon intersects itself, useful values for the ellipse parameters can be calculated with elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldEllipticAxisPointsXld.

If more than one contour or polygon is passed, the results are stored in tuples in the same order as the respective contours or polygons in XLDXLDXLDXLDXLD.

Execution Information

Parameters

XLDXLDXLDXLDXLD (input_object)  xld(-array) objectHXLDHXLDHobject

Contours or polygons to be examined.

RaRaRaRara (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Major radius.

Assertion: Ra >= 0.0

RbRbRbRbrb (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Minor radius.

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

PhiPhiPhiPhiphi (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

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

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

Complexity

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

Result

elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldEllipticAxisXld returns 2 (H_MSG_TRUE) if the input is not empty. If the input is empty the behavior can be set via 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>). If necessary, an exception is raised.

Possible Predecessors

gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldGenContoursSkeletonXld, edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixEdgesSubPix, threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixThresholdSubPix, gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldGenContourPolygonXld, test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldTestSelfIntersectionXld

Possible Successors

area_center_xldarea_center_xldAreaCenterXldAreaCenterXldAreaCenterXld, gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXldGenEllipseContourXld

Alternatives

elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldEllipticAxisPointsXld, smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2

See also

moments_xldmoments_xldMomentsXldMomentsXldMomentsXld, smallest_circle_xldsmallest_circle_xldSmallestCircleXldSmallestCircleXldSmallestCircleXld, smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1XldSmallestRectangle1Xld, smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2XldSmallestRectangle2Xld, shape_trans_xldshape_trans_xldShapeTransXldShapeTransXldShapeTransXld

References

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

Module

Foundation


ClassesClasses | | Operators