Skip to content

Commit

Permalink
Merge pull request #1083 from luxonis/release_v2.29.0.0
Browse files Browse the repository at this point in the history
Release v2.29.0.0
  • Loading branch information
moratom authored Nov 22, 2024
2 parents 50f509b + a0b1842 commit 84daffe
Show file tree
Hide file tree
Showing 41 changed files with 290 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: [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', '3.13']
python-architecture: [x64, x86]
fail-fast: false
steps:
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
needs: build-docstrings
strategy:
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
os: [macos-13, macos-14] # macos-13 is x64, macos-14 is arm64
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -352,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{7..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{7..13}*/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 Down Expand Up @@ -413,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{7..12}*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/ --verbose; done
run: for PYBIN in /opt/python/cp3{7..13}*/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 @@ -16,7 +16,7 @@
runs-on: ubuntu-latest
strategy:
matrix:
container_image: ["fedora:34", "fedora:35", "fedora:36", "ubuntu:18.04", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:rolling"]
container_image: ["fedora:34", "fedora:35", "fedora:36", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "ubuntu:rolling"]
container:
image: ${{ matrix.container_image }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions examples/Camera/camera_undistort.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import cv2

Expand Down
2 changes: 2 additions & 0 deletions examples/Camera/thermal_cam.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import cv2
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions examples/Cast/cast_blur.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import cv2
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions examples/Cast/cast_concat.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import numpy as np
import cv2
import depthai as dai
Expand Down
2 changes: 2 additions & 0 deletions examples/Cast/cast_diff.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import cv2
import depthai as dai
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions examples/ColorCamera/rgb_scene.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import cv2
import depthai as dai
from itertools import cycle
Expand Down
2 changes: 2 additions & 0 deletions examples/ColorCamera/rgb_undistort.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import cv2
import depthai as dai
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions examples/CrashReport/capture_diagnostic.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import zipfile
from json import dump, JSONEncoder
Expand Down
2 changes: 2 additions & 0 deletions examples/FeatureTracker/feature_motion_estimation.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import numpy as np
import cv2
from collections import deque
Expand Down
7 changes: 5 additions & 2 deletions examples/ImageAlign/depth_align.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import numpy as np
import cv2
import depthai as dai
Expand Down Expand Up @@ -32,7 +34,6 @@ def getFps(self):
device = dai.Device()

calibrationHandler = device.readCalibration()
rgbIntrinsics = calibrationHandler.getCameraIntrinsics(RGB_SOCKET, int(1920 / ISP_SCALE), int(1080 / ISP_SCALE))
rgbDistortion = calibrationHandler.getDistortionCoefficients(RGB_SOCKET)
distortionModel = calibrationHandler.getDistortionModel(RGB_SOCKET)
if distortionModel != dai.CameraModel.Perspective:
Expand Down Expand Up @@ -158,6 +159,8 @@ def updateBlendWeights(percentRgb):
if frameDepth is not None:
cvFrame = frameRgb.getCvFrame()

rgbIntrinsics = calibrationHandler.getCameraIntrinsics(RGB_SOCKET, int(cvFrame.shape[1]), int(cvFrame.shape[0]))

# Undistort the rgb frame
cvFrameUndistorted = cv2.undistort(
cvFrame,
Expand All @@ -170,7 +173,7 @@ def updateBlendWeights(percentRgb):
cv2.imshow("Depth aligned", alignedDepthColorized)

blended = cv2.addWeighted(
cvFrame, rgbWeight, alignedDepthColorized, depthWeight, 0
cvFrameUndistorted, rgbWeight, alignedDepthColorized, depthWeight, 0
)
cv2.putText(
blended,
Expand Down
28 changes: 24 additions & 4 deletions examples/ImageAlign/image_align.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python3

import cv2
import depthai as dai
from datetime import timedelta
import numpy as np

# This is an interactive example that shows how two frame sources without depth information.
FPS = 30.0
Expand All @@ -12,7 +15,16 @@
COLOR_RESOLUTION = dai.ColorCameraProperties.SensorResolution.THE_1080_P
LEFT_RIGHT_RESOLUTION = dai.MonoCameraProperties.SensorResolution.THE_720_P

ISP_SCALE = 3

device = dai.Device()

calibrationHandler = device.readCalibration()
rgbDistortion = calibrationHandler.getDistortionCoefficients(RGB_SOCKET)
distortionModel = calibrationHandler.getDistortionModel(RGB_SOCKET)
if distortionModel != dai.CameraModel.Perspective:
raise RuntimeError("Unsupported distortion model for RGB camera. This example supports only Perspective model.")

pipeline = dai.Pipeline()

# Define sources and outputs
Expand All @@ -30,7 +42,7 @@
camRgb.setBoardSocket(RGB_SOCKET)
camRgb.setResolution(COLOR_RESOLUTION)
camRgb.setFps(FPS)
camRgb.setIspScale(1, 3)
camRgb.setIspScale(1, ISP_SCALE)

out.setStreamName("out")

Expand Down Expand Up @@ -107,12 +119,20 @@ def updateDepthPlane(depth):
# Colorize the aligned depth
leftCv = leftAligned.getCvFrame()

rgbIntrinsics = calibrationHandler.getCameraIntrinsics(RGB_SOCKET, int(frameRgbCv.shape[1]), int(frameRgbCv.shape[0]))

cvFrameUndistorted = cv2.undistort(
frameRgbCv,
np.array(rgbIntrinsics),
np.array(rgbDistortion),
)

if len(leftCv.shape) == 2:
leftCv = cv2.cvtColor(leftCv, cv2.COLOR_GRAY2BGR)
if leftCv.shape != frameRgbCv.shape:
leftCv = cv2.resize(leftCv, (frameRgbCv.shape[1], frameRgbCv.shape[0]))
if leftCv.shape != cvFrameUndistorted.shape:
leftCv = cv2.resize(leftCv, (cvFrameUndistorted.shape[1], cvFrameUndistorted.shape[0]))

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

key = cv2.waitKey(1)
Expand Down
22 changes: 20 additions & 2 deletions examples/ImageAlign/thermal_align.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import cv2
import depthai as dai
import numpy as np
Expand Down Expand Up @@ -38,6 +40,14 @@ def getFps(self):
raise RuntimeError("No thermal camera found!")


ISP_SCALE = 3

calibrationHandler = device.readCalibration()
rgbDistortion = calibrationHandler.getDistortionCoefficients(RGB_SOCKET)
distortionModel = calibrationHandler.getDistortionModel(RGB_SOCKET)
if distortionModel != dai.CameraModel.Perspective:
raise RuntimeError("Unsupported distortion model for RGB camera. This example supports only Perspective model.")

pipeline = dai.Pipeline()

# Define sources and outputs
Expand All @@ -55,7 +65,7 @@ def getFps(self):
camRgb.setBoardSocket(RGB_SOCKET)
camRgb.setResolution(COLOR_RESOLUTION)
camRgb.setFps(FPS)
camRgb.setIspScale(1,3)
camRgb.setIspScale(1,ISP_SCALE)

out.setStreamName("out")

Expand Down Expand Up @@ -130,6 +140,14 @@ def updateDepthPlane(depth):
frameRgbCv = frameRgb.getCvFrame()
fpsCounter.tick()

rgbIntrinsics = calibrationHandler.getCameraIntrinsics(RGB_SOCKET, int(frameRgbCv.shape[1]), int(frameRgbCv.shape[0]))

cvFrameUndistorted = cv2.undistort(
frameRgbCv,
np.array(rgbIntrinsics),
np.array(rgbDistortion),
)

# Colorize the aligned depth
thermalFrame = thermalAligned.getCvFrame().astype(np.float32)
# Create a mask for nan values
Expand All @@ -141,7 +159,7 @@ def updateDepthPlane(depth):
# Apply the mask back with black pixels (0)
colormappedFrame[mask] = 0

blended = cv2.addWeighted(frameRgbCv, rgbWeight, colormappedFrame, thermalWeight, 0)
blended = cv2.addWeighted(cvFrameUndistorted, rgbWeight, colormappedFrame, thermalWeight, 0)

cv2.putText(
blended,
Expand Down
25 changes: 22 additions & 3 deletions examples/ImageAlign/tof_align.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import numpy as np
import cv2
import depthai as dai
Expand Down Expand Up @@ -27,8 +29,18 @@ def getFps(self):
return (len(self.frameTimes) - 1) / (self.frameTimes[-1] - self.frameTimes[0])


ISP_SCALE = 2

device = dai.Device()

calibrationHandler = device.readCalibration()
rgbDistortion = calibrationHandler.getDistortionCoefficients(RGB_SOCKET)
distortionModel = calibrationHandler.getDistortionModel(RGB_SOCKET)
if distortionModel != dai.CameraModel.Perspective:
raise RuntimeError("Unsupported distortion model for RGB camera. This example supports only Perspective model.")

pipeline = dai.Pipeline()

# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
tof = pipeline.create(dai.node.ToF)
Expand All @@ -46,7 +58,7 @@ def getFps(self):
camRgb.setBoardSocket(RGB_SOCKET)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_800_P)
camRgb.setFps(FPS)
camRgb.setIspScale(1, 2)
camRgb.setIspScale(1, ISP_SCALE)

out.setStreamName("out")

Expand Down Expand Up @@ -107,7 +119,8 @@ def updateBlendWeights(percentRgb):


# Connect to device and start pipeline
with dai.Device(pipeline) as device:
with device:
device.startPipeline(pipeline)
queue = device.getOutputQueue("out", 8, False)

# Configure windows; trackbar adjusts blending ratio of rgb/depth
Expand Down Expand Up @@ -136,6 +149,12 @@ def updateBlendWeights(percentRgb):
# Blend when both received
if frameDepth is not None:
cvFrame = frameRgb.getCvFrame()
rgbIntrinsics = calibrationHandler.getCameraIntrinsics(RGB_SOCKET, int(cvFrame.shape[1]), int(cvFrame.shape[0]))
cvFrameUndistorted = cv2.undistort(
cvFrame,
np.array(rgbIntrinsics),
np.array(rgbDistortion),
)
# Colorize the aligned depth
alignedDepthColorized = colorizeDepth(frameDepth.getFrame())
# Resize depth to match the rgb frame
Expand All @@ -151,7 +170,7 @@ def updateBlendWeights(percentRgb):
cv2.imshow("depth", alignedDepthColorized)

blended = cv2.addWeighted(
cvFrame, rgbWeight, alignedDepthColorized, depthWeight, 0
cvFrameUndistorted, rgbWeight, alignedDepthColorized, depthWeight, 0
)
cv2.imshow(rgbDepthWindowName, blended)

Expand Down
2 changes: 2 additions & 0 deletions examples/NeuralNetwork/thermal_nnet.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import cv2
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions examples/PointCloud/pointcloud_control.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import numpy as np
import cv2
Expand Down
2 changes: 2 additions & 0 deletions examples/PointCloud/visualize_pointcloud.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
from time import sleep
import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions examples/Script/script_emmc_access.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

import depthai as dai
import cv2

Expand Down
Empty file modified examples/Script/script_read_calibration.py
100644 → 100755
Empty file.
Empty file modified examples/Script/script_uart.py
100644 → 100755
Empty file.
Empty file modified examples/StereoDepth/stereo_depth_custom_mesh.py
100644 → 100755
Empty file.
Loading

0 comments on commit 84daffe

Please sign in to comment.