aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/gaze_analysis_pipeline/background.md
blob: 420dbdf3ca4ee8137030cfa69d882ad6bb1c103d (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
Add Background
==============

Background is an optional [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) attribute to display any image.

![Background](../../img/ar_frame_background.png)

## Load and display ArFrame background

[ArFrame.background](../../argaze.md/#argaze.ArFeatures.ArFrame.background) can be enabled thanks to a dedicated JSON entry.

Here is the JSON ArFrame configuration file example where a background picture is loaded and displayed:

```json
{
    "name": "My FullHD screen",
    "size": [1920, 1080],
    ...
    "background": "./joconde.png",
    ...
    "image_parameters": {
        ...
        "background_weight": 1
    }
}
```

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

### Background

The path to an image file on disk.

### Background weight

The weight of background overlay in [ArFrame.image](../../argaze.md/#argaze.ArFeatures.ArFrame.image) between 0 and 1.

## Edit ArFrame background

It is also possible to set background image and display it from script:

```python
import numpy

# Assuming an ArFrame is loaded
...

# Set ArFrame background as gray
ar_frame.background = numpy.full((ar_frame.size[1], ar_frame.size[0], 3), 127).astype(numpy.uint8)

# Get ArFrame image with background and any other options
ar_frame_image = ar_frame.image(background_weight = 1, ...)

# Do something with ArFrame image
...
```