Skip to content

Commit 852af5b

Browse files
committed
Merge branch 'release_2.15.0' into main
2 parents 5108952 + 5226862 commit 852af5b

17 files changed

+705
-150
lines changed

.github/workflows/docker-hub.yml

Lines changed: 29 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,19 @@ on:
88
tags:
99
- 'v*'
1010
jobs:
11-
build_amd64:
12-
name: Build amd64 docker image
13-
runs-on: ubuntu-latest
14-
timeout-minutes: 240
15-
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
with:
19-
submodules: recursive
20-
- name: Login to DockerHub
21-
uses: docker/login-action@v1
22-
with:
23-
username: ${{ secrets.DOCKERHUB_USER }}
24-
password: ${{ secrets.DOCKERHUB_PASS }}
25-
- name: Get Version
26-
id: vars
27-
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
28-
29-
- name: Build and push (development)
30-
if: startsWith(github.ref, 'refs/tags/v') != true
31-
uses: docker/build-push-action@v2
32-
with:
33-
push: true
34-
file: ci/Dockerfile
35-
tags: luxonis/depthai-library:${{github.sha}}-amd64
36-
- name: Build and push (release)
37-
if: startsWith(github.ref, 'refs/tags/v') == true
38-
uses: docker/build-push-action@v2
39-
with:
40-
push: true
41-
file: ci/Dockerfile
42-
tags: luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-amd64
4311

44-
build_armv7:
45-
name: Build armv7 docker image
46-
runs-on: luxonis-armhf
47-
timeout-minutes: 240
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, luxonis-armhf, ARM64]
17+
include:
18+
- os: ubuntu-latest
19+
arch: amd64
20+
- os: luxonis-armhf
21+
arch: armv7
22+
- os: ARM64
23+
arch: armv8
4824
steps:
4925
- name: Clean the workspace
5026
uses: docker://alpine
@@ -59,64 +35,28 @@ jobs:
5935
with:
6036
username: ${{ secrets.DOCKERHUB_USER }}
6137
password: ${{ secrets.DOCKERHUB_PASS }}
62-
- name: Get Version
63-
id: vars
64-
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
6538

66-
- name: Build and push (development)
39+
- name: Set Image Name (development)
40+
id: name
6741
if: startsWith(github.ref, 'refs/tags/v') != true
68-
uses: docker/build-push-action@v2
69-
with:
70-
push: true
71-
file: ci/Dockerfile
72-
tags: luxonis/depthai-library:${{github.sha}}-armv7
73-
- name: Build and push (release)
74-
if: startsWith(github.ref, 'refs/tags/v') == true
75-
uses: docker/build-push-action@v2
76-
with:
77-
push: true
78-
file: ci/Dockerfile
79-
tags: luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv7
80-
81-
build_armv8:
82-
name: Build armv8 docker image
83-
runs-on: ARM64
84-
timeout-minutes: 240
85-
steps:
86-
- name: Clean the workspace
87-
uses: docker://alpine
88-
with:
89-
args: /bin/sh -c "rm -rf /github/workspace/.* || rm -rf /github/workspace/*"
90-
- name: Checkout
91-
uses: actions/checkout@v2
92-
with:
93-
submodules: recursive
94-
- name: Login to DockerHub
95-
uses: docker/login-action@v1
96-
with:
97-
username: ${{ secrets.DOCKERHUB_USER }}
98-
password: ${{ secrets.DOCKERHUB_PASS }}
99-
- name: Get Version
100-
id: vars
101-
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
42+
run: echo "LUXONIS_IMAGE_TAG=${{ github.sha }}-${{ matrix.arch }}" >> $GITHUB_ENV
10243

103-
- name: Build and push (development)
104-
if: startsWith(github.ref, 'refs/tags/v') != true
105-
uses: docker/build-push-action@v2
106-
with:
107-
push: true
108-
file: ci/Dockerfile
109-
tags: luxonis/depthai-library:${{github.sha}}-armv8
110-
- name: Build and push (release)
44+
- name: Set Image Name (release)
11145
if: startsWith(github.ref, 'refs/tags/v') == true
46+
run: echo "LUXONIS_IMAGE_TAG=${GITHUB_REF#refs/*/}-${{ matrix.arch }}" >> $GITHUB_ENV
47+
48+
- name: Build and push
11249
uses: docker/build-push-action@v2
11350
with:
11451
push: true
11552
file: ci/Dockerfile
116-
tags: luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv8
53+
tags: luxonis/depthai-library:${{ env.LUXONIS_IMAGE_TAG }}
54+
55+
- name: Cleanup the created image
56+
run: docker image rm luxonis/depthai-library:${{ env.LUXONIS_IMAGE_TAG }}
11757

