<a id="working-with-a-region"></a>

# Working with a Region

In some cases, most often to decrease the processing time or to single-out the object you want to analyze, you do not want to process the whole image but only a part of it.

You can define and use regions of interest (ROI) to restrict the area processed with your vision tool.

* In **eVision:**
  * An **ROI** [`EBaseROI`](../../doxygen_cpp/classeVision_1_1EBaseROI.html) [<sub>.NET</sub>](../../doxygen_cs/classeVision_1_1EBaseROI.html) [<sub>Python</sub>](../../doxygen_python/classeVision_1_1EBaseROI.html) class designates a rectangular region of interest.
  * A **region** [`ERegion`](../../doxygen_cpp/classeVision_1_1ERegion.html) [<sub>.NET</sub>](../../doxygen_cs/classeVision_1_1ERegion.html) [<sub>Python</sub>](../../doxygen_python/classeVision_1_1ERegion.html) class designates an arbitrarily shaped ROI. With regions, you can determine precisely which part of the image, down to a single pixel, is used for your processing.

#### SEE ALSO
For more details on ERegions, see [**Arbitrarily Shaped ROI (ERegion)**](../../using/basic_operations/regions/arbitrarily_shaped_roi__eregion_.html.md).

#### HINT
An ERegion is an arbitrary shape. If you want to use a simple rectangular ROI attached to an image, consider [**Step 3: Managing an ROI:**](running_tools_on_images/index.html.md#managing-an-roi).

<a id="process"></a>

## Process

<a id="draw-the-eregion"></a>

### 1. Draw the ERegion

Though it is not required, it is often easier to draw the ERegion based on an actual image:

* Add an image tool.
* Open an image representative of your setup.

#### SEE ALSO
See [**Step 1: Creating a Graph:**](running_tools_on_images/index.html.md#creating-a-graph).

<a id="region-editor"></a>

### 2. Add a `Region Editor` Tool:

![image](assets/images/easy_studio2_common/working_with_a_region_1.webp)
* The `Region editor` tool is added to the graph.

<a id="connect"></a>

### 3. Connect the Source Image:

* This is only required if you are using an image as input to help drawing the region.
* Connect the `Image file` tool to the `Region editor` tool and select a `Link type` for this connection.

<a id="draw-your-region"></a>

### 4. Draw your Region:

![](assets/images/easy_studio2_common/working_with_a_region_2.webp)
* Use add `Primitives` buttons and, using your mouse, move and adjust the shapes.

* SHIFT + click to select 2 shapes in the list.
* Click on a button (merge, intersection or substract) to combine them.

* Select it in the list, set the Radius and click on the `Grow region` or `Shrink region` button.

* Either in the same project or a different one.
* `Save` it first.
* Then `Load` it.

#### HINT
Don’t forget to link the tool by connecting your `Region editor` output `region` port to the input `region` port of another tool.
