Skip to content

Commit 829ccd2

Browse files
committed
test rotation
1 parent 2a2b77e commit 829ccd2

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

.github/workflows/build-run-applications.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ jobs:
199199
run: |
200200
pip install --prefer-binary cryptography pytest-embedded pytest-embedded-serial-esp pytest-embedded-idf pytest-custom_exit_code opencv-python numpy
201201
apt-get update && apt-get install -y libgl1
202+
apt-get update && apt-get install -y v4l-utils
202203
- name: Download latest results
203204
uses: actions/download-artifact@v4
204205
with:

conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33
import pytest
44
import cv2
5+
import subprocess
56
from pathlib import Path
67

78

@@ -43,6 +44,12 @@ def pytest_collection_modifyitems(config, items):
4344

4445

4546
def bsp_capture_image(image_path, board):
47+
# Enable auto-focus
48+
subprocess.run(["v4l2-ctl", "-d", "/dev/video0", "--set-ctrl=focus_auto=1"])
49+
# Manual exposition
50+
subprocess.run(["v4l2-ctl", "-d", "/dev/video0", "--set-ctrl=exposure_auto=1"])
51+
subprocess.run(["v4l2-ctl", "-d", "/dev/video0", "--set-ctrl=exposure_absolute=100"])
52+
4653
# Return video from the first webcam on your computer.
4754
cap = cv2.VideoCapture(0)
4855
# Set FullHD resolution (1920x1080)
@@ -55,6 +62,8 @@ def bsp_capture_image(image_path, board):
5562
# ret checks return at each frame
5663
ret, frame = cap.read()
5764
if ret:
65+
# Image rotation
66+
frame = cv2.rotate(frame, cv2.ROTATE_180)
5867
# TODO: Camera calibration / Perspective transform
5968
# TODO: Change size image
6069
# TODO: Crop image for {board}

examples/pytest_helpers.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)