aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/areas_of_interest/aoi_matching.md
blob: 3bffeb9089e4a9be07940c259e89d3e3d3289753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: AOI matching
---

AOI matching
============

Once AOI3D scene is projected into a frame as AOI2D scene, it could be needed to know which AOI2D is looked. 
The AOI class in [AOIFeatures](/argaze/#argaze.AreaOfInterest.AOIFeatures) provides two ways to accomplish such task.

## Pointer-based matching

Test if 2D pointer is inside or not AOI using contains_point() method as illustrated below.

![Contains point](../../img/contains_point.png)

``` python
pointer = (x, y)

for name, aoi in aoi2D_scene.items():
                    
       if aoi.contains_point(pointer):

              # Do something with looked aoi
              ...

```

It is also possible to get where a pointer is looking inside an AOI provided that AOI is a rectangular plane:

``` python

inner_x, inner_y = aoi.inner_axis(pointer)

```

## Circle-based matching

As positions have limited accuracy, it is possible to define a radius around a pointer to test circle intersection with AOI.

![Circle intersection](../../img/circle_intersection.png)

``` python

intersection_shape, intersection_aoi_ratio, intersection_circle_ratio = aoi.circle_intersection(pointer, radius)

```