elliptic_axis_points_xld elliptic_axis_points_xld EllipticAxisPointsXld EllipticAxisPointsXld (Operator)
Name
elliptic_axis_points_xld elliptic_axis_points_xld EllipticAxisPointsXld EllipticAxisPointsXld
— Parameters of the equivalent ellipse of contours or polygons treated as
point clouds.
Signature
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 )
void EllipticAxisPointsXld (const HObject& XLD , HTuple* Ra , HTuple* Rb , HTuple* Phi )
HTuple HXLD ::EllipticAxisPointsXld (HTuple* Rb , HTuple* Phi ) const
double HXLD ::EllipticAxisPointsXld (double* Rb , double* Phi ) const
Description
The operator elliptic_axis_points_xld elliptic_axis_points_xld EllipticAxisPointsXld EllipticAxisPointsXld EllipticAxisPointsXld
calculates the radii
(Ra Ra Ra Ra ra
, Rb Rb Rb Rb rb
) and the orientation (Phi Phi Phi Phi phi
, in radians)
of the ellipse
having the same orientation and the same aspect ratio as the point cloud
given by the contour or polygon
XLD XLD XLD XLD XLD
(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
,
and
are normalized to the area (see moments_points_xld moments_points_xld MomentsPointsXld MomentsPointsXld MomentsPointsXld
),
the major radius Ra Ra Ra Ra ra
and the minor radius Rb Rb Rb Rb rb
are calculated
as:
The orientation Phi Phi Phi Phi phi
, i.e., the angle between the major axis
and the x (column) axis, is defined by:
elliptic_axis_points_xld elliptic_axis_points_xld EllipticAxisPointsXld EllipticAxisPointsXld EllipticAxisPointsXld
should be used if the contour XLD XLD XLD XLD XLD
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_xld elliptic_axis_xld EllipticAxisXld EllipticAxisXld EllipticAxisXld
does not produce useful results. To test whether
the contours or polygons intersect themselves,
test_self_intersection_xld test_self_intersection_xld TestSelfIntersectionXld TestSelfIntersectionXld TestSelfIntersectionXld
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
XLD XLD XLD XLD XLD
.
Execution Information
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
Multithreading scope: global (may be called from any thread).
Automatically parallelized on tuple level.
Parameters
XLD XLD XLD XLD XLD
(input_object) xld(-array) →
object HXLD HXLD Hobject
Contours or polygons to be examined.
Ra Ra Ra Ra ra
(output_control) real(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Major radius.
Assertion: Ra >= 0.0
Rb Rb Rb Rb rb
(output_control) real(-array) →
HTuple HTuple Htuple (real) (double ) (double ) (double )
Minor radius.
Assertion: Rb >= 0.0 && Rb <= Ra
Phi Phi Phi Phi phi
(output_control) angle.rad(-array) →
HTuple HTuple Htuple (real) (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_xld elliptic_axis_points_xld EllipticAxisPointsXld EllipticAxisPointsXld EllipticAxisPointsXld
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_xld gen_contours_skeleton_xld GenContoursSkeletonXld GenContoursSkeletonXld GenContoursSkeletonXld
,
edges_sub_pix edges_sub_pix EdgesSubPix EdgesSubPix EdgesSubPix
,
threshold_sub_pix threshold_sub_pix ThresholdSubPix ThresholdSubPix ThresholdSubPix
,
gen_contour_polygon_xld gen_contour_polygon_xld GenContourPolygonXld GenContourPolygonXld GenContourPolygonXld
,
test_self_intersection_xld test_self_intersection_xld TestSelfIntersectionXld TestSelfIntersectionXld TestSelfIntersectionXld
Possible Successors
area_center_points_xld area_center_points_xld AreaCenterPointsXld AreaCenterPointsXld AreaCenterPointsXld
,
gen_ellipse_contour_xld gen_ellipse_contour_xld GenEllipseContourXld GenEllipseContourXld GenEllipseContourXld
Alternatives
elliptic_axis_xld elliptic_axis_xld EllipticAxisXld EllipticAxisXld EllipticAxisXld
,
smallest_rectangle2 smallest_rectangle2 SmallestRectangle2 SmallestRectangle2 SmallestRectangle2
See also
moments_xld moments_xld MomentsXld MomentsXld MomentsXld
,
smallest_circle_xld smallest_circle_xld SmallestCircleXld SmallestCircleXld SmallestCircleXld
,
smallest_rectangle1_xld smallest_rectangle1_xld SmallestRectangle1Xld SmallestRectangle1Xld SmallestRectangle1Xld
,
smallest_rectangle2_xld smallest_rectangle2_xld SmallestRectangle2Xld SmallestRectangle2Xld SmallestRectangle2Xld
,
shape_trans_xld shape_trans_xld ShapeTransXld ShapeTransXld ShapeTransXld
References
R. Haralick, L. Shapiro
“Computer and Robot Vision”
Addison-Wesley, 1992, pp. 73-75
Module
Foundation