Draw Detections

This function block overlays detection results on an image by drawing rectangles and a textual verdict (OK / Nok) for each detected object. It is intended as a final visualization or inspection step in a vision pipeline.

πŸ“₯ Inputs

Image Primary image to draw overlays on. (input socket)

Coordinate_List List of rectangle coordinates to draw. Each item should be a pair of points defining a rectangle. (input socket)

Object_Count List of counts/flags corresponding to each rectangle. Used to determine OK (green) or Nok (red) status. (input socket)

Trigger Boolean to enable drawing. When not active the block will output nothing. (input socket)

πŸ“€ Outputs

Result Image The image with drawn rectangles and status text. (output socket)

πŸ•ΉοΈ Controls

This block has no internal UI controls. Behavior is controlled entirely via its input sockets.

🎨 Features

  • Visual status overlay that draws colored rectangles and text labels on the input image.

  • Color coding: green for OK, red for Nok β€” determined from the corresponding Object_Count values.

  • Handles multiple detections at once by iterating through the lists of coordinates and counts.

  • Emits warnings when list lengths mismatch or when coordinate data is invalid.

  • Requires an active Trigger to produce an output; otherwise it produces no result.

βš™οΈ Running mechanism

  • When the block receives data and the Trigger input is True, it copies the provided Image and draws one rectangle for each entry in Coordinate_List.

  • For each rectangle, the block checks the corresponding value in Object_Count. If the value indicates presence (non-zero), the rectangle and the label are drawn in green with text "Ok". If the value is zero or missing, the rectangle and text are drawn in red with text "Nok".

  • If the number of coordinates and counts differ, the block will warn and pair items using the shortest length. Invalid coordinate entries are skipped with a warning.

  • The final annotated image is sent through the Result Image output socket.

πŸ“ Usage instructions

  1. Feed a source image into Image.

  2. Provide matching lists into Coordinate_List and Object_Count (same length recommended).

  3. Activate Trigger to generate the annotated result image.

  4. Connect the Result Image to a viewer or saver block to inspect or store the annotated frames.

πŸ’‘ Tips and Tricks

  • Use Object Detection or Object Detection - Custom (or Object Detection (D-FINE)) to produce rectangle lists and counts, then connect their rectangle and count outputs into Coordinate_List and Object_Count.

  • Combine with Object_Detection_Tracker to draw tracked rectangles with consistent positions; feed tracked rectangle outputs into this block for per-object OK/Nok overlays.

  • Use Rectangles in Rectangle or Check Area to filter detections before drawing (exclude detections outside a region of interest).

  • Preview results with Show Image and save with Image Logger or Image Write for record keeping.

  • Control when annotations appear using Logic Input or edge detectors like Rising Edge so you only draw on selected frames.

  • If you need to draw single rectangles directly, consider Draw Rectangle; use this block when you have multiple detections and want automated OK/Nok marking.

πŸ› οΈ Troubleshooting

  • No output: ensure Trigger is True and valid image data is connected to Image.

  • Mismatched lists: if Coordinate_List and Object_Count lengths differ you will see warnings and some items may be ignored β€” make sure your upstream block outputs aligned lists.

  • Invalid coordinates: if coordinate entries are malformed the block will skip them and warn; verify the format coming from detection blocks.

  • To persist results or inspect them frame-by-frame, connect Result Image to Show Image or to saving blocks like Image Logger.

Last updated

Was this helpful?