circularity ( Regions : : : Circularity )

Shape factor for the roundness of a region.

The operator circularity calculates the compactness of the input region.

Calculation: If F is the area of the region and max is the maximum distance 
            from the center to all contour pixels, the shape factor C
            is defined as:
                               C = F / (max^2 * pi)
The shape factor C of a circle is 1. If the region is long or has holes C is smaller than 1. The operator circularity especially responds to large bulges, holes and unconnected regions. In case of an empty region the operator circularity returns the value 0 (if no other behavior was set (see set_system)). If more than one region is passed the numerical values of the shape factor are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple.


Parameters

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

Circularity (output_control)
real(-array) -> real
Roundness of the input region(s).
Assertion: (0 <= Circularity) && (Circularity <= 1.0)


Example
/* Comparison between shape factors of rectangle, circle and ellipse: */
rectangle1(:R1:10,10,20,20:) >
rectangle2(:R2:100,100,0.0,100,20:) >
ellipse(:E:100,100,0.0,100,20:) >
circle(:C:100,100,20:) >
circularity([R1,R2,E,C]:::M) >
fwrite_string(::['quadrate:  ',M[1]]: ) > fnew_line(:::) >
fwrite_string(::['rectangle: ',M[2]]: ) > fnew_line(:::) >
fwrite_string(::['ellipse:   ',M[3]]: ) > fnew_line(:::) >
fwrite_string(::['circle:    ',M[4]]: ) > fnew_line(:::).

Result

The operator circularity 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


Alternatives

compactness, convexity, excentricity


See also

area_center, select_shape



Copyright © 1996-1997 MVTec Software GmbH