# Draw Rectangle

This function block is designed to draw rectangles on an image based on given coordinates. It offers flexibility to specify multiple rectangles as well as color-coding based on input status.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Image Any` The image on which rectangles are drawn.

`Rectangle` The coordinates for drawing the rectangle. These can be specified as a single pair of coordinates or as a list of coordinates for multiple rectangles.

`Status` An optional input that defines the color of the rectangle. If set to TRUE, the rectangle will be green. If FALSE, it will be red.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Image Any` The output image with the drawn rectangles.

## 🕹️ Controls <a href="#controls" id="controls"></a>

This function block does not have additional control options; however, the coordinates and status are managed through input sockets.

## 🎨 Features <a href="#features" id="features"></a>

`Flexible Rectangle Drawing` Supports both single and multiple rectangles based on varied coordinate inputs.

`Color Coding` The ability to toggle between green and red rectangles based on the status input provides immediate visual feedback.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. **Connect Input Image**: Link the image where the rectangles should be drawn to the `Image Any` input.
2. **Specify Rectangle Coordinates**: Provide coordinate data to draw rectangles. These coordinates can be a single pair or a list for multiple rectangles.
3. **Set Status (Optional)**: Optionally, specify the status to control the rectangle's color. This input can be TRUE for green and FALSE for red.
4. **Evaluate**: Run the block to generate an output image with rectangles drawn as specified.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When executed, this function block modifies the input image by drawing the desired rectangles, then outputs the modified image.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

<details>

<summary>Drawing Multiple Rectangles</summary>

To draw multiple rectangles, ensure that you provide a list of coordinate pairs and connect the appropriate status to color them correctly.

</details>

<details>

<summary>Rectangle Size Control</summary>

To adjust the size of the rectangles, modify the input coordinates. The coordinates defined by `((y0, x0), (y1, x1))` determine the rectangle's corners.

</details>

<details>

<summary>Visualization of Results</summary>

You may utilize the `Show Image` block after the output to visualize the results after the rectangles have been drawn.

</details>

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>No Rectangles Visible</summary>

Ensure that the coordinates provided are valid and fall within the dimensions of the input image. Invalid coordinates may not render visible rectangles.

</details>

<details>

<summary>Incorrect Rectangle Colors</summary>

Check the status input to ensure it is set to TRUE for green or FALSE for red. If no status is provided, the default behavior is to not draw any rectangles.

</details>
