# Input masks and ROI

The inclusion and exclusion areas add a mask over the image that is 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 results that are within the designated polygon will be returned in the results.

{% columns %}
{% column %}
![Inclusion area showing a polygon mask drawn over the camera image](/files/cHTGKfQNdj9vz1gwklRC)
{% endcolumn %}

{% column %}
![Inclusion results showing only detections inside the polygon area](/files/xWqNWcD2GiiFnGjx0TBP)
{% endcolumn %}
{% endcolumns %}

In practice the results will overlap the borders of the polygon a little bit because the middle of the bottom of the detection box is taken as the anchor location for the detected object.

{% 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 same works for the exclusion area - here only objects that have the anchor location outside of the area will be returned.

{% columns %}
{% column %}
![Exclusion area showing a polygon mask drawn over the camera image](/files/R1e9Fq65HTdFWEdOFUQK)
{% endcolumn %}

{% column %}
![Exclusion results showing only detections outside the polygon area](/files/DBQtpHW5NIdfnuwrWNPB)
{% endcolumn %}
{% endcolumns %}

### Region of Interest (ROI)

The region of interest defines a square region of the image that will be sent to the AI Manager - the parts outside of the region will not be seen by the model.

{% columns %}
{% column %}
![ROI area showing a rectangle selection on the camera image](/files/lPCuX1eKG404CDcbHEPg)
{% endcolumn %}

{% column %}
![ROI results showing only the region inside the rectangle processed by the model](/files/loJvj5vn1G8FcLv85SWB)
{% endcolumn %}
{% endcolumns %}

This also means that the image can not be another shape than a rectangle, and you may need to change the model resizing method to letterbox for the models to work correctly.

![Model resizing method setting in the plugin configuration](/files/SVayAN5LHtthN5zhVcPZ)

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

### Custom external processing

If this behavior is not the desired behavior, is possible to create your own preprocessor to create a mask or postprocessor to exclude results from an area that you designate.

For more information on custom preprocessors and postprocessors you can checkout the examples in our GitHub repository

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


---

# 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://nx.docs.scailable.net/nx-ai-manager-v6.1.2/nx-ai-manager-plugin/configure-the-plugin/input-masks-and-roi.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.
