Minimum Rotated Rectangle
This function block computes the smallest rotated rectangle that encloses a given shape (contour) in an image. It is useful for measuring oriented object size and orientation, and for visualizing bounding geometry that is not axis-aligned.
π₯ Inputs
ImageThe source image used for visualization and reference.ContourShape/contour used to calculate the minimum rotated rectangle.
π€ Outputs
ImageThe source image annotated with the computed rotated rectangle and contour.CenterCenter point of the computed rotated rectangle.WidthWidth value of the rotated rectangle.HeightHeight value of the rotated rectangle.AngleRotation angle of the rectangle (orientation).ContourThe contour representation of the rotated rectangle (as a shape output).Rectangle ImageA separate visualization showing the cropped/rectified rectangle region.
πΉοΈ Controls
This function block has no user-editable controls. It runs automatically when both inputs are provided.
π― Features
Computes a minimum-area rectangle that may be rotated relative to image axes.
Provides geometric measurements: center, width, height and angle.
Visualizes results directly on the source image and as a separate rectangle image.
Outputs the rectangle as a contour/shape so it can be routed to other blocks for further processing.
βοΈ Running mechanism
When an image and a contour are provided, the block analyses the contour shape to determine the smallest-area rectangle that encloses it. The block then produces numeric measurements for size and orientation, draws the rectangle on the image for immediate visual feedback, and also provides the rectangle as a separate shape and image output. If no valid contour is provided, the block will not produce geometric results (it will emit empty or default outputs).
π Usage instructions
Provide a contour input that represents the object of interest (see Tips and Tricks for how to obtain contours).
Feed the same reference image (or a copy) to the
Imageinput if you want annotated visualization.Read values from the
Center,Width,Height, andAngleoutputs for measurements or decision logic.Use the
Rectangle Imageoutput when you need a cropped or rectified view of the detected object.
π‘ Tips and Tricks
To obtain contours from raw images, combine with
Find ContourorFeature Detectorto extract object contours before feeding into this block.If contours are noisy or contain many points, use
Approximate Contourto simplify the contour and improve measurement stability.For shapes that are better enclosed by convex hulls, try using
Hull Convexfirst and feed the hull into this block.Compare different enclosing geometries by pairing this block with
Minimum Circle,Minimum Ellipse, orMinimum Rectangleto pick the best fit for your application.Use
Image ROI SelectorImage ROIto crop the region before contour extraction when you only care about a sub-region of the image.Visualize or export results with
Draw RectangleorDraw Result On Imagefor clear overlays in reports or UI.
π οΈ Troubleshooting
No measurements produced: ensure a valid contour is connected to the
Contourinput and that the contour is not empty.Unexpected orientation or size: try simplifying the contour with
Approximate Contouror verify that the contour corresponds to the intended object (useContour to Imageto inspect).Rectangle not covering object correctly: check the contour extraction step for holes or disconnected fragments; consider using
Hull Convexto create an envelope before measurement.
Last updated
Was this helpful?