Smallest enclosing rectangle with arbitrary orientation.
The operator smallest_rectangle2_xld determines the smallest enclosing rectangle of a contour, i.e., the rectangle with the smallest area of all rectangles containing the contour. For this rectangle the center, the inclination, and the two radii are calculated.
If more than one contour is passed in XLD the results are stored in tuples, the index of a value in the tuple corresponding to the index of a contour in the input. In case of an empty contour all parameters have the value 0.0 if no other behavior was set (see set_system).
|
XLD (input_object) |
xld(-array) -> object |
| Contour(s) to be examined. | |
|
Row (output_control) |
rectangle2.center.y(-array) -> real |
| Row coordinate of the center point of the enclosing rectangle. | |
|
Column (output_control) |
rectangle2.center.x(-array) -> real |
| Column coordinate of the center point of the enclosing rectangle. | |
|
Phi (output_control) |
rectangle2.angle.rad(-array) -> real |
| Orientation of the enclosing rectangle (arc measure) | |
| Assertion: ((- pi / 2) < Phi) && (Phi <= (pi / 2)) | |
|
Length1 (output_control) |
rectangle2.hwidth(-array) -> real |
| First radius (half length) of the enclosing rectangle. | |
| Assertion: Length1 >= 0.0 | |
|
Length2 (output_control) |
rectangle2.hheight(-array) -> real |
| Second radius (half width) of the enclosing rectangle. | |
| Assertion: (Length2 >= 0.0) && (Length2 <= Length1) | |
If N is the number of contour points and C is the number of points in the convex hull, the runtime complexity is O(N*ln(N)+C^2).
smallest_rectangle2_xld 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.
smallest_rectangle2_xld is reentrant and automatically parallelized (on tuple level).
gen_contours_skeleton_xld, edges_sub_pix, threshold_sub_pix, gen_contour_polygon_xld
smallest_rectangle1, shape_trans_xld
smallest_rectangle1, smallest_circle, elliptic_axis_xld
Sub-pixel operators