HALCON Reference Manual / XLD / Features Operators

select_shape_xld (Operator)

Name

select_shape_xld — Select contours or polygons using shape features.

Synopsis

select_shape_xld(XLD : SelectedXLD : Features, Operation, Min, 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.

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

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
     'height'         Height of the contour
     '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)
     '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 surrounding 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_xld)
     '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).

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 value: 'area'
List of values: 'area', 'area_points', 'row', 'row_points', 'column', 'column_points', 'width', 'height', 'row1', 'column1', 'row2', 'column2', 'circularity', 'compactness', 'contlength', 'convexity', 'ra', 'ra_points', 'rb', 'rb_points', 'phi', 'phi_points', 'anisometry', 'anisometry_points', 'bulkiness', 'struct_factor', 'outer_radius', 'max_diameter', 'orientation', 'orientation_points', 'rect2_phi', 'rect2_len1', 'rect2_len2', 'moments_m11', 'moments_m11_points', 'moments_m20', 'moments_m20_points', 'moments_m02', 'moments_m02_points'

Operation (input_control) string (string)
Operation type between 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

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.

Parallelization Information

select_shape_xld is reentrant and processed without parallelization.

Possible Predecessors

gen_contours_skeleton_xld, edges_sub_pix, threshold_sub_pix, gen_contour_polygon_xld, test_self_intersection_xld

Possible Successors

shape_trans_xld, count_obj

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, 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


HALCON Reference Manual / XLD / Features Operators
Version 9.0.1 Copyright © 1996-2009 MVTec Software GmbH