|
1 |
| -============== |
| 1 | +=============================== |
2 | 2 | Display capture Twister harness
|
3 |
| -============== |
4 |
| - |
| 3 | +=============================== |
5 | 4 |
|
6 | 5 | Configuration example
|
7 | 6 | ---------------------
|
@@ -38,87 +37,133 @@ Configuration example
|
38 | 37 | edge_ratio_weight: 0.1
|
39 | 38 | gradient_hist_weight: 0.1
|
40 | 39 |
|
| 40 | +Installation Guide |
| 41 | +------------------ |
| 42 | + |
| 43 | +.. code-block:: powershell |
| 44 | +
|
| 45 | + # Create virtual environment |
| 46 | + python -m venv .venv |
| 47 | +
|
| 48 | +.. code-block:: powershell |
| 49 | +
|
| 50 | + # Activate environment |
| 51 | + .venv\Scripts\activate |
| 52 | +
|
| 53 | +.. code-block:: powershell |
| 54 | +
|
| 55 | + # Install dependencies |
| 56 | + uv pip install -r requirements.txt |
| 57 | +
|
| 58 | +.. code-block:: bash |
| 59 | +
|
| 60 | + # add video to user group |
| 61 | + sudo usermod -a -G video $USER |
| 62 | +
|
| 63 | +.. code-block:: bash |
| 64 | +
|
| 65 | + # need log out and login to effective or run |
| 66 | + newgrp video |
| 67 | +
|
| 68 | +If you are in Ubuntu 24.04 with XWayland do the following: |
| 69 | + |
| 70 | +.. code-block:: bash |
| 71 | +
|
| 72 | + export DISPLAY=:0 |
| 73 | + cp /run/user/1000/.mutter-Xwaylandauth.AIT2A3 ~/.Xauthority |
| 74 | +
|
| 75 | +or |
| 76 | + |
| 77 | +.. code-block:: bash |
| 78 | +
|
| 79 | + export QT_QPA_PLATFORM=xcb |
| 80 | +
|
| 81 | +If your server does not have display please do the following: |
| 82 | + |
| 83 | +.. code-block:: bash |
| 84 | +
|
| 85 | + pip uninstall opencv-python |
| 86 | +
|
| 87 | +.. code-block:: bash |
| 88 | +
|
| 89 | + pip install opencv-python-headless |
| 90 | +
|
| 91 | +.. code-block:: bash |
| 92 | +
|
| 93 | + export QT_QPA_PLATFORM=offscreen |
| 94 | +
|
41 | 95 | example zephyr display tests
|
42 | 96 | ----------------------------
|
43 | 97 |
|
44 | 98 | 1. Setup camera to capture display content
|
45 | 99 |
|
46 |
| - - UVC compatible camera with at least 2 megapixels (such as 1080p) |
47 |
| - - A light-blocking black curtain |
48 |
| - - A PC host where camera connect to |
49 |
| - - DUT connected to the same PC host for flashing and serial console |
| 100 | + - UVC compatible camera with at least 2 megapixels (such as 1080p) |
| 101 | + - A light-blocking black curtain |
| 102 | + - A PC host where camera connect to |
| 103 | + - DUT connected to the same PC host for flashing and serial console |
50 | 104 |
|
51 | 105 | 2. Generate video fingerprints
|
52 | 106 |
|
53 |
| - - build and flash the known-to-work display app to DUT |
54 |
| - e.g. |
55 |
| -``` |
56 |
| -west build -b frdm_mcxn947/mcxn947/cpu0 tests/drivers/display/display_check |
57 |
| -west flash |
58 |
| -``` |
59 |
| - |
60 |
| - - clone code |
61 |
| -```bash |
62 |
| -git clone https://github.com/hakehuang/camera_shield |
63 |
| -``` |
64 |
| - |
65 |
| - |
66 |
| - - follow the instructions in the repo's README. |
67 |
| - - set the signature capture mode as below in config.yaml |
68 |
| -```yaml |
69 |
| - - name: signature |
70 |
| - module: .plugins.signature_plugin |
71 |
| - class: VideoSignaturePlugin |
72 |
| - status: "enable" |
73 |
| - config: |
74 |
| - operations: "generate" # operation ('generate', 'compare') |
75 |
| - metadata: |
76 |
| - name: "tests.drivers.display.check.shield" # finger-print stored metadata |
77 |
| - platform: "frdm_mcxn947" |
78 |
| - directory: "./fingerprints" # fingerprints directory to compare with not used in generate mode |
79 |
| -``` |
80 |
| - |
81 |
| - - Run generate fingerprints program outside the camera_shield folder |
82 |
| - |
83 |
| - Note: |
84 |
| - On Ubuntu 24.04, you may need to do ```export QT_QPA_PLATFORM=xcb``` to resolve below error |
85 |
| - |
86 |
| -```bash |
87 |
| -qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "~/camera_shield/.ven/lib/python3.12/site-packages/cv2/qt/plugins" |
88 |
| -``` |
89 |
| - |
90 |
| -```bash |
91 |
| -python -m camera_shield.main --config camera_shield/config.yaml |
92 |
| -``` |
93 |
| - |
94 |
| -video fingerprint for captured screenshots will be recorded in directory './fingerprints' by default |
| 107 | + - build and flash the known-to-work display app to DUT e.g. |
95 | 108 |
|
96 |
| - - set environment variable to "DISPLAY_TEST_DIR" |
| 109 | + :: |
97 | 110 |
|
98 |
| -```bash |
99 |
| -DISPLAY_TEST_DIR=~/camera_shield/ |
100 |
| -``` |
| 111 | + west build -b frdm_mcxn947/mcxn947/cpu0 tests/drivers/display/display_check |
| 112 | + west flash |
101 | 113 |
|
102 |
| -3. Run test |
103 |
| -```bash |
104 |
| -# export the fingerprints path |
105 |
| -export DISPLAY_TEST_DIR=<path to "fingerprints" parent-folder> |
| 114 | + - clone code |
| 115 | + |
| 116 | + :: |
| 117 | + |
| 118 | + git clone https://github.com/hakehuang/camera_shield |
| 119 | + |
| 120 | + - follow the instructions in the repo's README. |
| 121 | + |
| 122 | + - set the signature capture mode as below in config.yaml |
106 | 123 |
|
107 |
| -# Twister hardware map file settings: |
108 |
| -# Ensure your map file has the required fixture |
109 |
| -# in the example below, you need to have "fixture_display" |
| 124 | + :: |
110 | 125 |
|
111 |
| -# Ensure you have installed the required Python packages for tests in scripts/requirements-run-test.txt |
| 126 | + - name: signature |
| 127 | + module: .plugins.signature_plugin |
| 128 | + class: VideoSignaturePlugin |
| 129 | + status: "enable" |
| 130 | + config: |
| 131 | + operations: "generate" # operation ('generate', 'compare') |
| 132 | + metadata: |
| 133 | + name: "tests.drivers.display.check.shield" # finger-print stored metadata |
| 134 | + platform: "frdm_mcxn947" |
| 135 | + directory: "./fingerprints" # fingerprints directory to compare with not used in generate mode |
| 136 | + |
| 137 | + - Run generate fingerprints program outside the camera_shield folder |
| 138 | + |
| 139 | + :: |
| 140 | + |
| 141 | + python -m camera_shield.main --config camera_shield/config.yaml |
| 142 | + |
| 143 | + video fingerprint for captured screenshots will be recorded in directory './fingerprints' by default |
| 144 | + |
| 145 | + - set environment variable to "DISPLAY_TEST_DIR" |
| 146 | + |
| 147 | + :: |
| 148 | + |
| 149 | + DISPLAY_TEST_DIR=~/camera_shield/ |
| 150 | + |
| 151 | +3. Run test |
112 | 152 |
|
113 |
| -# Run detection program |
114 |
| -scripts/twister --device-testing --hardware-map map.yml -T tests/drivers/display/display_check/ |
| 153 | + :: |
115 | 154 |
|
116 |
| -``` |
| 155 | + # export the fingerprints path |
| 156 | + export DISPLAY_TEST_DIR=<path to "fingerprints" parent-folder> |
| 157 | + # Twister hardware map file settings: |
| 158 | + # Ensure your map file has the required fixture |
| 159 | + # in the example below, you need to have "fixture_display" |
| 160 | + # Ensure you have installed the required Python packages for tests in scripts/requirements-run-test.txt |
| 161 | + # Run detection program |
| 162 | + scripts/twister --device-testing --hardware-map map.yml -T tests/drivers/display/display_check/ |
117 | 163 |
|
118 | 164 | Notes
|
119 | 165 | -----
|
120 | 166 |
|
121 |
| -1. When generating the fingerprints, they will be stored in folder "name" as defined in "metadata" from ``config.yaml`` . |
| 167 | +1. When generating the fingerprints, they will be stored in folder "name" as defined in "metadata" from ``config.yaml``. |
122 | 168 | 2. The DUT testcase name shall match the value in the metadata 'name' field of the captured fingerprint's config.
|
123 |
| -3. You can put multiple fingerprints in one folder, it will increase compare time, |
124 |
| - but will help to check other defects. |
| 169 | +3. You can put multiple fingerprints in one folder, it will increase compare time, but will help to check other defects. |
0 commit comments