11858
upload:
119-
needs: [build_amd64, build_armv7, build_armv8]
59+
needs: [build]
12060
name: Combine into a single multi-arch image and upload tags
12161
runs-on: ubuntu-latest
12262
steps:
@@ -152,4 +92,9 @@ jobs:
15292
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv8
15393
# Push
15494
docker manifest push luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}
95+
docker manifest create \
96+
luxonis/depthai-library:latest \
97+
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-amd64 \
98+
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv7 \
99+
--amend luxonis/depthai-library:${{ steps.vars.outputs.short_ref }}-armv8
155100
docker manifest push luxonis/depthai-library:latest

depthai-core

Submodule depthai-core updated 111 files

docs/ci.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ execute_process(COMMAND ${CMAKE_COMMAND}
1616
)
1717

1818
# Build
19-
execute_process(COMMAND ${CMAKE_COMMAND} --build build --parallel 4 WORKING_DIRECTORY ${project_root} COMMAND_ECHO STDOUT)
19+
execute_process(COMMAND ${CMAKE_COMMAND} --build build --parallel 3 WORKING_DIRECTORY ${project_root} COMMAND_ECHO STDOUT)

examples/AprilTag/apriltag.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env python3
2+
3+
import cv2
4+
import depthai as dai
5+
import time
6+
7+
# Create pipeline
8+
pipeline = dai.Pipeline()
9+
10+
# Define sources and outputs
11+
monoLeft = pipeline.create(dai.node.MonoCamera)
12+
aprilTag = pipeline.create(dai.node.AprilTag)
13+
14+
xoutMono = pipeline.create(dai.node.XLinkOut)
15+
xoutAprilTag = pipeline.create(dai.node.XLinkOut)
16+
17+
xoutMono.setStreamName("mono")
18+
xoutAprilTag.setStreamName("aprilTagData")
19+
20+
# Properties
21+
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
22+
monoLeft.setBoardSocket(dai.CameraBoardSocket.LEFT)
23+
24+
aprilTag.initialConfig.setFamily(dai.AprilTagConfig.Family.TAG_36H11)
25+
26+
# Linking
27+
aprilTag.passthroughInputImage.link(xoutMono.input)
28+
monoLeft.out.link(aprilTag.inputImage)
29+
aprilTag.out.link(xoutAprilTag.input)
30+
# always take the latest frame as apriltag detections are slow
31+
aprilTag.inputImage.setBlocking(False)
32+
aprilTag.inputImage.setQueueSize(1)
33+
34+
# advanced settings, configurable at runtime
35+
aprilTagConfig = aprilTag.initialConfig.get()
36+
aprilTagConfig.quadDecimate = 4
37+
aprilTagConfig.quadSigma = 0
38+
aprilTagConfig.refineEdges = True
39+
aprilTagConfig.decodeSharpening = 0.25
40+
aprilTagConfig.maxHammingDistance = 1
41+
aprilTagConfig.quadThresholds.minClusterPixels = 5
42+
aprilTagConfig.quadThresholds.maxNmaxima = 10
43+
aprilTagConfig.quadThresholds.criticalDegree = 10
44+
aprilTagConfig.quadThresholds.maxLineFitMse = 10
45+
aprilTagConfig.quadThresholds.minWhiteBlackDiff = 5
46+
aprilTagConfig.quadThresholds.deglitch = False
47+
aprilTag.initialConfig.set(aprilTagConfig)
48+
49+
# Connect to device and start pipeline
50+
with dai.Device(pipeline) as device:
51+
52+
# Output queue will be used to get the mono frames from the outputs defined above
53+
monoQueue = device.getOutputQueue("mono", 8, False)
54+
aprilTagQueue = device.getOutputQueue("aprilTagData", 8, False)
55+
56+
color = (0, 255, 0)
57+
58+
startTime = time.monotonic()
59+
counter = 0
60+
fps = 0
61+
62+
while(True):
63+
inFrame = monoQueue.get()
64+
65+
counter+=1
66+
current_time = time.monotonic()
67+
if (current_time - startTime) > 1 :
68+
fps = counter / (current_time - startTime)
69+
counter = 0
70+
startTime = current_time
71+
72+
monoFrame = inFrame.getFrame()
73+
frame = cv2.cvtColor(monoFrame, cv2.COLOR_GRAY2BGR)
74+
75+
aprilTagData = aprilTagQueue.get().aprilTags
76+
for aprilTag in aprilTagData:
77+
topLeft = aprilTag.topLeft
78+
topRight = aprilTag.topRight
79+
bottomRight = aprilTag.bottomRight
80+
bottomLeft = aprilTag.bottomLeft
81+
82+
center = (int((topLeft.x + bottomRight.x) / 2), int((topLeft.y + bottomRight.y) / 2))
83+
84+
cv2.line(frame, (int(topLeft.x), int(topLeft.y)), (int(topRight.x), int(topRight.y)), color, 2, cv2.LINE_AA, 0)
85+
cv2.line(frame, (int(topRight.x), int(topRight.y)), (int(bottomRight.x), int(bottomRight.y)), color, 2, cv2.LINE_AA, 0)
86+
cv2.line(frame, (int(bottomRight.x), int(bottomRight.y)), (int(bottomLeft.x), int(bottomLeft.y)), color, 2, cv2.LINE_AA, 0)
87+
cv2.line(frame, (int(bottomLeft.x), int(bottomLeft.y)), (int(topLeft.x), int(topLeft.y)), color, 2, cv2.LINE_AA, 0)
88+
89+
idStr = "ID: " + str(aprilTag.id)
90+
cv2.putText(frame, idStr, center, cv2.FONT_HERSHEY_TRIPLEX, 0.5, color)
91+
92+
cv2.putText(frame, "Fps: {:.2f}".format(fps), (2, frame.shape[0] - 4), cv2.FONT_HERSHEY_TRIPLEX, 0.4, (255,255,255))
93+
94+
cv2.imshow("mono", frame)
95+
96+
if cv2.waitKey(1) == ord('q'):
97+
break

