aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/aruco_marker_pipeline/pose_estimation.md
blob: 02a49793bccece029d733c2939b2e53af35d000f (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
Estimate scene pose
===================

Once [ArUco markers are placed into a scene](aruco_marker_description.md) and the [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) is [configured](configuration_and_execution.md), the scene pose can be estimated.

![Scene pose estimation](../../img/aruco_camera_pose_estimation.png)

## Add ArUcoScene to ArUcoCamera JSON configuration file

An [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) class defines a space with [ArUco markers inside](aruco_marker_description.md), helping to estimate scene pose when they are watched by [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera).

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

```json
{
    "argaze.ArUcoMarker.ArUcoCamera.ArUcoCamera": {
    	"name": "My FullHD camera",
    	"size": [1920, 1080],
    	...
        "scenes": {
            "MyScene" : {
                "aruco_markers_group": {
                    "dictionary": "DICT_APRILTAG_16h5",
                    "places": {
                        "0": {
                            "translation": [17.5, 2.75, -0.5],
                            "rotation": [-18.5, 0, 0],
                            "size": 5
                        },
                        "1": {
                            "translation": [46, 34, 18.333],
                            "rotation": [0, 70, 0],
                            "size": 5
                        },
                        "2": {
                            "translation": [41, 4, 3.333],
                            "rotation": [-60, 0, 0],
                            "size": 5
                        }
                    }
                } 
            }
        },
        ...
        "image_parameters": {
            ...
            "draw_scenes": {
                "MyScene": {
                    "draw_aruco_markers_group": {
                        "draw_axes": {
                            "thickness": 3,
                            "length": 10
                        },
                        "draw_places": {
                            "color": [0, 0, 0],
                            "border_size": 1
                        }
                    }
                }
            }
        }
    }
}
```

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

### *scenes*

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

### MyScene

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

### *aruco_markers_group*

The 3D placement of ArUco markers into the scene, as defined in the [ArUco marker description chapter](aruco_marker_description.md). Thanks to this description, it is possible to estimate the pose of [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) in an [ArUcoCamera](../../argaze.md/#argaze.ArUcoMarker.ArUcoCamera) frame.

!!! note

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

### *draw_scenes*

The drawing parameters of each loaded [ArUcoScene](../../argaze.md/#argaze.ArUcoMarker.ArUcoScene) in an [ArUcoCamera.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image).