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

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

Image Any The output image with the drawn rectangles.

🕹️ Controls

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

🎨 Features

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

  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

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

💡 Tips and Tricks

Drawing Multiple Rectangles

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

Rectangle Size Control

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

Visualization of Results

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

🛠️ Troubleshooting

No Rectangles Visible

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

Incorrect Rectangle Colors

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.

Last updated