examples/AprilTag/apriltag_rgb.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env python3
2+
3+
import cv2
4+
import depthai as dai
5+
import time
6+
7+
# Create pipeline
8+
pipeline = dai.Pipeline()
9+
10+
# Define sources and outputs
11+
camRgb = pipeline.create(dai.node.ColorCamera)
12+
aprilTag = pipeline.create(dai.node.AprilTag)
13+
manip = pipeline.create(dai.node.ImageManip)
14+
15+
xoutAprilTag = pipeline.create(dai.node.XLinkOut)
16+
xoutAprilTagImage = pipeline.create(dai.node.XLinkOut)
17+
18+
xoutAprilTag.setStreamName("aprilTagData")
19+
xoutAprilTagImage.setStreamName("aprilTagImage")
20+
21+
# Properties
22+
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
23+
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
24+
25+
manip.initialConfig.setResize(480, 270)
26+
manip.initialConfig.setFrameType(dai.ImgFrame.Type.GRAY8)
27+
28+
aprilTag.initialConfig.setFamily(dai.AprilTagConfig.Family.TAG_36H11)
29+
30+
# Linking
31+
aprilTag.passthroughInputImage.link(xoutAprilTagImage.input)
32+
camRgb.video.link(manip.inputImage)
33+
manip.out.link(aprilTag.inputImage)
34+
aprilTag.out.link(xoutAprilTag.input)
35+
# always take the latest frame as apriltag detections are slow
36+
aprilTag.inputImage.setBlocking(False)
37+
aprilTag.inputImage.setQueueSize(1)
38+
39+
# Connect to device and start pipeline
40+
with dai.Device(pipeline) as device:
41+
42+
# Output queue will be used to get the mono frames from the outputs defined above
43+
manipQueue = device.getOutputQueue("aprilTagImage", 8, False)
44+
aprilTagQueue = device.getOutputQueue("aprilTagData", 8, False)
45+
46+
color = (0, 255, 0)
47+
48+
startTime = time.monotonic()
49+
counter = 0
50+
fps = 0
51+
52+
while(True):
53+
inFrame = manipQueue.get()
54+
55+
counter+=1
56+
current_time = time.monotonic()
57+
if (current_time - startTime) > 1 :
58+
fps = counter / (current_time - startTime)
59+
counter = 0
60+
startTime = current_time
61+
62+
monoFrame = inFrame.getFrame()
63+
frame = cv2.cvtColor(monoFrame, cv2.COLOR_GRAY2BGR)
64+
65+
aprilTagData = aprilTagQueue.get().aprilTags
66+
for aprilTag in aprilTagData:
67+
topLeft = aprilTag.topLeft
68+
topRight = aprilTag.topRight
69+
bottomRight = aprilTag.bottomRight
70+
bottomLeft = aprilTag.bottomLeft
71+
72+
center = (int((topLeft.x + bottomRight.x) / 2), int((topLeft.y + bottomRight.y) / 2))
73+
74+
cv2.line(frame, (int(topLeft.x), int(topLeft.y)), (int(topRight.x), int(topRight.y)), color, 2, cv2.LINE_AA, 0)
75+
cv2.line(frame, (int(topRight.x), int(topRight.y)), (int(bottomRight.x), int(bottomRight.y)), color, 2, cv2.LINE_AA, 0)
76+
cv2.line(frame, (int(bottomRight.x), int(bottomRight.y)), (int(bottomLeft.x), int(bottomLeft.y)), color, 2, cv2.LINE_AA, 0)
77+
cv2.line(frame, (int(bottomLeft.x), int(bottomLeft.y)), (int(topLeft.x), int(topLeft.y)), color, 2, cv2.LINE_AA, 0)
78+
79+
idStr = "ID: " + str(aprilTag.id)
80+
cv2.putText(frame, idStr, center, cv2.FONT_HERSHEY_TRIPLEX, 0.5, color)
81+
82+
cv2.putText(frame, "Fps: {:.2f}".format(fps), (2, frame.shape[0] - 4), cv2.FONT_HERSHEY_TRIPLEX, 0.4, (255,255,255))
83+
84+
cv2.imshow("April tag frame", frame)
85+
86+
if cv2.waitKey(1) == ord('q'):
87+
break

