# Image ROI Select

This function block allows users to select a Region of Interest (ROI) within a given image using mouse input. It visually marks the selected area and outputs the cropped section for further processing.

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

`Image Any` The original image from which the ROI will be selected.

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

`Image Any` This output contains the cropped image data based on the selected ROI.

`Rectangle` The coordinates of the selected rectangle area indicating the ROI.

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

`Selected ROI` Users can click and drag on the image to define the area to crop. The rectangle is visually represented on the image as it is being dragged.

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

`Interactive Selection` The block allows interactive selection of a rectangular area directly on the displayed image, providing immediate visual feedback.

`Visual Feedback` The selected area is outlined with a green rectangle as the user selects it, aiding in selection accuracy.

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

1. **Connect Input**: Link a valid image data source to the `Image Any` input.
2. **Select ROI**: Click and drag on the displayed image to define the cropping rectangle. The rectangle will be drawn dynamically as you drag your mouse.
3. **Evaluate the Block**: After making a selection, run the block to extract the ROI. The cropped image and coordinates will be output.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

Upon evaluation, the block outputs both the cropped image corresponding to the selected ROI and the coordinates that define the selected area.

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

<details>

<summary>Using with Other Blocks</summary>

To improve image quality before selection, consider using the `Image Threshold`, `Blur`, or `Super Resolution` function blocks on the input image.

</details>

<details>

<summary>Ensuring Accurate Selection</summary>

Zoom in on the image (if possible) before selecting the ROI to help ensure the rectangle aligns precisely with the area you want to crop.

</details>

<details>

<summary>Handling Borders</summary>

If cropping very close to the edges of the image, ensure your selected rectangle doesn’t exceed image boundaries to avoid errors.

</details>

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

<details>

<summary>No Output Image</summary>

If the output image is not showing, check that the input image is connected properly and that you've made a selection on the displayed image.

</details>

<details>

<summary>Error on No Selection</summary>

If you attempt to run the block without selecting an ROI, ensure you drag the mouse to create a rectangle before evaluating.

</details>
