Utils

Provides utility features including adding bounding boxes to images for visualization and debugging purposes.

Quick Start

To get started:

  • Select an operation from the Choose Operation dropdown
  • Configure operation-specific parameters
  • Send input via msg.payload
  • Receive processed result in msg.payload

Configuration

Operations

Add Bounding Box

Draws bounding boxes on images for visualization.

Common Input Format

msg.payload.image_path (string)

Path to the image file.

msg.payload.bounding_box (array)

Array of bounding box coordinates to draw.

Format: [[x1, y1, x2, y2], ...]

Common Output Format

msg.payload (object)

Returns the path to the annotated image.

Example: {"output_path": "annotated/image_with_boxes.png"}

Example

Input (msg.payload)

{
  "image_path": "images/document.png",
  "bounding_box": [[100, 50, 300, 150], [100, 200, 400, 300]]
}

Output (msg.payload)

{
  "output_path": "annotated/document_with_boxes.png"
}

Errors

When the block fails, it raises an error. Use a Catch block in your flow to handle failures and inspect the error payload.

Common mistakes

  • Invalid image path: Ensure the image file exists.
  • Invalid bounding box format: Coordinates must be [x1, y1, x2, y2] format.

Best Practices

  • Use for debugging and visualization during development
  • Apply consistent colors and styles for bounding boxes
  • Consider image resolution when setting box thickness