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 AnyThe image to display and annotate. Connect any image-producing block here so you can draw the polygon on a live preview.
π€ Outputs
Image AnyThe cropped image corresponding to the polygon area. If no polygon is defined this output may be empty.PolygonThe polygon coordinates returned as a contour/shape list suitable for use by other blocks.
πΉοΈ Controls
Left ClickAdd a vertex at the clicked location.DragClick and drag an existing vertex to reposition it.UUndo the last added vertex.CClear all vertices and start again.Overlay PreviewVisual 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 Anyinput 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 Imageso you can draw more precisely on a separate viewer.If you need multiple ROIs in one image, use
Image ROI Polygon Multito store several polygon selections and then feed each to processing blocks.Combine with
Get ROIorImage ROI Selectif you prefer rectangular crops first, then refine with polygon for complex shapes.Use
Apply Maskafter 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 LineorColor Density Percentageto focus processing on the selected area.If the image is too large to draw comfortably, add
Image ResizerorImage Resizebefore this block; remember that resizing changes pixel coordinates used by downstream geometry-sensitive blocks.Save selected ROIs with
Image Logger,Image WriteorMulti Image Writefor dataset collection or later review.
π οΈ Troubleshooting
No image displayed: make sure an image-producing block is connected to
Image Anyand 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 Resizerconsistently in the pipeline so coordinates remain aligned.Need exact coordinates for other blocks: use the
Polygonoutput (coordinate list) and verify with a preview viaShow Imageor re-run after adjustments.
Last updated