select_shape_xld🔗
Short description🔗
select_shape_xld — Select contours or polygons using shape features.
Signature🔗
select_shape_xld( xld XLD, out xld SelectedXLD, string Features, string Operation, real Min, real Max )
Description🔗
The operator select_shape_xld selects contours or polygons
according to their shape. For each input contour or polygon in
XLD the indicated features (Features) are
calculated. If each (Operation = 'and') or at least one
(Operation = 'or') of the calculated features is within the
limits (Min,Max) the contour respectively polygon
is copied into the output.
The parameters Min and Max can be set to
'min' or 'max' in order to leave bottom and top limits,
respectively, open.
Condition:
Possible values for Features:
(all features can be used with polygons as well)
-
‘area’: Area of the contour (see
area_center_xld) -
‘area_points’: Area of the contour points (see
area_center_points_xld) -
‘row’: Row index of the center of gravity (see
area_center_xld) -
‘column’: Column index of the center of gravity (see
area_center_xld) -
‘row_points’: Row index of the center of gravity of the contour points (see
area_center_points_xld) -
‘column_points’: Column index of the center of gravity of the contour points (see
area_center_points_xld) -
‘width’: Width of the contour (see
height_width_ratio_xld) -
‘height’: Height of the contour (see
height_width_ratio_xld) -
‘ratio’: Ratio of the height and the width of the contour (see
height_width_ratio_xld) -
‘row1’: Row coordinate of upper left corner (see
smallest_rectangle1_xld) -
‘column1’: Column coordinate of upper left corner (see
smallest_rectangle1_xld) -
‘row2’: Row coordinate of lower right corner (see
smallest_rectangle1_xld) -
‘column2’: Column coordinate of lower right corner (see
smallest_rectangle1_xld) -
‘circularity’: Circularity (see
circularity_xld) -
‘compactness’: Compactness (see
compactness_xld) -
‘rectangularity’: Rectangularity (see
rectangularity_xld) -
‘contlength’: Total length of contour (see
length_xld) -
‘convexity’: Convexity (see
convexity_xld) -
‘ra’: Major radius of the equivalent ellipse (see
elliptic_axis_xld) -
‘rb’: Minor radius of the equivalent ellipse (see
elliptic_axis_xld) -
‘phi’: Orientation of the equivalent ellipse (see
elliptic_axis_xld) -
‘ra_points’: Major radius of the equivalent ellipse of the contour points (see
elliptic_axis_points_xld) -
‘rb_points’: Minor radius of the equivalent ellipse of the contour points (see
elliptic_axis_points_xld) -
‘phi_points’: Orientation of the equivalent ellipse of the contour points (see
elliptic_axis_points_xld) -
‘anisometry:’ Anisometry (see
eccentricity_xld) -
‘anisometry_points:’ Anisometry of the contour points (see
eccentricity_points_xld) -
‘bulkiness:’ Bulkiness (see
eccentricity_xld) -
‘struct_factor:’ Structure factor (see
eccentricity_xld) -
‘outer_radius’: Radius of smallest enclosing circle (see
smallest_circle_xld) -
‘max_diameter’: Maximum diameter of the contour (see
diameter_xld) -
‘orientation’: Orientation of the contour (see
orientation_xld) -
‘orientation_points’: Orientation of the contour points (see
orientation_points_xld) -
‘rect2_phi’: Orientation of the smallest surrounding rectangle (see
smallest_rectangle2_xld) -
‘rect2_len1’: Half the length of the smallest surrounding rectangle (see
smallest_rectangle2_xld) -
‘rect2_len2’: Half the width of the smallest surrounding rectangle (see
smallest_rectangle2_xld) -
‘moments_m11’, ‘moments_m20’, ‘moments_m02’: Geometric moments of the contour (see
moments_region_2nd) -
‘moments_m11_points’, ‘moments_m20_points’, ‘moments_m02_points’: Geometric moments of the contour points (see
moments_points_xld)
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.The use of some features
requires that the input contour respectively polygon must not
intersect itself, otherwise the results are not meaningful (Whether
the input contour or polygon intersects itself or not can be
determined with test_self_intersection_xld).
Execution information🔗
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Processed without parallelization.
Parameters🔗
XLD (input_object) xld-array → object
Contours or polygons to be examined.
SelectedXLD (output_object) xld-array → object
Contours or polygons fulfilling the condition(s).
Features (input_control) string(-array) → (string)
Shape features to be checked.
Default: 'area'
List of values: 'anisometry', 'anisometry_points', 'area', 'area_points', 'bulkiness', 'circularity', 'column', 'column1', 'column2', 'column_points', 'compactness', 'contlength', 'convexity', 'height', 'max_diameter', 'moments_m02', 'moments_m02_points', 'moments_m11', 'moments_m11_points', 'moments_m20', 'moments_m20_points', 'orientation', 'orientation_points', 'outer_radius', 'phi', 'phi_points', 'ra', 'ra_points', 'ratio', 'rb', 'rb_points', 'rect2_len1', 'rect2_len2', 'rect2_phi', 'rectangularity', 'row', 'row1', 'row2', 'row_points', 'struct_factor', 'width'
Operation (input_control) string → (string)
Operation type between the individual features.
Default: 'and'
List of values: 'and', 'or'
Min (input_control) real(-array) → (real / integer / string)
Lower limits of the features or ‘min’.
Default: 150.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: 99999.0
Minimum increment: 0.001
Recommended increment: 1.0
Restriction: Max >= Min
Result🔗
The operator select_shape_xld 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>). If necessary an
exception is raised.
Combinations with other operators🔗
Combinations
Possible predecessors
gen_contours_skeleton_xld, edges_sub_pix, threshold_sub_pix, gen_contour_polygon_xld, test_self_intersection_xld
Possible successors
See also
area_center_xld, area_center_points_xld, circularity_xld, compactness_xld, convexity_xld, elliptic_axis_xld, elliptic_axis_points_xld, eccentricity_xld, eccentricity_points_xld, rectangularity_xld, smallest_circle_xld, smallest_rectangle1_xld, smallest_rectangle2_xld, diameter_xld, orientation_xld, orientation_points_xld, moments_xld, moments_points_xld, select_obj
Module🔗
Foundation