elliptic_axis — Calculate the parameters of the equivalent ellipse.
elliptic_axis calculates the radii
Rb and the orientation
Phi of the ellipse having the
same orientation and the same aspect ratio as the input region in
Several input regions can be passed as tuples.
Ra represents the main radius of the ellipse whereas the radius
Rb represents the secondary radius of the ellipse.
The orientation of the main axis with regard to the x-axis is returned in
Phi which is represented in radians.
The principle axis of the ellipse is equivalent to the principle axis of the
inertia moment of the input region.
In the documentation of this chapter (Regions / Features), you can find an image illustrating regions which vary in their Phi, Ra and Rb.
If the moments , and are
normalized and passed to the area (see
Rb are calculated as:
Phi is defined by:
If more than one region is passed, the results are stored in tuples. The index of an resulting tuple element corresponds to the index of the respective input region.
If an empty region is passed, all parameters have the value 0.0 if no other
behavior was set
It should be noted that, like for all region-moments-based
operators, the region's pixels are regarded as mathematical,
infinitely small points that are represented by the center of the
pixels. This means that
Rb can assume the
value 0. In particular, for an empty region and a region
containing a single point
Rb = 0
is returned. Furthermore, for regions whose points lie exactly on a
straight line (e.g., one pixel high horizontal regions or one pixel
wide vertical regions),
Rb = 0 is returned.
Main radius (normalized to the area).
Ra >= 0.0
Secondary radius (normalized to the area).
Rb >= 0.0 && Rb <= Ra
Angle between main radius and x-axis in radians.
- pi / 2 < Phi && Phi <= pi / 2
read_image(Image,'fabrik') regiongrowing(Image,Seg,5,5,6,100) elliptic_axis(Seg,Ra,Rb,Phi) area_center(Seg,_,Row,Column) gen_ellipse(Ellipses,Row,Column,Phi,Ra,Rb) dev_set_draw('margin') dev_display(Ellipses)
If F is the area of a region the mean runtime complexity is O(sqrt(F)).
elliptic_axis returns the value TRUE if the input
is not empty. The behavior in case of empty input (no input regions available)
is set via the operator
The behavior in case of empty region (the region is the empty set) is set via
If necessary an exception is raised.
R. Haralick, L. Shapiro “Computer and Robot Vision” Addison-Wesley, 1992, pp. 73-75