> For the complete documentation index, see [llms.txt](https://nx.docs.scailable.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nx.docs.scailable.net/ai-manager-v6.1.4/ai-manager-plugin/configure-the-plugin/input-masks-and-roi.md).

# Input masks and ROI

Inclusion and exclusion areas add a mask over the image sent to the AI Manager. The Region of Interest (ROI) removes all information outside the designated region and sends only the information inside the rectangle to the AI Manager.

## Inclusion Area Mask

For the inclusion area, only results within the designated polygon are returned.

<figure><img src="/files/cHTGKfQNdj9vz1gwklRC" alt="Inclusion area showing a polygon mask drawn over the camera image"><figcaption><p>Inclusion area: a polygon mask limits results to inside the shape</p></figcaption></figure>

<figure><img src="/files/xWqNWcD2GiiFnGjx0TBP" alt="Inclusion results showing only detections inside the polygon area"><figcaption><p>Inclusion results: only detections inside the polygon are returned</p></figcaption></figure>

In practice, results overlap the polygon borders slightly because the anchor location for a detected object is the middle of the bottom of the detection box.

{% hint style="info" %}
The center of the bottom of the bounding box is chosen for the anchor location because that is usually a good indication for where a person or object is standing on the ground. In a line-crossing scenario for example, this would make it easier to detect if a person crosses a certain line.
{% endhint %}

## Exclusion Area Mask

The exclusion area works the same way: only objects with the anchor location outside the area are returned.

<figure><img src="/files/R1e9Fq65HTdFWEdOFUQK" alt="Exclusion area showing a polygon mask drawn over the camera image"><figcaption><p>Exclusion area: a polygon mask limits results to outside the shape</p></figcaption></figure>

<figure><img src="/files/DBQtpHW5NIdfnuwrWNPB" alt="Exclusion results showing only detections outside the polygon area"><figcaption><p>Exclusion results: only detections outside the polygon are returned</p></figcaption></figure>

## Region of Interest (ROI)

The region of interest defines a square region of the image sent to the AI Manager; the model does not see the parts outside the region.

<figure><img src="/files/lPCuX1eKG404CDcbHEPg" alt="ROI area showing a rectangle selection on the camera image"><figcaption><p>ROI area: a rectangle defines the region sent to the AI Manager</p></figcaption></figure>

<figure><img src="/files/loJvj5vn1G8FcLv85SWB" alt="ROI results showing only the region inside the rectangle processed by the model"><figcaption><p>ROI results: only the region inside the rectangle is processed</p></figcaption></figure>

This also means the image must be a rectangle; set the model resizing method to letterbox for the models to work correctly.

<figure><img src="/files/SVayAN5LHtthN5zhVcPZ" alt="Model resizing method setting in the plugin configuration"><figcaption><p>Set the model resizing method to letterbox when using ROI</p></figcaption></figure>

{% hint style="warning" %}
Using masks and region of interest at the same time is not supported.
{% endhint %}

## Custom External Processing

To customize this behavior, create a preprocessor to build a mask, or a postprocessor to exclude results from a designated area.

For examples of custom preprocessors and postprocessors, see the sclbl-integration-sdk repository:

{% embed url="<https://github.com/scailable/sclbl-integration-sdk>" %}
Sclbl Integration SDK
{% endembed %}
