Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
SzabolcsGergely committed Sep 26, 2024
2 parents 31b0fab + 572492e commit c9a23c4
Show file tree
Hide file tree
Showing 25 changed files with 162 additions and 184 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ jobs:
- name: Setup cmake
if: matrix.os == 'macos-latest'
uses: jwlawson/[email protected]
with:
cmake-version: '3.29.x'
- name: Cache .hunter folder
if: matrix.os != 'windows-latest'
uses: actions/cache@v3
Expand Down Expand Up @@ -136,6 +138,10 @@ jobs:
matrix:
rpi-os: [rpi-buster, rpi-bullseye, rpi-bookworm]
runs-on: ${{ matrix.rpi-os }}
env:
# workaround required for cache@v3, https://github.com/actions/cache/issues/1428
# to be removed when upgrading the manylinux image
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Print home directory
run: echo Home directory inside container $HOME
Expand Down Expand Up @@ -182,7 +188,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
python-architecture: [x64, x86]
fail-fast: false
steps:
Expand Down Expand Up @@ -298,8 +304,12 @@ jobs:
build-linux-x86_64:
needs: build-docstrings
runs-on: ubuntu-latest
env:
# workaround required for cache@v3, https://github.com/actions/cache/issues/1428
# to be removed when upgrading the manylinux image
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: quay.io/pypa/manylinux2014_x86_64:2024-01-08-eb135ed
image: quay.io/pypa/manylinux2014_x86_64:latest
env:
PLAT: manylinux2014_x86_64
steps:
Expand Down Expand Up @@ -342,7 +352,7 @@ jobs:
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar
mv dist/* wheelhouse/audited/
- name: Build wheels
run: for PYBIN in /opt/python/cp3{6..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{7..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
- name: Audit wheels
run: for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
- name: Archive wheel artifacts
Expand All @@ -362,8 +372,12 @@ jobs:
build-linux-arm64:
needs: build-docstrings
runs-on: [self-hosted, linux, ARM64]
env:
# workaround required for cache@v3, https://github.com/actions/cache/issues/1428
# to be removed when upgrading the manylinux image
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
container:
image: quay.io/pypa/manylinux2014_aarch64:2024-01-08-eb135ed
image: quay.io/pypa/manylinux2014_aarch64:latest
env:
PLAT: manylinux2014_aarch64
# Mount local hunter cache directory, instead of transfering to Github and back
Expand Down Expand Up @@ -399,7 +413,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
- name: Building wheels
run: for PYBIN in /opt/python/cp3{6..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{7..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
- name: Auditing wheels
run: for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat $PLAT -w wheelhouse/audited/; done
- name: Archive wheel artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-install-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
test_macos:
strategy:
matrix:
os: ["macos-11", "macos-12", "macos-13", "macos-14"]
os: ["macos-12", "macos-13", "macos-14"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generated/Hunter/config.cmake ${final_hun

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
SHA1 "16cc954aa723bccd16ea45fc91a858d0c5246376"
FILEPATH ${CMAKE_CURRENT_BINARY_DIR}/generated/Hunter/config.cmake # Combined config
)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![](https://img.shields.io/pypi/v/depthai.svg)](https://pypi.org/project/depthai/)
[![Python Wheel CI](https://github.com/luxonis/depthai-python/actions/workflows/main.yml/badge.svg?branch=gen2_develop)](https://github.com/luxonis/depthai-python/actions/workflows/main.yml)
[![Python Wheel CI](https://github.com/luxonis/depthai-python/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/luxonis/depthai-python/actions/workflows/main.yml)

Python bindings for C++ depthai-core library

Expand Down
8 changes: 4 additions & 4 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Pybind11 2.9.2
# Pybind11 2.12.0
hunter_config(
pybind11
VERSION "2.9.2"
URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.9.2.tar.gz"
SHA1 "5e05583a210282c3251281b6ee5677915f0cbf95"
VERSION "2.12.0"
URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.tar.gz"
SHA1 "e70610cba7b6b7d7a57827d5357c016ad2155c0f"
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/ImageAlign/depth_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def getFps(self):

out.setStreamName("out")

sync.setSyncThreshold(timedelta(seconds=(1 / FPS) * 0.5))
sync.setSyncThreshold(timedelta(seconds=0.5 / FPS))

# Linking
camRgb.isp.link(sync.inputs["rgb"])
Expand Down
18 changes: 6 additions & 12 deletions examples/ImageAlign/image_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

RGB_SOCKET = dai.CameraBoardSocket.CAM_A
LEFT_SOCKET = dai.CameraBoardSocket.CAM_B
RIGHT_SOCKET = dai.CameraBoardSocket.CAM_C
ALIGN_SOCKET = LEFT_SOCKET

COLOR_RESOLUTION = dai.ColorCameraProperties.SensorResolution.THE_1080_P
Expand All @@ -19,7 +18,6 @@
# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
left = pipeline.create(dai.node.MonoCamera)
right = pipeline.create(dai.node.MonoCamera)
sync = pipeline.create(dai.node.Sync)
out = pipeline.create(dai.node.XLinkOut)
align = pipeline.create(dai.node.ImageAlign)
Expand All @@ -29,18 +27,14 @@
left.setBoardSocket(LEFT_SOCKET)
left.setFps(FPS)

right.setResolution(LEFT_RIGHT_RESOLUTION)
right.setBoardSocket(RIGHT_SOCKET)
right.setFps(FPS)

camRgb.setBoardSocket(RGB_SOCKET)
camRgb.setResolution(COLOR_RESOLUTION)
camRgb.setFps(FPS)
camRgb.setIspScale(1, 3)

out.setStreamName("out")

sync.setSyncThreshold(timedelta(seconds=(1 / FPS) * 0.5))
sync.setSyncThreshold(timedelta(seconds=0.5 / FPS))

cfgIn.setStreamName("config")

Expand All @@ -57,19 +51,19 @@


rgbWeight = 0.4
depthWeight = 0.6
leftWeight = 0.6


def updateBlendWeights(percentRgb):
"""
Update the rgb and depth weights used to blend depth/rgb image
Update the rgb and left weights used to blend rgb/left image
@param[in] percent_rgb The rgb weight expressed as a percentage (0..100)
"""
global depthWeight
global leftWeight
global rgbWeight
rgbWeight = float(percentRgb) / 100.0
depthWeight = 1.0 - rgbWeight
leftWeight = 1.0 - rgbWeight

def updateDepthPlane(depth):
global staticDepthPlane
Expand Down Expand Up @@ -118,7 +112,7 @@ def updateDepthPlane(depth):
if leftCv.shape != frameRgbCv.shape:
leftCv = cv2.resize(leftCv, (frameRgbCv.shape[1], frameRgbCv.shape[0]))

blended = cv2.addWeighted(frameRgbCv, rgbWeight, leftCv, depthWeight, 0)
blended = cv2.addWeighted(frameRgbCv, rgbWeight, leftCv, leftWeight, 0)
cv2.imshow(windowName, blended)

key = cv2.waitKey(1)
Expand Down
2 changes: 1 addition & 1 deletion examples/ImageAlign/thermal_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def getFps(self):

out.setStreamName("out")

sync.setSyncThreshold(timedelta(seconds=1/FPS * 0.5))
sync.setSyncThreshold(timedelta(seconds=0.5 / FPS))

cfgIn.setStreamName("config")

Expand Down
2 changes: 1 addition & 1 deletion examples/ImageAlign/tof_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def getFps(self):

out.setStreamName("out")

sync.setSyncThreshold(timedelta(seconds=(1 / FPS)))
sync.setSyncThreshold(timedelta(seconds=0.5 / FPS))

# Linking
camRgb.isp.link(sync.inputs["rgb"])
Expand Down
31 changes: 31 additions & 0 deletions examples/Sync/sync_all_cameras.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python3

import cv2
import depthai as dai

with dai.Device() as device:
pipeline = dai.Pipeline()
cams = device.getConnectedCameraFeatures()
sync = pipeline.create(dai.node.Sync)
for cam in cams:
print(str(cam), str(cam.socket), cam.socket)
cam_node = pipeline.create(dai.node.Camera)
cam_node.setBoardSocket(cam.socket)
cam_node.isp.link(sync.inputs[str(cam.socket)])

xout = pipeline.create(dai.node.XLinkOut)
xout.setStreamName('sync')
sync.out.link(xout.input)

# Start pipeline
device.startPipeline(pipeline)
q = device.getOutputQueue('sync', maxSize=10, blocking=False)
while not device.isClosed():
msgs = q.get()
for (name, imgFrame) in msgs:
print(f'Cam {name}, seq {imgFrame.getSequenceNum()}, tiemstamp {imgFrame.getTimestamp()}')
cv2.imshow(name, imgFrame.getCvFrame())
print('----')

if cv2.waitKey(1) == ord('q'):
break
4 changes: 2 additions & 2 deletions examples/install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ def hasWhitespace(string):
requireOpenCv = True

if requireOpenCv:
DEPENDENCIES.append('numpy')
DEPENDENCIES.append('numpy<3.0')
# 4.5.4.58 package is broken for python 3.9
if sys.version_info[0] == 3 and sys.version_info[1] == 9:
DEPENDENCIES.append('opencv-python!=4.5.4.58')
else:
DEPENDENCIES.append('opencv-python')
DEPENDENCIES.append('opencv-python<5.0')



Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ def build_extension(self, ext):
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand All @@ -250,7 +249,7 @@ def build_extension(self, ext):
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
],
python_requires='>=3.6',
python_requires='>=3.7',
entry_points={
"console_scripts": [
f'depthai={DEPTHAI_CLI_MODULE_NAME}.depthai_cli:cli'
Expand Down
Loading

0 comments on commit c9a23c4

Please sign in to comment.