Get ROI
This function block extracts a rectangular region from an input image. Use it when you want to crop a specific area for further analysis or visualization.
π₯ Inputs
Image Any Source image to extract the region from.
Rectangle Rectangle coordinates defining the region to extract (typically two corner points).
π€ Outputs
Image Any The cropped region as an image.
πΉοΈ Controls
This function block has no internal interactive widgets. Provide the rectangle via a shape input or from other ROI selection blocks.
π¨ Features
Simple rectangular crop delivered as an image output for downstream blocks.
Accepts rectangle input as two corner coordinates (e.g., top-left and bottom-right).
Automatically handles rectangle values that are outside image bounds to avoid runtime errors.
π Usage Instructions
Connect the source image to the
Image Anyinput.Provide a
Rectangledescribing the region to extract. This can be produced by interactive ROI selection blocks or by other blocks that output rectangle coordinates.Use the
Image Anyoutput to send the cropped region to subsequent blocks.
π Evaluation
When evaluated, this function block returns the image inside the provided rectangle. If the rectangle extends beyond image borders, the region will be clipped to the valid image area.
π‘ Tips and Tricks
For interactive selection, combine with
Image ROI Selectto draw a rectangle on the source and feed its output into theRectangleinput.To extract multiple regions at once, use
Image ROI Select MultiorImage ROI Polygon Multito generate several rectangles or polygons, then feed each rectangle into separate instances of this block or iterate using flow-control blocks.Preview the cropped result by connecting the output to
Show Image.Use
Image ResizeorImage Paddingafter this block if the downstream block requires a specific image size.For object-based workflows, crop the region first (with this block) and then run
Find Object,Template Match, orHistogram On Lineon the extracted area to improve speed and reduce false matches.If you need a centered crop, pair with
Image ROI Centerto generate a rectangle around a chosen center point.Use
Draw Rectangleon a display path to visualize the selected ROI on the original image for verification.
π οΈ Troubleshooting
If the output is empty or clipped unexpectedly, verify that the
Rectanglecontains two valid corner coordinates inside the image bounds.If the crop looks shifted or inverted, ensure the rectangle is provided as top-left and bottom-right corner pairs (or equivalent coordinate ordering accepted by your ROI source).
If you need a consistent size ROI from varying image resolutions, add
Image Resizebefore or after this block to normalize dimensions.
Last updated
Was this helpful?