🖥
🖥
🖥
🖥
AugeLab Studio Manual
English
K
Comment on page

# Minimum Rectangle

## Minimum Rectangle Node Documentation

The `Minimum Rectangle` node in AugeLab Studio calculates the minimum enclosing rectangle for a given contour. It outputs the image with the enclosing rectangle drawn, the center coordinates of the rectangle, the width, and the height.

### Node Overview

The `Minimum Rectangle` node takes an image and a contour as inputs and provides the following outputs:
1. 1.
Image: The input image with the minimum enclosing rectangle drawn.
2. 2.
Center: The center coordinates of the minimum enclosing rectangle.
3. 3.
Width: The width of the minimum enclosing rectangle.
4. 4.
Height: The height of the minimum enclosing rectangle.

### Node Properties

• Node Title: Minimum Rectangle
• Node ID: OP_NODE_MIN_RECT

### Inputs

The `Minimum Rectangle` node has the following input sockets:
1. 1.
Image: The input image.
2. 2.
Contour: The contour for which the minimum enclosing rectangle is to be calculated.

### Outputs

The `Minimum Rectangle` node has the following output sockets:
1. 1.
Image: The input image with the minimum enclosing rectangle drawn.
2. 2.
Center: The center coordinates of the minimum enclosing rectangle.
3. 3.
Width: The width of the minimum enclosing rectangle.
4. 4.
Height: The height of the minimum enclosing rectangle.

### Node Interaction

1. 1.
Connect an image to the Image input socket of the `Minimum Rectangle` node.
2. 2.
Connect a contour to the Contour input socket of the `Minimum Rectangle` node.
3. 3.
Run the pipeline.
4. 4.
The output sockets will provide the image with the minimum enclosing rectangle drawn, the center coordinates of the rectangle, the width, and the height.

### Implementation Details

The `Minimum Rectangle` node uses the `cv2.boundingRect` function from the OpenCV library to calculate the minimum enclosing rectangle for the given contour. The function returns the coordinates of the top-left corner of the rectangle, as well as its width and height. The node then draws the minimum enclosing rectangle on the input image using the obtained parameters.

### Usage

1. 1.
Drag and drop the `Minimum Rectangle` node from the node library onto the canvas in AugeLab Studio.
2. 2.
Connect an image to the Image input socket of the `Minimum Rectangle` node.
3. 3.
Connect a contour to the Contour input socket of the `Minimum Rectangle` node.
4. 4.
Run the pipeline.
5. 5.
The output sockets of the `Minimum Rectangle` node will provide the image with the minimum enclosing rectangle drawn, the center coordinates of the rectangle, the width, and the height.
• The `Minimum Rectangle` node is useful for calculating the minimum enclosing rectangle for a given contour in an image.
• The node outputs the image with the minimum enclosing rectangle drawn, allowing you to visualize the rectangle.
• The center coordinates, width, and height can be used for further analysis or calculations.
• Ensure that the input image and contour are correctly connected to the corresponding input sockets of the `Minimum Rectangle` node.
• The output socket Image provides the input image with the minimum enclosing rectangle drawn.
• The output socket Center provides the center coordinates of the minimum enclosing rectangle.
• The output socket Width provides the width of the minimum enclosing rectangle.
• The output socket Height provides the height of the minimum enclosing rectangle.
That concludes the documentation for the `Minimum Rectangle` node in AugeLab Studio. Use this node to calculate the minimum enclosing rectangle for a contour in an image and extract the center coordinates, width, and height for further analysis or visualization.