Skip to content

segment_contour_attrib_xldsegment_contour_attrib_xldSegmentContourAttribXldSegmentContourAttribXldsegment_contour_attrib_xldsegment_contour_attrib_xld🔗

Short description🔗

segment_contour_attrib_xldsegment_contour_attrib_xldSegmentContourAttribXldSegmentContourAttribXldsegment_contour_attrib_xldsegment_contour_attrib_xld — Segment XLD contour parts whose local attributes fulfill given conditions.

Signature🔗

segment_contour_attrib_xld( xld_cont Contour, out xld_cont ContourPart, string Attribute, string Operation, real Min, real Max )segment_contour_attrib_xld( Contour : ContourPart : Attribute, Operation, Min, Max : )void SegmentContourAttribXld( const HObject& Contour, HObject* ContourPart, const HTuple& Attribute, const HTuple& Operation, const HTuple& Min, const HTuple& Max )static void HOperatorSet.SegmentContourAttribXld( HObject contour, out HObject contourPart, HTuple attribute, HTuple operation, HTuple min, HTuple max )def segment_contour_attrib_xld( contour: HObject, attribute: MaybeSequence[str], operation: str, min: MaybeSequence[Union[int, float, str]], max: MaybeSequence[Union[int, float, str]] ) -> HObject

Herror segment_contour_attrib_xld( const Hobject Contour, Hobject* ContourPart, const char* Attribute, const char* Operation, double Min, double Max )

Herror T_segment_contour_attrib_xld( const Hobject Contour, Hobject* ContourPart, const Htuple Attribute, const Htuple Operation, const Htuple Min, const Htuple Max )

HXLDCont HXLDCont::SegmentContourAttribXld( const HTuple& Attribute, const HString& Operation, const HTuple& Min, const HTuple& Max ) const

HXLDCont HXLDCont::SegmentContourAttribXld( const HString& Attribute, const HString& Operation, double Min, double Max ) const

HXLDCont HXLDCont::SegmentContourAttribXld( const char* Attribute, const char* Operation, double Min, double Max ) const

HXLDCont HXLDCont::SegmentContourAttribXld( const wchar_t* Attribute, const wchar_t* Operation, double Min, double Max ) const (Windows only)

HXLDCont HXLDCont.SegmentContourAttribXld( HTuple attribute, string operation, HTuple min, HTuple max )

HXLDCont HXLDCont.SegmentContourAttribXld( string attribute, string operation, double min, double max )

Description🔗

segment_contour_attrib_xldSegmentContourAttribXld segments the contour in Contourcontourcontour into contour parts ContourPartcontourPartcontour_part. The segmentation of the contour depends on the values of its attributes Attributeattributeattribute (see the possible values for Attributeattributeattribute below). The operator checks which attribute values lie within the given limits (Minminmin, Maxmaxmax) and returns the corresponding contour segments with its attributes in ContourPartcontourPartcontour_part.

If Operationoperationoperation is set to 'and'"and", each of the given attributes must lie within the limits. If Operationoperationoperation is set to 'or'"or", at least one of the attributes has to be within the limits. The attributes are processed in the same order as they are given in Attributeattributeattribute. If only one attribute is used, the value of Operationoperationoperation is ignored. The parameters Minminmin and Maxmaxmax can be set to 'min'"min" or 'max'"max" in order to leave bottom and top limit, respectively, open.

Note that not all attributes are defined in all contours per default. Which attributes are defined for a contour depends on how the contour was instantiated, and whether some operations have been previously performed on it. For example, the attributes 'width_right'"width_right" and 'width_left'"width_left" are only defined, if the contour was created with the operator lines_gaussLinesGauss. Likewise, the attribute 'distance'"distance" is only present if the distances to some other contour was previously calculated with distance_contours_xldDistanceContoursXld or apply_distance_transform_xldApplyDistanceTransformXld.

Condition: \(Min_{i} \leq Attribute_{i}(Object) \leq Max_{i}\)

Possible values for Attributeattributeattribute:

  • ‘edge_direction’: Edge direction

  • ‘angle’: Angle of the direction perpendicular to the contour

  • ‘response’: Magnitude of the second derivative

  • ‘width_right’: Line width to the right of the line

  • ‘width_left’: Line width to the left of the line

  • ‘contrast’: Contrast of the line point

  • ‘asymmetry’: Asymmetry of the line point

  • ‘distance’: Minimum pointwise distance to a reference contour

To find out which operators add the attributes above to contours and further details about those attributes, see get_contour_attrib_xldGetContourAttribXld.

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🔗

Contourcontourcontour (input_object) xld_cont(-array) → objectobjectHObjectHXLDContHObjectHobject

Contour to be segmented.

ContourPartcontourPartcontour_part (output_object) xld_cont-array → objectobjectHObjectHXLDContHObjectHobject *

Segmented contour parts.

Attributeattributeattribute (input_control) string(-array) → (string)(string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Contour attributes to be checked.

Default: 'distance'"distance"
List of values: 'angle', 'asymmetry', 'contrast', 'distance', 'edge_direction', 'response', 'width_left', 'width_right'"angle", "asymmetry", "contrast", "distance", "edge_direction", "response", "width_left", "width_right"

Operationoperationoperation (input_control) string → (string)(string)HTuple (HString)HTuple (string)strHtuple (char*)

Linkage type of the individual attributes.

Default: 'and'"and"
List of values: 'and', 'or'"and", "or"

Minminmin (input_control) real(-array) → (real / integer / string)(real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, float, str]]Htuple (double / Hlong / char*)

Lower limits of the attribute values.

Default: 150.0150.0
Minimum increment: 0.001
Recommended increment: 1.0

Maxmaxmax (input_control) real(-array) → (real / integer / string)(real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, float, str]]Htuple (double / Hlong / char*)

Upper limits of the attribute values.

Default: 99999.099999.0
Minimum increment: 0.001
Recommended increment: 1.0
Restriction: Max >= Min

Example🔗

(HDevelop)


read_image (Image, 'fabrik')
edges_sub_pix (Image, Edges, 'canny', 1, 20, 40)
* select 'vertical' edges:
segment_contour_attrib_xld (Edges, ContourPart, 'edge_direction', \
                            'and', rad(90-20), rad(90+20))

Result🔗

The operator segment_contour_attrib_xldSegmentContourAttribXld 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

lines_gaussLinesGauss, edges_sub_pixEdgesSubPix, apply_distance_transform_xldApplyDistanceTransformXld, distance_contours_xldDistanceContoursXld

Possible successors

fit_line_contour_xldFitLineContourXld, fit_ellipse_contour_xldFitEllipseContourXld, fit_circle_contour_xldFitCircleContourXld, fit_rectangle2_contour_xldFitRectangle2ContourXld

See also

split_contours_xldSplitContoursXld, get_contour_global_attrib_xldGetContourGlobalAttribXld, query_contour_attribs_xldQueryContourAttribsXld, get_contour_attrib_xldGetContourAttribXld

Module🔗

Foundation