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'            Row index of the center
     'column'         Column index of the center
     'width'          Width of the region
     'height'         Height of the region
     'row1'           Row index of upper left corner
     'column1'        Column index of upper left corner
     'row2'           Row index of lower right corner
     'column2'        Column index of lower right corner
     'circularity'    Circularity (see operator circularity)
     'compactness'    Compactness (see operator compactness)
     'contlength'     total length of contour (see operator
                      contlength)
     'convexity'      Convexity (see operator convexity)
     'ra'             Main radius of the equivalent ellipse
			(see operator elliptic_axis)
     'rb'             Secondary radius of the equivalent ellipse
			(see operator elliptic_axis)
     'phi'            Orientation of the equivalent ellipse
			(see operator elliptic_axis)
     'anisometry'     Anisometry (see operator eccentricity)
     'bulkiness'      Bulkiness (see operator eccentricity)
     'struct_factor'  Structur Factor (see operator eccentricity)
     'outer_radius'   Radius of smallest surrounding circle 
		        (see operator smallest_circle)
     'inner_radius'   Radius of largest inner circle
		        (see operator inner_circle)
     'dist_mean'      Mean distance from the region border to the
		        center (see operator roundness)
     'dist_deviation' Deviation of the distance from the region border
		        from the center (see operator roundness)
     'roundness'      Roundness (see operator roundness)
     'num_sides'      Number of polygon sides
			(see operator roundness)
     'connect_num'    Number of connection components
                      (see operator connect_and_holes)
     'holes_num'      Number of holes
                      (see operator connect_and_holes)
     'max_diameter'   Maximum diameter of the region
                      (see operator diameter_region)
     'orientation'    Orientation of the region
                      (see operator orientation_region)
     'euler_number'   Euler number (see operator euler_number)
     'rect2_phi'      Orientation of the smallest surrounding rectangle
                      (see operator smallest_rectangle2)
     'rect2_len1'     Half the length  of the smallest surrounding rectangle
                      (see operator smallest_rectangle2)
     'rect2_len2'     Half the width of the smallest surrounding rectangle
                      (see operator smallest_rectangle2)

     'moments_m11'       Geometric moments of the region
			   (see operator moments_region_2nd)
     'moments_m20'       Geometric moments of the region
			   (see operator moments_region_2nd)
     'moments_m02'       Geometric moments of the region
			   (see operator moments_region_2nd)
     'moments_ia'        Geometric moments of the region
			   (see operator moments_region_2nd)
     'moments_ib'        Geometric moments of the region
			   (see operator moments_region_2nd)
     'moments_m11_invar' Geometric moments of the region
			   (see operator moments_region_2nd_invar)
     'moments_m20_invar' Geometric moments of the region
			   (see operator moments_region_2nd_invar)
     'moments_m02_invar' Geometric moments of the region
			   (see operator moments_region_2nd_invar)
     'moments_phi1'      Geometric moments of the region
			   (see operator moments_region_2nd_rel_invar)
     'moments_phi2'      Geometric moments of the region
			   (see operator moments_region_2nd_rel_invar)
     'moments_m21'       Geometric moments of the region
			   (see operator moments_region_3rd)
     'moments_m12'       Geometric moments of the region
			   (see operator moments_region_3rd)
     'moments_m03'       Geometric moments of the region
			   (see operator moments_region_3rd)
     'moments_m30'       Geometric moments of the region
			   (see operator moments_region_3rd)
     'moments_m21_invar' Geometric moments of the region
			   (see operator moments_region_3rd_invar)
     'moments_m12_invar' Geometric moments of the region
			   (see operator moments_region_3rd_invar)
     'moments_m03_invar' Geometric moments of the region
			   (see operator moments_region_3rd_invar)
     'moments_m30_invar' Geometric moments of the region
			   (see operator moments_region_3rd_invar)
     'moments_i1'        Geometric moments of the region
			   (see operator moments_region_central)
     'moments_i2'        Geometric moments of the region
			   (see operator moments_region_central)
     'moments_i3'        Geometric moments of the region
			   (see operator moments_region_central)
     'moments_i4'        Geometric moments of the region
			   (see operator moments_region_central)
     'moments_psi1'      Geometric moments of the region
			   (see operator moments_region_central_invar)
     'moments_psi2'      Geometric moments of the region
			   (see operator moments_region_central_invar)
     'moments_psi3'      Geometric moments of the region
			   (see operator moments_region_central_invar)
     'moments_psi4'      Geometric moments of the region
			   (see operator moments_region_central_invar)

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', 'bulkiness', 'struct_factor', 'outer_radius', 'inner_radius', 'max_diameter', 'dist_mean', 'dist_deviation', 'roundness', 'num_sides', 'orientation', 'connect_num', 'holes_num', 'euler_number', 'rect2_phi', 'rect2_len1', 'rect2_len2', 'moments_m11', 'moments_m20', 'moments_m02', 'moments_ia', 'moments_ib', 'moments_m11_invar', 'moments_m20_invar', 'moments_m02_invar', 'moments_phi1', 'moments_phi2', 'moments_m21', 'moments_m12', 'moments_m03', 'moments_m30', 'moments_m21_invar', 'moments_m12_invar', 'moments_m03_invar', 'moments_m30_invar', 'moments_i1', 'moments_i2', 'moments_i3', 'moments_i4', 'moments_psi1', 'moments_psi2', 'moments_psi3', 'moments_psi4'

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
Typical 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
Typical 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,WindowHandle)

Result

The operator select_shape returns the value 2 (H_MSG_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 handling is raised.


Parallelization Information

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


Possible Predecessors

threshold, regiongrowing, connection, runlength_features


Possible Successors

select_shape, select_gray, shape_trans, reduce_domain, count_obj


See also

area_center, circularity, compactness, contlength, convexity, elliptic_axis, eccentricity, inner_circle, smallest_circle, smallest_rectangle1, smallest_rectangle2, roundness, connect_and_holes, diameter_region, orientation_region, moments_region_2nd, moments_region_2nd_invar, moments_region_2nd_rel_invar, moments_region_3rd, moments_region_3rd_invar, moments_region_central, moments_region_central_invar, select_obj


Module

Region processing



Copyright © 1996-2005 MVTec Software GmbH