> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/detections-shapes/roi-processing/get-roi.md).

# 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 <a href="#inputs" id="inputs"></a>

`Image Any` Source image to extract the region from.

`Rectangle` Rectangle coordinates defining the region to extract (typically two corner points).

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Image Any` The cropped region as an image.

## 🕹️ Controls <a href="#controls" id="controls"></a>

This function block has no internal interactive widgets. Provide the rectangle via a shape input or from other ROI selection blocks.

## 🎨 Features <a href="#features" id="features"></a>

* 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 <a href="#usage" id="usage"></a>

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 <a href="#evaluation" id="evaluation"></a>

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 <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* 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 <a href="#troubleshooting" id="troubleshooting"></a>

* 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.
