Skip to content

Commit fd946a2

Browse files
Merge pull request #1064 from luxonis/develop
DepthAI SDK 1.12.0
2 parents 8ac0dbc + 7479b25 commit fd946a2

33 files changed

+603
-136
lines changed

depthai_sdk/docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Luxonis'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.11.0'
25+
release = '1.12.0'
2626

2727

2828
# -- General configuration ---------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from depthai_sdk import OakCamera
2+
3+
with OakCamera() as oak:
4+
color = oak.create_camera('color')
5+
face_det = oak.create_nn('face-detection-retail-0004', color)
6+
# Control the camera's exposure/focus based on the (largest) detected face
7+
color.control_with_nn(face_det, auto_focus=True, auto_exposure=True, debug=False)
8+
9+
oak.visualize(face_det, fps=True)
10+
oak.start(blocking=True)

depthai_sdk/examples/StereoComponent/stereo_encoded.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
stereo = oak.create_stereo('800p', fps=30, encode='h264')
77

88
# Set on-device output colorization, works only for encoded output
9-
stereo.set_colormap(dai.Colormap.STEREO_JET)
9+
stereo.set_colormap(dai.Colormap.JET)
1010

1111
oak.visualize(stereo.out.encoded, fps=True)
1212
oak.start(blocking=True)

depthai_sdk/examples/trigger_action/custom_trigger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def my_condition(packet) -> bool:
2727
with OakCamera() as oak:
2828
color = oak.create_camera('color', fps=30)
2929
stereo = oak.create_stereo('800p')
30-
stereo.config_stereo(align='color')
30+
stereo.config_stereo(align=color)
3131

3232
trigger = Trigger(input=stereo.out.depth, condition=my_condition, cooldown=30)
3333
action = RecordAction(

depthai_sdk/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ opencv-contrib-python>4
44
blobconverter>=1.4.1
55
pytube>=12.1.0
66
--extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/
7-
depthai==2.21.2
7+
depthai==2.22.0
88
PyTurboJPEG==1.6.4
99
marshmallow==3.17.0
1010
xmltodict

depthai_sdk/sdk_tests/components/nn/test_nn_component.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,15 @@ def callback(packet):
9191
if not oak_camera.poll():
9292
raise RuntimeError('Polling failed')
9393
time.sleep(0.1)
94+
95+
96+
def test_encoded_output():
97+
with OakCamera() as oak_camera:
98+
camera = oak_camera.create_camera('color', '1080p', encode='h264')
99+
100+
oak_camera.callback(camera.out.encoded, lambda x: print(x))
101+
oak_camera.start(blocking=False)
102+
103+
for i in range(10):
104+
oak_camera.poll()
105+
time.sleep(0.1)

depthai_sdk/sdk_tests/components/stereo/test_stereo_component.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import time
22

3+
import depthai as dai
34
import pytest
5+
46
from depthai_sdk.oak_camera import OakCamera
5-
import depthai as dai
67

78

89
def test_stereo_output():
910
with OakCamera() as oak_camera:
1011
if dai.CameraBoardSocket.LEFT not in oak_camera.sensors:
1112
pytest.skip('Looks like camera does not have mono pair, skipping...')
1213
else:
13-
stereo = oak_camera.create_stereo('400p')
14+
stereo = oak_camera.create_stereo('800p', encode='h264')
1415

1516
oak_camera.callback([stereo.out.depth, stereo.out.disparity,
16-
stereo.out.rectified_left, stereo.out.rectified_right], callback=lambda x: None)
17+
stereo.out.rectified_left, stereo.out.rectified_right,
18+
stereo.out.encoded], callback=lambda x: None)
1719
oak_camera.start(blocking=False)
1820

1921
for i in range(10):
Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
1+
import os
12
import subprocess
23
import sys
34
import time
45
from pathlib import Path
56

67
import cv2
8+
import pytest
79

8-
EXAMPLES_DIR = Path(__file__).parent.parent.parent / "examples"
10+
EXAMPLES_DIR = Path(__file__).parents[1] / 'examples'
911

12+
# Create a temporary directory for the tests
13+
Path('/tmp/depthai_sdk_tests').mkdir(exist_ok=True)
14+
os.chdir('/tmp/depthai_sdk_tests')
1015

11-
def test_examples():
12-
python_executable = Path(sys.executable)
13-
for example in EXAMPLES_DIR.rglob("**/*.py"):
14-
print(f"Running example: {example.name}")
15-
16-
result = subprocess.Popen(f"{python_executable} {example}", stdout=subprocess.PIPE, stderr=subprocess.PIPE,
17-
env={"DISPLAY": ""}, shell=True)
18-
19-
time.sleep(5)
20-
result.kill()
21-
time.sleep(5)
22-
print('Stderr: ', result.stderr.read().decode())
2316

24-
# if result.returncode and result.returncode != 0:
25-
# assert False, f"{example} raised an exception: {result.stderr}"
26-
27-
cv2.destroyAllWindows()
17+
@pytest.mark.parametrize('example', list(EXAMPLES_DIR.rglob("**/*.py")))
18+
def test_examples(example):
19+
print(f"Running {example}")
20+
python_executable = Path(sys.executable)
21+
result = subprocess.Popen(f"{python_executable} {example}",
22+
stdout=subprocess.PIPE,
23+
stderr=subprocess.PIPE,
24+
env={
25+
'DISPLAY': '',
26+
'PYTHONPATH': f'{os.environ["PYTHONPATH"]}:{EXAMPLES_DIR.parent}'
27+
},
28+
shell=True)
29+
30+
time.sleep(5)
31+
result.kill()
32+
time.sleep(5)
33+
print('Stderr: ', result.stderr.read().decode())
34+
35+
if result.returncode and result.returncode != 0:
36+
assert False, f"{example} raised an exception: {result.stderr}"
37+
38+
cv2.destroyAllWindows()

depthai_sdk/setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name='depthai-sdk',
12-
version='1.11.0',
12+
version='1.12.0',
1313
description='This package provides an abstraction of the DepthAI API library.',
1414
long_description=io.open("README.md", encoding="utf-8").read(),
1515
long_description_content_type="text/markdown",
@@ -30,7 +30,8 @@
3030
"replay": ['mcap>=0.0.10',
3131
'mcap-ros1-support==0.0.8',
3232
'rosbags==0.9.11'],
33-
"record": ['av']
33+
"record": ['av'],
34+
"test": ['pytest']
3435
},
3536
project_urls={
3637
"Bug Tracker": "https://github.com/luxonis/depthai/issues",

depthai_sdk/src/depthai_sdk/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from depthai_sdk.args_parser import ArgsParser
22
from depthai_sdk.classes.enum import ResizeMode
3+
from depthai_sdk.constants import CV2_HAS_GUI_SUPPORT
34
from depthai_sdk.logger import set_logging_level
45
from depthai_sdk.oak_camera import OakCamera
56
from depthai_sdk.oak_device import OakDevice
@@ -10,7 +11,7 @@
1011
from depthai_sdk.utils import _create_config, get_config_field
1112
from depthai_sdk.visualize import *
1213

13-
__version__ = '1.11.0'
14+
__version__ = '1.12.0'
1415

1516

1617
def __import_sentry(sentry_dsn: str) -> None:

0 commit comments

Comments
 (0)