Name
elliptic_axis_xldelliptic_axis_xldEllipticAxisXldelliptic_axis_xldEllipticAxisXldEllipticAxisXld — Parameters of the equivalent ellipse of contours or polygons.
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)
Herror elliptic_axis_xld(Hobject XLD, double* Ra, double* Rb, double* Phi)
Herror elliptic_axis_xld(Hobject XLD, HTuple* Ra, HTuple* Rb, HTuple* Phi)
double HXLD::EllipticAxisXld(double* Rb, double* Phi) const
HTuple HXLDArray::EllipticAxisXld(HTuple* Rb, HTuple* Phi) const
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
The operator elliptic_axis_xldelliptic_axis_xldEllipticAxisXldelliptic_axis_xldEllipticAxisXldEllipticAxisXld 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.
It is assumed that the contours or polygons are closed. If this is
not the case area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld will artificially close the
contours or polygons.
Calculation:
If the moments M20, M02 and M11 are
normalized to the area (see moments_xldmoments_xldMomentsXldmoments_xldMomentsXldMomentsXld),
the radii RaRaRaRaRara and RbRbRbRbRbrb are calculated as:
RaRaRaRaRara = sqrt(8.0*(M20+M02+sqrt((M20-M02)^2+4.0*M11^2)))/2.0
RbRbRbRbRbrb = sqrt(8.0*(M20+M02-sqrt((M20-M02)^2+4.0*M11^2)))/2.0
The orientation PhiPhiPhiPhiPhiphi is defined by:
PhiPhiPhiPhiPhiphi = -0.5 * atan2(2.0 * M11,M02 - M20)
It should be noted that elliptic_axis_xldelliptic_axis_xldEllipticAxisXldelliptic_axis_xldEllipticAxisXldEllipticAxisXld 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_xldTestSelfIntersectionXldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld 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_xldEllipticAxisPointsXldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld.
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
XLDXLDXLDXLDXLDXLD.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
Contours or polygons to be examined.
RaRaRaRaRara (output_control) real(-array) → HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)
Major radius.
Assertion: Ra >= 0.0
RbRbRbRbRbrb (output_control) real(-array) → HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)
Minor radius.
Assertion: Rb >= 0.0 && Rb <= Ra
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_xldEllipticAxisXldelliptic_axis_xldEllipticAxisXldEllipticAxisXld 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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If
necessary, an exception is raised.
gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXld,
edges_sub_pixedges_sub_pixEdgesSubPixedges_sub_pixEdgesSubPixEdgesSubPix,
threshold_sub_pixthreshold_sub_pixThresholdSubPixthreshold_sub_pixThresholdSubPixThresholdSubPix,
gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXld,
test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXld
area_center_xldarea_center_xldAreaCenterXldarea_center_xldAreaCenterXldAreaCenterXld,
gen_ellipse_contour_xldgen_ellipse_contour_xldGenEllipseContourXldgen_ellipse_contour_xldGenEllipseContourXldGenEllipseContourXld
elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXld,
smallest_rectangle2smallest_rectangle2SmallestRectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2
moments_xldmoments_xldMomentsXldmoments_xldMomentsXldMomentsXld,
smallest_circle_xldsmallest_circle_xldSmallestCircleXldsmallest_circle_xldSmallestCircleXldSmallestCircleXld,
smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1Xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xld,
smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2Xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xld,
shape_trans_xldshape_trans_xldShapeTransXldshape_trans_xldShapeTransXldShapeTransXld
R. Haralick, L. Shapiro
“Computer and Robot Vision”
Addison-Wesley, 1992, pp. 73-75
Foundation