elliptic_axis ( Regions : : : Ra, Rb, Phi )

Parameter of the equivalent ellipse.

The operator elliptic_axis calculates the radii and the orientation of the ellipse having the "same orientation" and the "same side relation as the input region. Several input regions can be passed in Regions as tuples. The length of the main radius Ra and the secondary radius Rb as well as the orientation of the main axis with regard to the horizontal (Phi) are determined. The angle is indicated in arc measure.

Calculation: If the moments $M20$, $M02$ and $M11$ are normalized to the area (see moments), 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 region is passed the results are stored in tuples, the index of a value in the tuple corresponding to the index of a region in the input. In case of empty region all parameters have the value 0.0 if no other behavior was set (siehe set_system(::'no_object_result',<Result>:)).


Parameters

Regions (input_object)
region(-array) -> object
Region(s) to be examined.

Ra (output_control)
real(-array) -> real
Main radius (normalized to the area).
Assertion: Ra >= 0.0

Rb (output_control)
real(-array) -> real
Secondary radius (normalized to the area).
Assertion: (Rb >= 0.0) && (Rb <= Ra)

Phi (output_control)
real(-array) -> real
Angle between main radius and x axis (arc measure).
Assertion: ((- pi / 2) < Phi) && (Phi <= (pi / 2))


Example
read_image(:Image:'fabrik':) >
open_window(::0,0,-1,-1,'root','visible','':) >
regiongrowing__(Image:Seg:5,5,6,100:) >
elliptic_axis(Seg:::Ra,Rb,Phi) >
area_center(Seg:::_,Row,Column) >
ellipse(:Ellipses:Row,Column,Phi,Ra,Rb:) >
set_draw(::'margin':) >
disp_region(Ellipses:::).

Complexity

If F is the area of a region the mean runtime complexity is O(F).


Result

The operator 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 set_system(::'no_object_result',<Result>:). The behavior in case of empty region (the region is the empty set) is set via set_system(::'empty_region_result',<Result>:). If necessary an exception is raised.


Possible Predecessors

threshold__, regiongrowing__, connection


Possible Successors

ellipse


Alternatives

smallest_rectangle2


See also

moments, select_shape, set_shape


References

R. Haralick, L. Shapiro "Computer and Robot Vision" Addison-Wesley, 1992, Seite 73-75



Copyright © 1996-1997 MVTec Software GmbH