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
Provide an image to
Image Anyinput.Provide a rectangle or a list of rectangles to
Rectangleinput in ((x0, y0), (x1, y1)) format.Optionally provide a boolean or list of booleans to
Statusinput to control rectangle colors.Read the annotated image from the
Image Anyoutput 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 ObjectorObject Detectioninto theRectangleinput and optionally color by condition usingStatus.For tracked objects, connect tracker outputs from
Object_Detection_Trackerto draw persistent rectangles with IDs and statuses.Pre-filter regions using
Image ROI Selectbefore drawing to limit annotations to a crop area.Combine with
Rectangles in Rectangleto filter unwanted detections and only draw rectangles that fall inside a reference area.Use
Draw DetectionsorDraw Result On Imageif you need textual labels or structured detection overlays in addition to rectangles.Send the annotated image to
Show Imagefor quick inspection or toImage Logger/Image Writeto 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
Statusinput 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 Objectwith area filtering.If you need labels or counts alongside rectangles, add
Write Text On ImageorDraw Result On Imagedownstream.
Last updated