select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldselect_shape_xld (Operator)
select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldselect_shape_xld
— Select contours or polygons using shape features.
Signature
Herror select_shape_xld(const Hobject XLD, Hobject* SelectedXLD, const char* Features, const char* Operation, double Min, double Max)
Herror T_select_shape_xld(const Hobject XLD, Hobject* SelectedXLD, const Htuple Features, const Htuple Operation, const Htuple Min, const Htuple Max)
void SelectShapeXld(const HObject& XLD, HObject* SelectedXLD, const HTuple& Features, const HTuple& Operation, const HTuple& Min, const HTuple& Max)
HXLD HXLD::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLD HXLD::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLD HXLD::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLD HXLD::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
HXLDCont HXLDCont::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLDCont HXLDCont::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLDCont HXLDCont::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLDCont HXLDCont::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
HXLDPoly HXLDPoly::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLDPoly HXLDPoly::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLDPoly HXLDPoly::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLDPoly HXLDPoly::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
HXLDPara HXLDPara::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLDPara HXLDPara::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLDPara HXLDPara::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLDPara HXLDPara::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
HXLDModPara HXLDModPara::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLDModPara HXLDModPara::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLDModPara HXLDModPara::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLDModPara HXLDModPara::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
HXLDExtPara HXLDExtPara::SelectShapeXld(const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max) const
HXLDExtPara HXLDExtPara::SelectShapeXld(const HString& Features, const HString& Operation, double Min, double Max) const
HXLDExtPara HXLDExtPara::SelectShapeXld(const char* Features, const char* Operation, double Min, double Max) const
HXLDExtPara HXLDExtPara::SelectShapeXld(const wchar_t* Features, const wchar_t* Operation, double Min, double Max) const
(
Windows only)
static void HOperatorSet.SelectShapeXld(HObject XLD, out HObject selectedXLD, HTuple features, HTuple operation, HTuple min, HTuple max)
HXLD HXLD.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLD HXLD.SelectShapeXld(string features, string operation, double min, double max)
HXLDCont HXLDCont.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLDCont HXLDCont.SelectShapeXld(string features, string operation, double min, double max)
HXLDPoly HXLDPoly.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLDPoly HXLDPoly.SelectShapeXld(string features, string operation, double min, double max)
HXLDPara HXLDPara.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLDPara HXLDPara.SelectShapeXld(string features, string operation, double min, double max)
HXLDModPara HXLDModPara.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLDModPara HXLDModPara.SelectShapeXld(string features, string operation, double min, double max)
HXLDExtPara HXLDExtPara.SelectShapeXld(HTuple features, string operation, HTuple min, HTuple max)
HXLDExtPara HXLDExtPara.SelectShapeXld(string features, string operation, double min, double max)
def select_shape_xld(xld: HObject, features: MaybeSequence[str], operation: str, min: MaybeSequence[Union[int, float, str]], max: MaybeSequence[Union[int, float, str]]) -> HObject
Description
The operator select_shape_xldselect_shape_xldSelectShapeXldSelectShapeXldselect_shape_xld
selects contours or polygons
according to their shape. For each input contour or polygon in
XLDXLDXLDXLDxld
the indicated features (FeaturesFeaturesFeaturesfeaturesfeatures
) are
calculated. If each (OperationOperationOperationoperationoperation
= 'and'"and""and""and""and") or at least one
(OperationOperationOperationoperationoperation
= 'or'"or""or""or""or") of the calculated features is within the
limits (MinMinMinminmin
,MaxMaxMaxmaxmax
) the contour respectively polygon
is copied into the output.
The parameters MinMinMinminmin
and MaxMaxMaxmaxmax
can be set to
'min'"min""min""min""min" or 'max'"max""max""max""max" in order to leave bottom and top limits,
respectively, open.
Condition:
Possible values for FeaturesFeaturesFeaturesfeaturesfeatures
:
(all features can be used with polygons as well)
- 'area':
Area of the contour
(see area_center_xldarea_center_xldAreaCenterXldAreaCenterXldarea_center_xld
)
- 'area_points':
Area of the contour points
(see area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
)
- 'row':
Row index of the center of gravity
(see area_center_xldarea_center_xldAreaCenterXldAreaCenterXldarea_center_xld
)
- 'column':
Column index of the center of gravity
(see area_center_xldarea_center_xldAreaCenterXldAreaCenterXldarea_center_xld
)
- 'row_points':
Row index of the center of gravity of the contour
points (see area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
)
- 'column_points':
Column index of the center of gravity of the contour
points (see area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
)
- 'width':
Width of the contour (see
height_width_ratio_xldheight_width_ratio_xldHeightWidthRatioXldHeightWidthRatioXldheight_width_ratio_xld
)
- 'height':
Height of the contour (see
height_width_ratio_xldheight_width_ratio_xldHeightWidthRatioXldHeightWidthRatioXldheight_width_ratio_xld
)
- 'ratio':
Ratio of the height and the width of the
contour (see height_width_ratio_xldheight_width_ratio_xldHeightWidthRatioXldHeightWidthRatioXldheight_width_ratio_xld
)
- 'row1':
Row coordinate of upper left corner
(see smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld
)
- 'column1':
Column coordinate of upper left corner
(see smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld
)
- 'row2':
Row coordinate of lower right corner
(see smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld
)
- 'column2':
Column coordinate of lower right corner
(see smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld
)
- 'circularity':
Circularity (see circularity_xldcircularity_xldCircularityXldCircularityXldcircularity_xld
)
- 'compactness':
Compactness (see compactness_xldcompactness_xldCompactnessXldCompactnessXldcompactness_xld
)
- 'rectangularity':
Rectangularity (see rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldrectangularity_xld
)
- 'contlength':
Total length of contour
(see length_xldlength_xldLengthXldLengthXldlength_xld
)
- 'convexity':
Convexity (see convexity_xldconvexity_xldConvexityXldConvexityXldconvexity_xld
)
- 'ra':
Major radius of the equivalent ellipse
(see elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld
)
- 'rb':
Minor radius of the equivalent ellipse
(see elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld
)
- 'phi':
Orientation of the equivalent ellipse
(see elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld
)
- 'ra_points':
Major radius of the equivalent ellipse of the
contour points (see elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld
)
- 'rb_points':
Minor radius of the equivalent ellipse of the
contour points (see elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld
)
- 'phi_points':
Orientation of the equivalent ellipse of the
contour points (see elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld
)
- 'anisometry:'
Anisometry (see eccentricity_xldeccentricity_xldEccentricityXldEccentricityXldeccentricity_xld
)
- 'anisometry_points:'
Anisometry of the contour points
(see eccentricity_points_xldeccentricity_points_xldEccentricityPointsXldEccentricityPointsXldeccentricity_points_xld
)
- 'bulkiness:'
Bulkiness (see eccentricity_xldeccentricity_xldEccentricityXldEccentricityXldeccentricity_xld
)
- 'struct_factor:'
Structure factor
(see eccentricity_xldeccentricity_xldEccentricityXldEccentricityXldeccentricity_xld
)
- 'outer_radius':
Radius of smallest enclosing circle
(see smallest_circle_xldsmallest_circle_xldSmallestCircleXldSmallestCircleXldsmallest_circle_xld
)
- 'max_diameter':
Maximum diameter of the contour
(see diameter_xlddiameter_xldDiameterXldDiameterXlddiameter_xld
)
- 'orientation':
Orientation of the contour
(see orientation_xldorientation_xldOrientationXldOrientationXldorientation_xld
)
- 'orientation_points':
Orientation of the contour points
(see orientation_points_xldorientation_points_xldOrientationPointsXldOrientationPointsXldorientation_points_xld
)
- 'rect2_phi':
Orientation of the smallest surrounding rectangle
(see smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xldsmallest_rectangle2_xld
)
- 'rect2_len1':
Half the length of the smallest surrounding
rectangle
(see smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xldsmallest_rectangle2_xld
)
- 'rect2_len2':
Half the width of the smallest surrounding
rectangle
(see smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xldsmallest_rectangle2_xld
)
- 'moments_m11', 'moments_m20', 'moments_m02':
Geometric moments of the contour
(see moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd
)
- 'moments_m11_points', 'moments_m20_points', 'moments_m02_points':
Geometric moments of the contour points
(see moments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXldmoments_points_xld
)
If only one feature (FeaturesFeaturesFeaturesfeaturesfeatures
) is used the value of
OperationOperationOperationoperationoperation
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_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld
).
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
XLDXLDXLDXLDxld
(input_object) xld-array →
objectHXLDHObjectHObjectHobject
Contours or polygons to be examined.
SelectedXLDSelectedXLDSelectedXLDselectedXLDselected_xld
(output_object) xld-array →
objectHXLDHObjectHObjectHobject *
Contours or polygons fulfilling the condition(s).
FeaturesFeaturesFeaturesfeaturesfeatures
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Shape features to be checked.
Default:
'area'
"area"
"area"
"area"
"area"
List of values:
'anisometry'"anisometry""anisometry""anisometry""anisometry", 'anisometry_points'"anisometry_points""anisometry_points""anisometry_points""anisometry_points", 'area'"area""area""area""area", 'area_points'"area_points""area_points""area_points""area_points", 'bulkiness'"bulkiness""bulkiness""bulkiness""bulkiness", 'circularity'"circularity""circularity""circularity""circularity", 'column'"column""column""column""column", 'column1'"column1""column1""column1""column1", 'column2'"column2""column2""column2""column2", 'column_points'"column_points""column_points""column_points""column_points", 'compactness'"compactness""compactness""compactness""compactness", 'contlength'"contlength""contlength""contlength""contlength", 'convexity'"convexity""convexity""convexity""convexity", 'height'"height""height""height""height", 'max_diameter'"max_diameter""max_diameter""max_diameter""max_diameter", 'moments_m02'"moments_m02""moments_m02""moments_m02""moments_m02", 'moments_m02_points'"moments_m02_points""moments_m02_points""moments_m02_points""moments_m02_points", 'moments_m11'"moments_m11""moments_m11""moments_m11""moments_m11", 'moments_m11_points'"moments_m11_points""moments_m11_points""moments_m11_points""moments_m11_points", 'moments_m20'"moments_m20""moments_m20""moments_m20""moments_m20", 'moments_m20_points'"moments_m20_points""moments_m20_points""moments_m20_points""moments_m20_points", 'orientation'"orientation""orientation""orientation""orientation", 'orientation_points'"orientation_points""orientation_points""orientation_points""orientation_points", 'outer_radius'"outer_radius""outer_radius""outer_radius""outer_radius", 'phi'"phi""phi""phi""phi", 'phi_points'"phi_points""phi_points""phi_points""phi_points", 'ra'"ra""ra""ra""ra", 'ra_points'"ra_points""ra_points""ra_points""ra_points", 'ratio'"ratio""ratio""ratio""ratio", 'rb'"rb""rb""rb""rb", 'rb_points'"rb_points""rb_points""rb_points""rb_points", 'rect2_len1'"rect2_len1""rect2_len1""rect2_len1""rect2_len1", 'rect2_len2'"rect2_len2""rect2_len2""rect2_len2""rect2_len2", 'rect2_phi'"rect2_phi""rect2_phi""rect2_phi""rect2_phi", 'rectangularity'"rectangularity""rectangularity""rectangularity""rectangularity", 'row'"row""row""row""row", 'row1'"row1""row1""row1""row1", 'row2'"row2""row2""row2""row2", 'row_points'"row_points""row_points""row_points""row_points", 'struct_factor'"struct_factor""struct_factor""struct_factor""struct_factor", 'width'"width""width""width""width"
OperationOperationOperationoperationoperation
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Operation type between the individual features.
Default:
'and'
"and"
"and"
"and"
"and"
List of values:
'and'"and""and""and""and", 'or'"or""or""or""or"
MinMinMinminmin
(input_control) real(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)
Lower limits of the features or 'min'.
Default:
150.0
Minimum increment:
0.001
Recommended increment:
1.0
MaxMaxMaxmaxmax
(input_control) real(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (real / integer / string) (double / int / long / string) (double / Hlong / HString) (double / Hlong / char*)
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_xldselect_shape_xldSelectShapeXldSelectShapeXldselect_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>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)
. If necessary an
exception is raised.
Possible Predecessors
gen_contours_skeleton_xldgen_contours_skeleton_xldGenContoursSkeletonXldGenContoursSkeletonXldgen_contours_skeleton_xld
,
edges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPixedges_sub_pix
,
threshold_sub_pixthreshold_sub_pixThresholdSubPixThresholdSubPixthreshold_sub_pix
,
gen_contour_polygon_xldgen_contour_polygon_xldGenContourPolygonXldGenContourPolygonXldgen_contour_polygon_xld
,
test_self_intersection_xldtest_self_intersection_xldTestSelfIntersectionXldTestSelfIntersectionXldtest_self_intersection_xld
Possible Successors
shape_trans_xldshape_trans_xldShapeTransXldShapeTransXldshape_trans_xld
,
count_objcount_objCountObjCountObjcount_obj
See also
area_center_xldarea_center_xldAreaCenterXldAreaCenterXldarea_center_xld
,
area_center_points_xldarea_center_points_xldAreaCenterPointsXldAreaCenterPointsXldarea_center_points_xld
,
circularity_xldcircularity_xldCircularityXldCircularityXldcircularity_xld
,
compactness_xldcompactness_xldCompactnessXldCompactnessXldcompactness_xld
,
convexity_xldconvexity_xldConvexityXldConvexityXldconvexity_xld
,
elliptic_axis_xldelliptic_axis_xldEllipticAxisXldEllipticAxisXldelliptic_axis_xld
,
elliptic_axis_points_xldelliptic_axis_points_xldEllipticAxisPointsXldEllipticAxisPointsXldelliptic_axis_points_xld
,
eccentricity_xldeccentricity_xldEccentricityXldEccentricityXldeccentricity_xld
,
eccentricity_points_xldeccentricity_points_xldEccentricityPointsXldEccentricityPointsXldeccentricity_points_xld
,
rectangularity_xldrectangularity_xldRectangularityXldRectangularityXldrectangularity_xld
,
smallest_circle_xldsmallest_circle_xldSmallestCircleXldSmallestCircleXldsmallest_circle_xld
,
smallest_rectangle1_xldsmallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xld
,
smallest_rectangle2_xldsmallest_rectangle2_xldSmallestRectangle2XldSmallestRectangle2Xldsmallest_rectangle2_xld
,
diameter_xlddiameter_xldDiameterXldDiameterXlddiameter_xld
,
orientation_xldorientation_xldOrientationXldOrientationXldorientation_xld
,
orientation_points_xldorientation_points_xldOrientationPointsXldOrientationPointsXldorientation_points_xld
,
moments_xldmoments_xldMomentsXldMomentsXldmoments_xld
,
moments_points_xldmoments_points_xldMomentsPointsXldMomentsPointsXldmoments_points_xld
,
select_objselect_objSelectObjSelectObjselect_obj
Module
Foundation