select_shape ( Regions : SelectedRegions : Features, Operation, Min, Max : )

Choose regions with the aid of shape features.

The operator select_shape chooses regions according to shape. For each input region from Regions the indicated features (Features) are calculated. If each (Operation = 'and') or at least one (Operation = 'or') of the calculated features is within the default limits (Min,Max) the region is adapted into the output (duplicated).

Condition:      Min_i <= Feature_i(Object) <= Max_i

Possible values for Features:

     'area'           Area of the object
     'row'            Line index of the center
     'column'         Column index of the center
     'width'          Width of the region
     'height'         Height of the region
     'row1'           Line index of upper left corner
     'column1'        Column index of upper left corner
     'row2'           Line index of lower right corner
     'column2'        Column index of lower right corner
     'circularity'    Roundness (see procedure circularity)
     'compactness'    Compactness (see procedure compactness)
     'contlength'     total length of contour (see procedure
                      contlength)
     'convexity'      Convexity (see procedure convexity)
     'ra'             Main radius (see procedure elliptic_axis)
     'rb'             Secondary radius (see procedure elliptic_axis)
     'phi'            Orientation (see procedure elliptic_axis)
     'anisometry'     Anisometry (see procedure excentricity)
     'outer_radius'   Radius of smallest surrounding circle 
     'inner_radius'   Radius of largest inner circle
     'roundness'      Roundness (see procedure roundness)
     'num_sides'      Number of polygon sides (see procedure
roundness)

If only one feature (Features) is used the value of Operation is meaningless. Several features are processed in the sequence in which they are entered.


Parameters

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

SelectedRegions (output_object)
region-array -> object
Regions fulfilling the condition.

Features (input_control)
string(-array) -> string
Shape features to be checked.
Default value: 'area'
List of values: 'area', 'row', 'column', 'width', 'height', 'row1', 'column1', 'row2', 'column2', 'circularity', 'compactness', 'contlength', 'convexity', 'ra', 'rb', 'phi', 'anisometry', 'outer_radius', 'inner_radius', 'roundness', 'num_sides'

Operation (input_control)
string -> string
Linkage type of the individual features.
Default value: 'and'
List of values: 'and', 'or'

Min (input_control)
real(-array) -> real / integer / string
Lower limits of the features or 'min'.
Default value: 150.0
Range of values: 0.0 <= Min <= 99999.0
Minimum increment: 0.001
Recommended increment: 1.0

Max (input_control)
real(-array) -> real / integer / string
Upper limits of the features or 'max'.
Default value: 99999.0
Range of values: 0.0 <= Max <= 99999.0
Minimum increment: 0.001
Recommended increment: 1.0
Restriction: Max >= Min


Example
/* where are the eyes of the ape ? */
read_image(:Image:'affe':) >
threshold__(Image:S1:160,255:) >
connection(S1:S2::) >
select_shape(S2:Eyes:['area','anisometry'],'and',[500,1.0],[50000,1.7]:) >
disp_region(Eyes:::).

Result

The operator select_shape returns the value TRUE if the input is not empty. The behavior in case of empty input (no input objects 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, fetch_chord


Possible Successors

select_shape, select_grey__, shape_trans, reduce_domain, count_obj


See also

circularity, compactness, contlength, convexity, elliptic_axis, excentricity, inner_circle, smallest_circle, smallest_rectangle1, smallest_rectangle2, select_obj, roundness



Copyright © 1996-1997 MVTec Software GmbH