Draw Rectangle

This function block draws one or multiple rectangles on an input image. Each rectangle can be drawn in green or red depending on an optional status input. It is useful for visualizing detection results, highlighting regions of interest, or annotating images for inspection and logging.

πŸ“₯ Inputs

Image Any Source image where rectangles will be drawn (required).

Rectangle One rectangle or a list of rectangles. Each rectangle is defined by top-left and bottom-right points in ((x0, y0), (x1, y1)) format (required). Multiple rectangles are supported.

Status Optional boolean or list of booleans. True draws green, False draws red. If omitted, rectangles are drawn as green by default. When multiple rectangles are provided, you may supply a matching list of status values.

πŸ“€ Outputs

Image Any The source image with rectangles drawn on a copy (original image is not modified).

πŸ•ΉοΈ Controls

This function block has no interactive widgets; behavior is driven entirely by the input sockets.

🎨 Features

  • Draws single or multiple rectangles with clear green/ red color coding for status.

  • Accepts either a single rectangle or a list of rectangles.

  • Accepts either a single status or a list of statuses; when absent, status defaults to True (green).

  • Outputs a copy of the input image annotated with the rectangles so upstream images remain unchanged.

  • Uses a visible line thickness suitable for inspection on typical image sizes.

πŸ“ Usage Instructions

  1. Provide an image to Image Any input.

  2. Provide a rectangle or a list of rectangles to Rectangle input in ((x0, y0), (x1, y1)) format.

  3. Optionally provide a boolean or list of booleans to Status input to control rectangle colors.

  4. Read the annotated image from the Image Any output and connect it to viewers, loggers, or further processing blocks.

πŸ“Š Evaluation

When executed, the block copies the incoming image, draws each provided rectangle in green for True and red for False (default is green), and returns the annotated image. Single inputs return a single annotated image; lists of rectangles return the same behavior applied to each rectangle.

πŸ’‘ Tips and Tricks

  • To visualize detection results: feed bounding boxes from Find Object or Object Detection into the Rectangle input and optionally color by condition using Status.

  • For tracked objects, connect tracker outputs from Object_Detection_Tracker to draw persistent rectangles with IDs and statuses.

  • Pre-filter regions using Image ROI Select before drawing to limit annotations to a crop area.

  • Combine with Rectangles in Rectangle to filter unwanted detections and only draw rectangles that fall inside a reference area.

  • Use Draw Detections or Draw Result On Image if you need textual labels or structured detection overlays in addition to rectangles.

  • Send the annotated image to Show Image for quick inspection or to Image Logger / Image Write to save annotated frames for audits and reports.

πŸ› οΈ Troubleshooting

  • Rectangles not visible: verify coordinate order and that coordinates are within image bounds ((x0, y0), (x1, y1)).

  • Unexpected colors: ensure the Status input matches the number of rectangles or provide a single boolean to apply to all.

  • Overlapping annotations look cluttered: try drawing on a cropped region or use fewer, larger rectangles produced by preprocessing such as Find Object with area filtering.

  • If you need labels or counts alongside rectangles, add Write Text On Image or Draw Result On Image downstream.

Last updated