-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1023 from luxonis/release_2.26.0.0
Release 2.26.0.0
- Loading branch information
Showing
25 changed files
with
1,297 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule depthai-core
updated
37 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import depthai as dai | ||
import cv2 | ||
from pathlib import Path | ||
|
||
SHAPE = 300 | ||
|
||
p = dai.Pipeline() | ||
|
||
camRgb = p.create(dai.node.ColorCamera) | ||
nn = p.create(dai.node.NeuralNetwork) | ||
rgbOut = p.create(dai.node.XLinkOut) | ||
cast = p.create(dai.node.Cast) | ||
castXout = p.create(dai.node.XLinkOut) | ||
|
||
camRgb.setPreviewSize(SHAPE, SHAPE) | ||
camRgb.setInterleaved(False) | ||
|
||
nnBlobPath = (Path(__file__).parent / Path('../models/blur_simplified_openvino_2021.4_6shave.blob')).resolve().absolute() | ||
|
||
nn.setBlobPath(nnBlobPath) | ||
|
||
rgbOut.setStreamName("rgb") | ||
|
||
castXout.setStreamName("cast") | ||
|
||
cast.setOutputFrameType(dai.RawImgFrame.Type.BGR888p) | ||
|
||
# Linking | ||
camRgb.preview.link(nn.input) | ||
camRgb.preview.link(rgbOut.input) | ||
nn.out.link(cast.input) | ||
cast.output.link(castXout.input) | ||
|
||
with dai.Device(p) as device: | ||
qCam = device.getOutputQueue(name="rgb", maxSize=4, blocking=False) | ||
qCast = device.getOutputQueue(name="cast", maxSize=4, blocking=False) | ||
|
||
|
||
while True: | ||
inCast = qCast.get() | ||
assert isinstance(inCast, dai.ImgFrame) | ||
inRgb = qCam.get() | ||
assert isinstance(inRgb, dai.ImgFrame) | ||
cv2.imshow("Blur", inCast.getCvFrame()) | ||
cv2.imshow("Original", inRgb.getCvFrame()) | ||
|
||
|
||
if cv2.waitKey(1) == ord('q'): | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import numpy as np | ||
import cv2 | ||
import depthai as dai | ||
from pathlib import Path | ||
|
||
SHAPE = 300 | ||
|
||
p = dai.Pipeline() | ||
|
||
camRgb = p.create(dai.node.ColorCamera) | ||
left = p.create(dai.node.MonoCamera) | ||
right = p.create(dai.node.MonoCamera) | ||
manipLeft = p.create(dai.node.ImageManip) | ||
manipRight = p.create(dai.node.ImageManip) | ||
nn = p.create(dai.node.NeuralNetwork) | ||
cast = p.create(dai.node.Cast) | ||
castXout = p.create(dai.node.XLinkOut) | ||
|
||
camRgb.setPreviewSize(SHAPE, SHAPE) | ||
camRgb.setInterleaved(False) | ||
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.BGR) | ||
|
||
left.setCamera("left") | ||
left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) | ||
manipLeft.initialConfig.setResize(SHAPE, SHAPE) | ||
manipLeft.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p) | ||
|
||
right.setCamera("right") | ||
right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) | ||
manipRight.initialConfig.setResize(SHAPE, SHAPE) | ||
manipRight.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p) | ||
|
||
nnBlobPath = (Path(__file__).parent / Path('../models/concat_openvino_2021.4_6shave.blob')).resolve().absolute() | ||
nn.setBlobPath(nnBlobPath) | ||
nn.setNumInferenceThreads(2) | ||
|
||
castXout.setStreamName("cast") | ||
cast.setOutputFrameType(dai.ImgFrame.Type.BGR888p) | ||
|
||
# Linking | ||
left.out.link(manipLeft.inputImage) | ||
right.out.link(manipRight.inputImage) | ||
manipLeft.out.link(nn.inputs['img1']) | ||
camRgb.preview.link(nn.inputs['img2']) | ||
manipRight.out.link(nn.inputs['img3']) | ||
nn.out.link(cast.input) | ||
cast.output.link(castXout.input) | ||
|
||
# Pipeline is defined, now we can connect to the device | ||
with dai.Device(p) as device: | ||
qCast = device.getOutputQueue(name="cast", maxSize=4, blocking=False) | ||
|
||
while True: | ||
inCast = qCast.get() | ||
assert isinstance(inCast, dai.ImgFrame) | ||
cv2.imshow("Concated frames", inCast.getCvFrame()) | ||
|
||
if cv2.waitKey(1) == ord('q'): | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import cv2 | ||
import depthai as dai | ||
from pathlib import Path | ||
|
||
SHAPE = 720 | ||
|
||
p = dai.Pipeline() | ||
|
||
camRgb = p.create(dai.node.ColorCamera) | ||
nn = p.create(dai.node.NeuralNetwork) | ||
script = p.create(dai.node.Script) | ||
rgbXout = p.create(dai.node.XLinkOut) | ||
cast = p.create(dai.node.Cast) | ||
castXout = p.create(dai.node.XLinkOut) | ||
|
||
camRgb.setVideoSize(SHAPE, SHAPE) | ||
camRgb.setPreviewSize(SHAPE, SHAPE) | ||
camRgb.setInterleaved(False) | ||
|
||
nnBlobPath = (Path(__file__).parent / Path('../models/diff_openvino_2022.1_6shave.blob')).resolve().absolute() | ||
nn.setBlobPath(nnBlobPath) | ||
|
||
script.setScript(""" | ||
old = node.io['in'].get() | ||
while True: | ||
frame = node.io['in'].get() | ||
node.io['img1'].send(old) | ||
node.io['img2'].send(frame) | ||
old = frame | ||
""") | ||
|
||
rgbXout.setStreamName("rgb") | ||
castXout.setStreamName("cast") | ||
cast.setOutputFrameType(dai.RawImgFrame.Type.GRAY8) | ||
|
||
# Linking | ||
camRgb.preview.link(script.inputs['in']) | ||
script.outputs['img1'].link(nn.inputs['img1']) | ||
script.outputs['img2'].link(nn.inputs['img2']) | ||
camRgb.video.link(rgbXout.input) | ||
nn.out.link(cast.input) | ||
cast.output.link(castXout.input) | ||
|
||
# Pipeline is defined, now we can connect to the device | ||
with dai.Device(p) as device: | ||
qCam = device.getOutputQueue(name="rgb", maxSize=4, blocking=False) | ||
qCast = device.getOutputQueue(name="cast", maxSize=4, blocking=False) | ||
|
||
|
||
while True: | ||
colorFrame = qCam.get() | ||
assert isinstance(colorFrame, dai.ImgFrame) | ||
cv2.imshow("Color", colorFrame.getCvFrame()) | ||
|
||
inCast = qCast.get() | ||
assert isinstance(inCast, dai.ImgFrame) | ||
cv2.imshow("Diff", inCast.getCvFrame()) | ||
|
||
if cv2.waitKey(1) == ord('q'): | ||
break |
Oops, something went wrong.