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

Image ROI Polygon

This function block lets you draw a polygon directly on an image to define a custom region of interest (ROI). Use it to select irregular shapes, edit vertices interactively, and output both the cropped image inside the polygon and the polygon coordinates for downstream processing.

πŸ“₯ Inputs

  • Image Any The image to display and annotate. Connect any image-producing block here so you can draw the polygon on a live preview.

πŸ“€ Outputs

  • Image Any The cropped image corresponding to the polygon area. If no polygon is defined this output may be empty.

  • Polygon The polygon coordinates returned as a contour/shape list suitable for use by other blocks.

πŸ•ΉοΈ Controls

  • Left Click Add a vertex at the clicked location.

  • Drag Click and drag an existing vertex to reposition it.

  • U Undo the last added vertex.

  • C Clear all vertices and start again.

  • Overlay Preview Visual markers and fill are shown while editing so you can see the polygon, vertices and the selection area in real time.

βš™οΈ Running mechanism

  • Connect an image source to the Image Any input and run the scenario once to populate the preview.

  • Draw the polygon by clicking to add vertices. The overlay updates immediately.

  • Use drag and keyboard shortcuts to refine the shape.

  • When a polygon is present the block produces a cropped image (tight bounding rectangle of the polygon) and the polygon coordinate list on each evaluation.

✨ Features

  • Interactive polygon drawing with vertex editing.

  • Undo/clear shortcuts for quick corrections.

  • Visual overlay with vertex highlights while hovering or dragging.

  • Outputs both a cropped image and precise polygon coordinates.

  • Supports non-rectangular and multi-point ROIs for irregular objects.

πŸ“ Usage tips

  • Draw at least three points to form a filled polygon; fewer points will not yield a valid ROI crop.

  • After drawing, run downstream blocks to process the cropped image or polygon coordinates.

  • Use the drag feature to fine-tune vertex positions for accurate measurements.

πŸ’‘ Tips and Tricks

  • Preview larger images by connecting the output to Show Image so you can draw more precisely on a separate viewer.

  • If you need multiple ROIs in one image, use Image ROI Polygon Multi to store several polygon selections and then feed each to processing blocks.

  • Combine with Get ROI or Image ROI Select if you prefer rectangular crops first, then refine with polygon for complex shapes.

  • Use Apply Mask after this block to mask the original image with the polygon and feed that masked image into analysis blocks.

  • Feed the cropped polygon image into detection or analysis blocks such as Find Object, Object Detection, Mask Detection, Histogram On Line or Color Density Percentage to focus processing on the selected area.

  • If the image is too large to draw comfortably, add Image Resizer or Image Resize before this block; remember that resizing changes pixel coordinates used by downstream geometry-sensitive blocks.

  • Save selected ROIs with Image Logger, Image Write or Multi Image Write for dataset collection or later review.

πŸ› οΈ Troubleshooting

  • No image displayed: make sure an image-producing block is connected to Image Any and run once to populate the preview.

  • ROI not produced: ensure you have at least three vertices; fewer points cannot form a filled polygon.

  • Polygon appears misplaced after resizing upstream images: either draw at the final resolution or insert Image Resizer consistently in the pipeline so coordinates remain aligned.

  • Need exact coordinates for other blocks: use the Polygon output (coordinate list) and verify with a preview via Show Image or re-run after adjustments.

Last updated