> 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/image-roi-select-multi.md).

# Image ROI Select Multi

Interactive block for selecting and editing multiple rectangular Regions Of Interest (ROIs) on an image. Draw, move and resize rectangles directly on the image preview to produce cropped images and pixel rectangle coordinates for downstream processing.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

`Image` Connect a color or grayscale image to be used as the source for ROI selection.

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

`Images` Cropped image for each ROI (list).\
`Rectangles` Pixel rectangles for each ROI (list).\
`Selected Image` Crop for the currently selected ROI (single image or None).\
`Selected Rectangle` Pixel rectangle of the selected ROI (single rectangle or None).

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

* Draw: click-drag empty area on the image to create a new ROI.
* Move: click-drag inside a rectangle to move it.
* Resize: click-drag rectangle edges or corners to resize.
* `Ctrl` Hold while dragging to force creation of a new rectangle (even when over an existing ROI).
* `C` Press to clear all ROIs.
* `U` Press to undo the last created ROI.
* `Delete` / `Backspace` Press to remove the selected ROI.
* `Escape` Press to cancel selection/dragging.

The preview shows overlays and handles to indicate hover, selection and preview states.

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

* Multi-ROI editing: create many rectangular ROIs in one image session.
* Live preview: interactive overlay and preview updates while editing.
* Pixel-accurate outputs: `Rectangles` and `Selected Rectangle` are returned in pixel coordinates relative to the source image.
* Responsive UI: preview resizes to fit the block area and keeps overlays consistent.
* Serialization: ROIs and selection are preserved when saving/loading a scenario.

## 📊 How it runs <a href="#evaluation" id="evaluation"></a>

* When an image arrives at the `Image` input the block stores it as the current source and updates the preview.
* The block converts the current ROI definitions to pixel rectangles using the source image size and outputs: `Images` (cropped per ROI), `Rectangles` (pixel coords), `Selected Image` and `Selected Rectangle`.
* If no image is connected the block outputs empty lists and None values (no crops).

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. Connect an image-producing block to the `Image` input (camera, loader, stream).
2. Click-drag on the image preview to create ROIs. Use edges/corners to adjust size.
3. Click inside a rectangle to select it; the selected crop is available from `Selected Image`.
4. Use the keyboard shortcuts (`C`, `U`, `Delete`/`Backspace`, `Escape`) and hold `Ctrl` to tweak creation behavior.
5. Use the outputs in downstream blocks to analyze or save the crops.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Quick inspection: connect the `Selected Image` output to the Show Image block to preview the currently selected crop in a larger viewer.
* Batch processing: feed the `Images` output into Collage Images to create a combined view of all ROI crops, or into Image Logger / Image Write to save crops automatically.
* Focus analysis: use the `Rectangles` output as input to Get ROI when you want to apply the same rectangle list to other images (for example time series or different frames).
* Combine with detectors: create ROIs to localize areas of interest, then send the cropped images (`Images`) to blocks such as Find Object, Feature Detector, Blob Detector or OCR to run targeted detection/recognition on each crop.
* Visualization: draw the returned `Rectangles` on the source image using Draw Rectangle or Draw Detections to visualize results alongside other annotations.
* Preprocessing: before manual ROI selection you can prepare the source image with Blur, Image Threshold or HSV Filter to make structures easier to see and select.
* Use with pipeline loops: pass ROI crops into Analysis or AI blocks (for example Object Detection or Background Removal) to create efficient per-region processing flows.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No preview or controls disabled: make sure a valid image is connected to the `Image` input.
* ROIs not exported correctly: ensure the source image has correct dimensions; the block outputs pixel rectangles relative to the input image size.
* Unexpected selection behavior: hold `Ctrl` while dragging to force creation of a new ROI instead of modifying an existing one.
* Too many or missing ROIs in downstream steps: verify you are using the correct output (`Images` vs `Selected Image`) and that downstream blocks accept list inputs when feeding multiple crops.
