# Image ROI Select Multi

This function block lets you interactively select multiple rectangular regions of interest (ROIs) on an input image using the mouse. Use click‑and‑drag to draw each rectangle, press `U` to undo the last rectangle, and press `C` to clear all selections. The block outputs the cropped images and the rectangle coordinates for further processing.

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

`Image Any`\
Accepts any image source (camera frame, loaded image, processed image) to display and crop.

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

`Images`\
A list of cropped images, one per selected rectangle. If no rectangles are selected, the full input image is returned as a single-item list.

`Rectangles`\
A list of rectangle coordinates corresponding to each cropped image. Coordinates are returned in image space for downstream blocks.

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

`Image` interactive canvas

* Click and drag on the image area to draw a rectangle.
* Release the mouse to finalize the rectangle (a live preview is shown while drawing).
* The canvas shows all finalized rectangles overlaid for visual feedback.

`U`

* Undo last finalized rectangle.

`C`

* Clear all rectangles.

## ⚙️ Running mechanism <a href="#how-it-works" id="how-it-works"></a>

* When an image is provided to the `Image Any` input and the block runs, the image is shown on the interactive canvas.
* Each drawn rectangle is recorded and kept between runs so you can refine selections across steps.
* On evaluation the block crops the input image for every stored rectangle and returns the cropped images and their rectangle coordinates.
* If no rectangles are present, the block returns the whole image as a single ROI so downstream flow continues without interruption.

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

* Select multiple ROIs in one session and keep them for repeated processing.
* Live preview while drawing and clear visual overlays of all ROIs.
* Keyboard shortcuts for quick undo and clear operations.
* Outputs both cropped images and rectangle coordinates so you can use either image or spatial data downstream.
* Works with any image-producing block (live camera, file loader, or a processed image).

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

1. Connect an image source to `Image Any` (for example a camera block like `Camera USB` or a file loader like `Load Image`).
2. Run the scenario once so the image appears on the interactive canvas.
3. Click and drag on the canvas to draw rectangles. Release to finalize each rectangle.
4. Use `U` to undo the last rectangle or `C` to clear all.
5. Re-run to update outputs; use the `Images` output to continue processing the cropped regions and the `Rectangles` output when you need position data.

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

* If the input image is large and canvas interaction is slow, precede this block with `Image Resize` to reduce the working size for faster selection, then feed the resulting ROIs into a higher-resolution pipeline if needed.
* Use `Show Image` to preview selected ROIs or to open a larger viewer for precise selection.
* Combine with `Find Object` or `Template Match` by sending cropped ROIs to those blocks for focused detection on each region.
* Save crops automatically by routing the `Images` output to `Image Logger` or `Multi Image Write`.
* Create a dataset grid of all selected ROIs using `Collage Images` after selection to review results at a glance.
* If you need polygonal regions instead of rectangles, consider `Image ROI Polygon Multi` for multi-polygon selection workflows.

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

* No image appears on the canvas
  * Ensure an image-producing block is connected to `Image Any` and run the flow once to load image data.
* Drawing does not register or preview is missing
  * Make sure the canvas is active and the image has been rendered. Try re-running the flow or reconnecting the image source.
* Output list is empty
  * If no rectangles were selected this block returns the entire image as a single-item list; check the `Images` output accordingly.
* Selections look misaligned after resizing the viewer
  * The block stores coordinates relative to the image; ensure the input image used for cropping is the same resolution as shown in the canvas for pixel-perfect crops.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/detections-shapes/roi-processing/image-roi-select-multi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
