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

  1. Connect the source image to the Image Any input.

  2. Provide a Rectangle describing the region to extract. This can be produced by interactive ROI selection blocks or by other blocks that output rectangle coordinates.

  3. Use the Image Any output 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 Select to draw a rectangle on the source and feed its output into the Rectangle input.

  • To extract multiple regions at once, use Image ROI Select Multi or Image ROI Polygon Multi to 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 Resize or Image Padding after 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, or Histogram On Line on the extracted area to improve speed and reduce false matches.

  • If you need a centered crop, pair with Image ROI Center to generate a rectangle around a chosen center point.

  • Use Draw Rectangle on 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 Rectangle contains 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 Resize before or after this block to normalize dimensions.

Last updated

Was this helpful?