For the complete documentation index, see llms.txt. This page is also available as Markdown.

Image ROI Polygon Multi

This function block lets you draw, edit and save multiple polygonal regions of interest (ROIs) directly on an image. Use it to mark arbitrary shapes, extract masked crops, and export polygon coordinates for downstream processing β€” all with simple mouse and keyboard interactions.

πŸ“₯ Inputs

Image Any Provide the image you want to annotate. Once an image is connected and the block is run, the image becomes the canvas for drawing polygons.

πŸ“€ Outputs

Highlighted Image Returns the original image annotated with overlayed polygons (saved and current) and visual markers.

Polygon Images Returns a list of cropped, masked images β€” one per saved polygon β€” preserving the original pixels inside each polygon.

Polygons Returns a list of polygon shapes as coordinate lists (contours) that can be used by other function blocks.

πŸ•ΉοΈ Controls

Draw Polygon Canvas Interactive image area where you draw polygons with left mouse clicks.

Press C Clear the current polygon (or remove the last saved polygon if no current polygon).

Press U Undo the last point of the current polygon. If there is no current polygon, this brings the last saved polygon back to editing.

Press S Save the current polygon (requires at least 3 points). Saved polygons become part of the output lists.

Mouse interactions: left-click to add a point; click-and-drag a vertex to move it; hover over vertices to highlight and enable editing. Cursor icon changes to indicate creation or vertex editing mode.

🎨 Features

  • Persistent multi-polygon editing: create multiple polygons and switch between current and saved polygons.

  • Visual overlays: different colors indicate saved polygons, the polygon being edited, hovered vertices, and active points.

  • Exportable ROI crops: returns masked and cropped images for each saved polygon suitable for further processing.

  • Coordinate export: returns polygon vertex coordinates as standard contour lists for downstream use.

  • Simple keyboard controls for quick editing (C, U, S) and intuitive mouse-driven drawing.

βš™οΈ How it runs

  • When an image is provided to the input and the block is evaluated, the image appears in the interactive canvas.

  • Draw points on the canvas to form a polygon. Visual overlays update in real time.

  • Saving a polygon adds it to the internal list; the block produces updated outputs on each run: the annotated image, a list of masked/cropped polygon images, and a list of polygon coordinates.

  • Editing and dragging vertices updates the outputs on the next evaluation.

πŸ“ Usage Instructions

  1. Connect an image source to the Image Any input (for example: Camera USB, Load Image, or Stream Reader).

  2. Click on the canvas to add polygon vertices. Add at least three points to form a polygon.

  3. Use Press S to save the current polygon. Saved polygons will be included in the outputs.

  4. To correct a point, hover until the vertex highlights and drag it to a new position.

  5. Use Press U to undo the last point, or Press C to clear the current polygon.

  6. Run the block to get Highlighted Image, Polygon Images, and Polygons outputs to feed into other blocks.

πŸ’‘ Tips and Tricks

  • Pre-select areas of interest using Image ROI Select or Image ROI when you only need to focus on a sub-region before drawing polygons.

  • Use Apply Mask after this block to combine polygon masks with other masking logic (for example to remove background or combine multiple masks).

  • Feed Polygon Images into detection or analysis blocks such as Find Object, Object Detection, or Mask Detection to run detection only inside selected regions.

  • Save examples of cropped ROIs using Image Logger or Image Write to build a reference dataset from selected polygons.

  • If you need multiple saved polygon overlays side-by-side, use Image Concatenate or Collage Images with the Polygon Images output.

  • For preprocessing before drawing (e.g., to create a binary mask you want to trace), use Blur, Image Threshold, or HSV Filter upstream to make contours simpler to follow.

πŸ› οΈ Troubleshooting

  • Nothing happens when clicking the canvas: make sure an image is connected to Image Any and run the block once so the canvas initializes.

  • Cannot save polygon: ensure your current polygon has at least three points before pressing Press S.

  • Polygon outputs empty: check that polygons were saved (use Press S) and not only kept as current; unsaved polygons are not included in Polygon Images or Polygons.

  • Cropped polygon looks empty: ensure the polygon lies within image bounds and that the image has valid pixel data. If needed, preprocess the image with Normalize Image or Denoising before drawing.

Last updated