aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/aruco_marker_pipeline/aoi_3d_projection.md
blob: 90fdb38966cc272df4b1ff11f628fc1237dd8569 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Project 3D AOI in the camera frame
================================

Once the [ArUcoScene pose is estimated](pose_estimation.md) and [3D AOI are described](aoi_3d_description.md), they can be projected in the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame.

![3D AOI projection](../../img/aruco_camera_aoi_projection.png)

## Add ArLayer to ArUcoScene to load 3D AOI

The [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) class allows you to load 3D AOI descriptions. 

Here is the previous extract, where one layer is added to [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) configuration:

```json
{
    "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": {
        "name": "My FullHD camera",
        "size": [1920, 1080],
        ...
        "scenes": {
            "MyScene" : {
                "aruco_markers_group": {
                    ...
                },
                "layers": {
                    "MyLayer": {
                        "aoi_scene": {
                            "Left_Screen": [[0, 0, 0], [15, 0, 0], [0, 18.963333, -6.355470], [15, 18.963333, -6.355470]],
                            "Right_Screen": [[20, 0, 0], [35, 0, 0], [20, 18.963337, -6.355472], [35, 18.963337, -6.355472]],
                            "Control_Panel": [[49.5, 30, 18.333333], [55.5, 30, 18.333333], [49.5, 38, 18.333333], [55.5, 38, 18.333333]],
                            "Window": [[-57.8, 5.5, -33.5], [46, 15.5, -35], [1.5, 53, -1], [50.2, 61, 6], [-35.85, 35, -15]]
                        }
                    }
                } 
            }
        }
        ...
    }
}
```

Now, let's understand the meaning of each JSON entry.

### *layers*

An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) instance can contain multiples [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) stored by name.

### MyLayer

The name of an [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer). Basically, it is useful for visualization purposes.

### *aoi_scene*

The set of 3D AOI into the layer, as defined in the [3D AOI description chapter](aoi_3d_description.md).

## Add ArLayer to ArUcoCamera to project 3D AOI into

Here is the previous extract, where one layer is added to the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) configuration and displayed:

```json
{
    "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": {
        "name": "My FullHD camera",
        "size": [1920, 1080],
        ...
        "scenes": {
            "MyScene" : {
                "aruco_markers_group": {
                    ...
                },
                "layers": {
                     "MyLayer": {
                        "aoi_scene": {
                            ...
                        }
                    } 
                } 
            }
        },
        "layers": {
            "MyLayer": {}
        }
        ...
        "image_parameters": {
            ...
            "draw_layers": {
                "MyLayer": {
                    "draw_aoi_scene": {
                        "draw_aoi": {
                            "color": [255, 255, 255],
                            "border_size": 1
                        }
                    }
                }
            }
        }
    }
}
```

Now, let's understand the meaning of each JSON entry.

### *layers*

An [ArUcoCamera](../../argaze.md/#argaze.ArFeatures.ArFrame) instance can contain multiples [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) stored by name.

### MyLayer

The name of an [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer). Basically, it is useful for visualization purposes.

!!! warning "Layer name policy"

    An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layer is projected into an [ ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer, **provided they have the same name**.

!!! note

    [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) layers are projected into their dedicated [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layers when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method.

## Add AOI analysis features to ArUcoCamera layer

When a scene layer is projected into a camera layer, it means that the 3D scene's AOI are transformed into the 2D camera's AOI.

Therefore, it means that [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) benefits from all the services described in the [AOI analysis pipeline section](../gaze_analysis_pipeline/aoi_analysis.md).

Here is the previous extract, where AOI matcher, AOI scan path and AOI scan path analyzers were added to the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer:

```json
{
    "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": {
        "name": "My FullHD camera",
        "size": [1920, 1080],
        ...
        "scenes": {
            "MyScene" : {
                "aruco_markers_group": {
                    ...
                },
                "layers": {
                     "MyLayer": {
                        "aoi_scene": {
                            ...
                        }
                    } 
                } 
            }
        },
        "layers": {
            "MyLayer": {
                "aoi_matcher": {
                    "argaze.GazeAnalysis.DeviationCircleCoverage.AOIMatcher": {
                        "coverage_threshold": 0.5
                    }
                },
                "aoi_scan_path": {
                    "duration_max": 30000
                },
                "aoi_scan_path_analyzers": {
                    "argaze.GazeAnalysis.Basic.AOIScanPathAnalyzer": {},
                    "argaze.GazeAnalysis.TransitionMatrix.AOIScanPathAnalyzer": {},
                    "argaze.GazeAnalysis.NGram.AOIScanPathAnalyzer": {
                        "n_min": 3,
                        "n_max": 5
                    }
                }
            }
        }
        ...
    }
}
```

!!! warning

    Adding scan path and scan path analyzers to an [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) layer doesn't make sense, as the space viewed through the camera frame doesn't have to reflect the space the gaze is covering.