aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/ar_environment/environment_exploitation.md
blob: db40385d482a0b5ba2553325b1ae5cbf072da736 (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
Environment exploitation
========================

Once loaded, AR environment assets can be exploited as illustrated below:

```python
# Access to AR environment ArUco detector passing it a frame where to detect ArUco markers
ar_environment.aruco_detector.detect_markers(frame)

# Access to an AR environment scene
my_first_scene = ar_environment.scenes['my first AR scene']

try:

     # Try to estimate AR scene pose from detected markers
     tvec, rmat, consistent_markers = my_first_scene.estimate_pose(ar_environment.aruco_detector.detected_markers)

     # Project AR scene into camera frame according estimated pose
     # Optional visual_hfov argument is set to 160° to clip AOI scene according a cone vision
     aoi2D_scene = my_first_scene.project(tvec, rmat, visual_hfov=160)

     # Draw estimated AR scene axis
     my_first_scene.draw_axis(frame)

     # Draw AOI2D scene projection
     aoi2D_scene.draw(frame)

     # Do something with AOI2D scene projection
     ...

# Catch exceptions raised by estimate_pose and project methods
except (ArFeatures.PoseEstimationFailed, ArFeatures.SceneProjectionFailed) as e:

    print(e)

```