Minimum Rotated Rectangle

This function block outputs a rotated rectangle that encloses a minimum area around a specified contour detected in an image. It is particularly useful for object shape analysis in computer vision.

📥 Inputs

Image Any The input image in which the contour is located.

Contour The contour of the object for which the minimum rotated rectangle needs to be calculated.

📤 Outputs

Image An output image displaying the original image with the minimum rotated rectangle drawn around the specified contour.

Center The center point of the minimum rotated rectangle.

Width The width of the minimum rotated rectangle.

Height The height of the minimum rotated rectangle.

Angle The rotation angle of the minimum rotated rectangle.

Contour The contour that defines the minimum rotated rectangle.

🕹️ Controls

There are no specific control elements for this function block as all parameters are derived from the inputs provided.

🎨 Features

Rotated Rectangle Generation Automatically calculates and draws the smallest enclosing rotated rectangle around the specified contour.

Detailed Output Provides the center, dimensions, and orientation of the rectangle in addition to the modified image.

📝 Usage Instructions

  1. Input Image: Connect an image containing the object you want to analyze to the Image Any input.

  2. Input Contour: Provide the contour of the object you wish to enclose with the minimum rotated rectangle.

  3. Execute Evaluation: Run the function block to obtain the image with the rectangle and to receive the parameters of the rectangle.

📊 Evaluation

Upon execution, this function block will compute the minimum rotated rectangle for the given contour, outputting both the modified image and the relevant geometric properties of the rectangle.

💡 Tips and Tricks

Providing Effective Contours

Make sure your contour input is well-defined. You can use Find Contour or Blob Detector prior to this block for accurate contour detection.

Visualizing Results

To ensure that the rectangle is correctly defined, consider coupling this block with the Show Image block to visualize the results in real-time.

Multiple Contours

If you have multiple contours, ensure to process each contour individually. You can use Demux or Batch Processing to handle multiple outputs efficiently.

🛠️ Troubleshooting

No Rectangle Drawn

If no rectangle appears on the output image, verify that the contour is valid and correctly defined by ensuring it is not empty or malformed.

Invalid Input Image

If you encounter errors regarding the input image, double-check that the input image is correctly passed and is in a valid format (e.g., not None).

Last updated