aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/gaze_analysis_pipeline/aoi_2d_description.md
blob: 6cca7ceac73d3305eca39ab7e4b198009c5e545c (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Describe 2D AOI
================

Once [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) is [configured](configuration_and_execution.md), areas of interest need to be described to know what is looked in frame.

![2D AOI description](../../img/aoi_2d_description.png)

According common computer graphics coordinates convention, all AOI need to be described from a top left frame corner origin with a coordinate system where:

* +X is pointing to the right,
* +Y is pointing to the downward.

!!! warning
	All AOI spatial values must be given in **pixels**.

### Edit SVG file description

SVG file format could be exported from most vector graphics editors.

``` xml
<svg>
    <path id="Triangle" d="M1288.1,189.466L1991.24,3399.34L584.958,3399.34L1288.1,189.466Z"/>
    <rect id="BlueRectangle" x="1257" y="1905.18" width="604.169" height="988.564"/>
    <rect id="RedSquare" x="623.609" y="658.357" width="803.15" height="803.577"/>
    <circle id="GreenCircle" cx="675.77" cy="2163.5" r="393.109"/>
    <circle id="PinkCircle" cx="1902.02" cy="879.316" r="195.313"/>
</svg>
```

Here are common SVG file features needed to describe AOI:  

* *id* attribute indicates AOI name.
* *path* element describes any polygon using only [M, L and Z path intructions](https://www.w3.org/TR/SVG2/paths.html#PathData)
* *rect* and *circle* allow respectively to describe rectangular and circle AOI.

### Edit JSON file description

JSON file format allows to describe AOI.

``` json
{
    "Triangle" : [[1288.1, 189.466], [1991.24, 3399.34], [584.958, 3399.34]],
    "BlueRectangle": {
        "Rectangle": {
            "x": 1257,
            "y": 1905.18,
            "width": 604.169,
            "height": 988.564
        }
    },
    "RedSquare": {
        "Rectangle": {
            "x": 623.609,
            "y": 658.357,
            "width": 803.15,
            "height": 803.15
        }
    },
    "GreenCircle": {
        "Circle": {
            "cx": 675.77,
            "cy": 2163.5,
            "radius": 393.109
        }
    },
    "PinkCircle": {
        "Circle": {
            "cx": 1902.02,
            "cy": 879.316,
            "radius": 195.313
        }   
    }
}
```