aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/aruco_markers_pipeline/aruco_scene.md
blob: b47fefb1468f70853fffc8e825910a6736a45e86 (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
Add an ArUcoScene
=================

An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) class defines a space where [areas of interest description](aoi_description.md) is mapped onto [ArUco markers description](aruco_markers_description.md).

![ArUco scene](../../img/aruco_scene.png)

## Add ArUcoScene to ArUcoCamera JSON configuration file

An [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) instance can contains multiples [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene).

Here is an extract from the JSON [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) configuration file with a sample where one scene is added:

```json
{
	"name": "My FullHD camera",
	"size": [1920, 1080],
	...
    "scenes": {
        "MyScene" : {
            "aruco_markers_group": {
                "dictionary": "DICT_APRILTAG_16h5",
                "marker_size": 5,
                "places": {
                    "0": {
                        "translation": [2.5, 2.5, 0],
                        "rotation": [0, 0, 0]
                    },
                    "1": {
                        "translation": [0, 25.5, 2],
                        "rotation": [0, 45, 0]
                    },
                    "2": {
                        "translation": [35.5, 0, 3],
                        "rotation": [-45, 0, 0]
                    }
                }
            } 
        }
    }
    ...
}
```

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

### "MyScene"

The name of the [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene). Basically useful for visualisation purpose.

### ArUco markers group

The 3D places of ArUco markers into the scene as defined at [ArUco markers description chapter](aruco_markers_description.md). Thanks to this description, it is possible to estimate the pose of [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) in [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera) frame.

!!! note

    [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) pose estimation is done when calling the [ArUcoCamera.watch](../../argaze.md/#argaze.ArFeatures.ArCamera.watch) method.

## Add ArLayer to ArUcoScene to load AOI

The [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) class allows to load areas of interest description.

An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarkers.ArUcoScene) instance can contains multiples [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer).

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

```json
{
    "name": "My FullHD camera",
    "size": [1920, 1080],
    ...
    "scenes": {
        "MyScene" : {
            "aruco_markers_group": {
                ...
            },
            "layers": {
                "MyLayer": {
                    "aoi_scene": {
                        "YellowSquare": [[6.2, -7.275252, 25.246159], [31.2, -7.275252, 25.246159], [6.2, 1.275252, 1.753843], [31.2, 1.275252, 1.753843]],
                        "GrayRectangle": [[2.5, 2.5, -0.5], [37.5, 2.5, -0.5], [2.5, 27.5, -0.5], [37.5, 27.5, -0.5]],
                        "BlueTriangle": [[12.5, 7.5, -0.5], [27.5, 7.5, -0.5], [20, 22.5, -0.5]]
                    }
                }
            } 
        }
    }
    ...
}
```

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

### "MyLayer"

The name of the [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer). Basically useful for visualisation purpose.

### AOI Scene

The [AOIScene](../../argaze.md/#argaze.AreaOfInterest.AOIFeatures.AOIScene) defines a set of 3D [AreaOfInterest](../../argaze.md/#argaze.AreaOfInterest.AOIFeatures.AreaOfInterest) registered by name.

## Add ArLayer to ArUcoCamera to project AOI

Here is the previous extract where one layer is added to the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarkers.ArUcoCamera):

```json
{
    "name": "My FullHD camera",
    "size": [1920, 1080],
    ...
    "scenes": {
        "MyScene" : {
            "aruco_markers_group": {
                ...
            },
            "layers": {
                 "MyLayer": {
                    "aoi_scene": {
                        ...
                    }
                } 
            } 
        }
    },
    "layers": {
        "MyLayer": {}
    }
    ...
}
```

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

### "MyLayer"

The name of the [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer). Basically useful for visualisation purpose.

!!! warning

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

!!! note

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