Skip to content

smallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xldsmallest_rectangle1_xld🔗

Short description🔗

smallest_rectangle1_xldSmallestRectangle1XldSmallestRectangle1Xldsmallest_rectangle1_xldsmallest_rectangle1_xld — Enclosing rectangle parallel to the coordinate axes of contours or polygons.

Signature🔗

smallest_rectangle1_xld( xld XLD, out rectangle.origin.y Row1, out rectangle.origin.x Column1, out rectangle.corner.y Row2, out rectangle.corner.x Column2 )void SmallestRectangle1Xld( const HObject& XLD, HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2 )static void HOperatorSet.SmallestRectangle1Xld( HObject XLD, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2 )def smallest_rectangle1_xld( xld: HObject ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def smallest_rectangle1_xld_s( xld: HObject ) -> Tuple[float, float, float, float]Herror smallest_rectangle1_xld( const Hobject XLD, double* Row1, double* Column1, double* Row2, double* Column2 )

Herror T_smallest_rectangle1_xld( const Hobject XLD, Htuple* Row1, Htuple* Column1, Htuple* Row2, Htuple* Column2 )

void HXLD::SmallestRectangle1Xld( HTuple* Row1, HTuple* Column1, HTuple* Row2, HTuple* Column2 ) const

void HXLD::SmallestRectangle1Xld( double* Row1, double* Column1, double* Row2, double* Column2 ) const

void HXLD.SmallestRectangle1Xld( out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2 )

void HXLD.SmallestRectangle1Xld( out double row1, out double column1, out double row2, out double column2 )

Description🔗

The operator smallest_rectangle1_xldSmallestRectangle1Xld calculates the enclosing rectangle (parallel to the coordinate axes) for each input contour or polygon. The enclosing rectangle is described by the coordinates of the corner pixels (Row1row1row_1,Column1column1column_1,Row2row2row_2,Column2column2column_2)

If more than one contour or polygon is passed, the results are stored in tuples in the same order as the respective contours or polygons in XLDXLDxld. In case of an empty contour all parameters have the value 0 if no other behavior was set (see set_systemSetSystem).

Attention🔗

In case of empty contours the result of Row1row1row_1,Column1column1column_1, Row2row2row_2 and Column2column2column_2 (all are 0) can lead to confusion.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

Parameters🔗

XLDXLDxld (input_object) xld(-array) → objectHObjectHXLDHObjectHobject

Contours or polygons to be examined.

Row1row1row_1 (output_control) rectangle.origin.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of upper left corner point of the enclosing rectangle.

Column1column1column_1 (output_control) rectangle.origin.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of upper left corner point of the enclosing rectangle.

Row2row2row_2 (output_control) rectangle.corner.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of lower right corner point of the enclosing rectangle.

Column2column2column_2 (output_control) rectangle.corner.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of lower right corner point of the enclosing rectangle.

Complexity🔗

If \(N\) is the number of contour points, the runtime complexity is \(O(N)\).

Result🔗

smallest_rectangle1_xldSmallestRectangle1Xld returns 2 (H_MSG_TRUE) if the input is not empty. If the input is empty the behavior can be set via set_system(::'no_object_result',<Result>:). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

gen_contours_skeleton_xldGenContoursSkeletonXld, edges_sub_pixEdgesSubPix, threshold_sub_pixThresholdSubPix, gen_contour_polygon_xldGenContourPolygonXld

Possible successors

gen_polygons_xldGenPolygonsXld

Alternatives

height_width_ratio_xldHeightWidthRatioXld, smallest_rectangle2_xldSmallestRectangle2Xld, shape_trans_xldShapeTransXld

See also

shape_trans_xldShapeTransXld, smallest_rectangle2_xldSmallestRectangle2Xld, smallest_circle_xldSmallestCircleXld, elliptic_axis_xldEllipticAxisXld, area_center_xldAreaCenterXld

Module🔗

Foundation