examples/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,7 @@ add_python_example(rgb_mono_encoding VideoEncoder/rgb_mono_encoding.py)
183183
## Yolo
184184
add_python_example(tiny_yolo_v3_device_side_decoding Yolo/tiny_yolo.py yolo3)
185185
add_python_example(tiny_yolo_v4_device_side_decoding Yolo/tiny_yolo.py yolo4)
186+
187+
## AprilTag
188+
add_python_example(apriltag AprilTag/apriltag.py)
189+
add_python_example(apriltag_rgb AprilTag/apriltag_rgb.py)

examples/IMU/imu_gyroscope_accelerometer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414

1515
xlinkOut.setStreamName("imu")
1616

17-
# enable ACCELEROMETER_RAW and GYROSCOPE_RAW at 500 hz rate
18-
imu.enableIMUSensor([dai.IMUSensor.ACCELEROMETER_RAW, dai.IMUSensor.GYROSCOPE_RAW], 500)
17+
# enable ACCELEROMETER_RAW at 500 hz rate
18+
imu.enableIMUSensor(dai.IMUSensor.ACCELEROMETER_RAW, 500)
19+
# enable GYROSCOPE_RAW at 400 hz rate
20+
imu.enableIMUSensor(dai.IMUSensor.GYROSCOPE_RAW, 400)
21+
# it's recommended to set both setBatchReportThreshold and setMaxBatchReports to 20 when integrating in a pipeline with a lot of input/output connections
1922
# above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available
2023
imu.setBatchReportThreshold(1)
2124
# maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it

examples/StereoDepth/rgb_depth_aligned.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def updateBlendWeights(percent_rgb):
2626
downscaleColor = True
2727
fps = 30
2828
# The disparity is computed at this resolution, then upscaled to RGB resolution
29-
monoResolution = dai.MonoCameraProperties.SensorResolution.THE_400_P
29+
monoResolution = dai.MonoCameraProperties.SensorResolution.THE_720_P
3030

3131
# Create pipeline
3232
pipeline = dai.Pipeline()

0 commit comments

Comments
 (0)