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

Parameters of the equivalent ellipse.

The operator elliptic_axis_xld calculates the radii and the orientation of the ellipse having the ``same orientation'' and the ``same aspect ratio'' as the input contour. The closed input contour must not intersect itself, otherwise the resulting parameters are not meaningful. Several input contours can be passed in XLD as tuples. The length of the major radius Ra and the minor radius Rb as well as the orientation of the main axis with regard to the horizontal (Phi) are determined. The angle is indicated in radians.

Calculation:

        If the moments M20, M02 and M11 are
        normalized to the area (see moments_xld),
        the radii Ra and Rb are calculated as:

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

        The orientation Phi is defined by:

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

If more than one contour is passed the results are stored in tuples, the index of a value in the tuple corresponding to the index of a contour in the input.


Parameters

XLD (input_object)
xld(-array) -> object
Contour(s) to be examined.

Ra (output_control)
real(-array) -> real
Major radius.
Assertion: Ra >= 0.0

Rb (output_control)
real(-array) -> real
Minor radius.
Assertion: (Rb >= 0.0) && (Rb <= Ra)

Phi (output_control)
real(-array) -> real
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 points, the runtime complexity is O(N).


Result

elliptic_axis_xld 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>:). If necessary, an exception is raised.


Parallelization Information

elliptic_axis_xld is reentrant and automatically parallelized (on tuple level).


Possible Predecessors

gen_contours_skeleton_xld, edges_sub_pix, threshold_sub_pix, gen_contour_polygon_xld


Possible Successors

area_center_xld, gen_ellipse_contour_xld


Alternatives

smallest_rectangle2


See also

moments_xld, smallest_circle_xld, smallest_rectangle1_xld, smallest_rectangle2_xld, shape_trans_xld


References

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


Module

Sub-pixel operators



Copyright © 1996-2005 MVTec Software GmbH