HALCON Reference Manual 10.0.2
Table of Contents / XLD / Features ClassesClassesClasses | | | Operators

elliptic_axis_points_xldelliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld (Operator)

Name

elliptic_axis_points_xldelliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld — Parameters of the equivalent ellipse of contours or polygons treated as point clouds.

Signature

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

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

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

Herror elliptic_axis_points_xld(Hobject XLD, double* Ra, double* Rb, double* Phi)

Herror elliptic_axis_points_xld(Hobject XLD, HTuple* Ra, HTuple* Rb, HTuple* Phi)

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

HTuple HXLDArray::EllipticAxisPointsXld(HTuple* Rb, HTuple* Phi) const

void HOperatorSetX.EllipticAxisPointsXld(
[in] IHUntypedObjectX* XLD, [out] VARIANT* Ra, [out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDContX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDPolyX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDParaX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDModParaX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

VARIANT HXLDExtParaX.EllipticAxisPointsXld(
[out] VARIANT* Rb, [out] VARIANT* Phi)

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

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

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

Description

The operator elliptic_axis_points_xldelliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld calculates the radii (RaRaRaRara, RbRbRbRbrb) and the orientation (PhiPhiPhiPhiphi, in radians) of the ellipse having the same orientation and the same aspect ratio as the point cloud given by the contour or polygon XLDXLDXLDXLDXLD (i.e., the order of the points in the contour or polygon is not taken into account). If the contour or polygon is closed (end point = start point), the end point of the contour or polygon is not taken into account to avoid that it receives twice the weight of the other points.

Calculation:

        If the moments M20, M02 and M11 are
        normalized to the area (see moments_points_xldmoments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXld),
        the major radius RaRaRaRara and minor radius RbRbRbRbrb are
        calculated as:

        RaRaRaRara = sqrt(8.0*(M20+M02+sqrt((M20-M02)^2+4.0*M11^2)))/2.0
        RbRbRbRbrb = sqrt(8.0*(M20+M02-sqrt((M20-M02)^2+4.0*M11^2)))/2.0

        The orientation PhiPhiPhiPhiphi, i.e., the angle between the major axis
        and the x (column) axis, is defined by:

        PhiPhiPhiPhiphi = -0.5 * atan2(2.0 * M11,M02 - M20)

elliptic_axis_points_xldelliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld should be used if the contour XLDXLDXLDXLDXLD intersects itself or if it is not possible to close the contour using a line from end to start point without self-intersection, because in this case elliptic_axis_xldelliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXld does not produce useful results. To test whether the contours or polygons intersect themselves, test_self_intersection_xldtest_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld can be used.

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.

Parallelization

Parameters

XLDXLDXLDXLDXLD (input_object)  xld(-array) objectHXLDHXLDHXLDXHobject

Contours or polygons to be examined.

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

Major radius.

Assertion: Ra >= 0.0

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

Minor radius.

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

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

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

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

Complexity

Let n be the number of points of the contour or polygon. Then the run time is O(n).

Result

elliptic_axis_points_xldelliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld 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>)set_system("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_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXld, edges_sub_pixedges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPix, threshold_sub_pixthreshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPix, gen_contour_polygon_xldgen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXld, test_self_intersection_xldtest_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld

Possible Successors

area_center_points_xldarea_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXld, gen_ellipse_contour_xldgen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXld

Alternatives

elliptic_axis_xldelliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXld, smallest_rectangle2smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2

See also

moments_xldmoments_xldmoments_xldMomentsXldMomentsXld, smallest_circle_xldsmallest_circle_xldsmallest_circle_xldSmallestCircleXldSmallestCircleXld, smallest_rectangle1_xldsmallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xld, smallest_rectangle2_xldsmallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xld, shape_trans_xldshape_trans_xldshape_trans_xldShapeTransXldShapeTransXld

References

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

Module

Foundation


Table of Contents / XLD / Features ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH