-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/stereo_filter_improvements' into…
… HEAD
- Loading branch information
Showing
41 changed files
with
232 additions
and
14 deletions.
There are no files selected for viewing
Submodule depthai-core
updated
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
import numpy as np | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import numpy as np | ||
import cv2 | ||
import depthai as dai | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import cv2 | ||
import depthai as dai | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import cv2 | ||
import depthai as dai | ||
from itertools import cycle | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import cv2 | ||
import depthai as dai | ||
import numpy as np | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import zipfile | ||
from json import dump, JSONEncoder | ||
|
2 changes: 2 additions & 0 deletions
2
examples/FeatureTracker/feature_motion_estimation.py
100644 → 100755
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import numpy as np | ||
import cv2 | ||
from collections import deque | ||
|
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
from pathlib import Path | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import numpy as np | ||
import cv2 | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
from time import sleep | ||
import numpy as np | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
|
||
|
Empty file.
Empty file.
Empty file.
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,83 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import cv2 | ||
import depthai as dai | ||
import numpy as np | ||
|
||
# Create pipeline | ||
pipeline = dai.Pipeline() | ||
|
||
# Define sources and outputs | ||
monoLeft = pipeline.create(dai.node.MonoCamera) | ||
monoRight = pipeline.create(dai.node.MonoCamera) | ||
stereo = pipeline.create(dai.node.StereoDepth) | ||
xout = pipeline.create(dai.node.XLinkOut) | ||
xoutLeft = pipeline.create(dai.node.XLinkOut) | ||
|
||
xout.setStreamName("disparity") | ||
xoutLeft.setStreamName("left") | ||
|
||
# Properties | ||
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) | ||
monoLeft.setCamera("left") | ||
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) | ||
monoRight.setCamera("right") | ||
|
||
stereo.enableDistortionCorrection(True) | ||
|
||
# Linking | ||
monoLeft.out.link(stereo.left) | ||
monoRight.out.link(stereo.right) | ||
stereo.disparity.link(xout.input) | ||
stereo.rectifiedLeft.link(xoutLeft.input) | ||
|
||
cvColorMap = cv2.applyColorMap(np.arange(256, dtype=np.uint8), cv2.COLORMAP_JET) | ||
cvColorMap[0] = [0, 0, 0] | ||
|
||
# Connect to device and start pipeline | ||
with dai.Device(pipeline) as device: | ||
|
||
try: | ||
calibration = device.readCalibration() | ||
except: | ||
print("Device is not calibrated!") | ||
exit() | ||
|
||
print("Press 'u' to update distortion coefficients with random values") | ||
|
||
# Output queue will be used to get the disparity frames from the outputs defined above | ||
q = device.getOutputQueue(name="disparity", maxSize=4, blocking=False) | ||
qLeft = device.getOutputQueue(name="left", maxSize=4, blocking=False) | ||
|
||
while True: | ||
inDisparity = q.get() # blocking call, will wait until a new data has arrived | ||
frame = inDisparity.getFrame() | ||
# Normalization for better visualization | ||
frame = (frame * (255 / stereo.initialConfig.getMaxDisparity())).astype(np.uint8) | ||
|
||
cv2.imshow("disparity", frame) | ||
|
||
frame = cv2.applyColorMap(frame, cvColorMap) | ||
cv2.imshow("disparity_color", frame) | ||
|
||
inLeft = qLeft.get() | ||
frame = inLeft.getCvFrame() | ||
cv2.imshow("rectified left", frame) | ||
|
||
key = cv2.waitKey(1) | ||
if key == ord('q'): | ||
break | ||
elif key == ord('u'): | ||
randomDistortionCoeffs = np.random.rand(14) | ||
calibration.setDistortionCoefficients(dai.CameraBoardSocket.LEFT, randomDistortionCoeffs) | ||
try: | ||
device.setCalibration(calibration) | ||
except: | ||
print("Failed to update calibration!") | ||
try: | ||
updatedCalib = device.getCalibration() | ||
distortionCoeffs = updatedCalib.getDistortionCoefficients(dai.CameraBoardSocket.LEFT) | ||
print("Updated distortion coefficients: ", distortionCoeffs) | ||
except: | ||
pass | ||
|
Empty file.
Empty file.
Empty file.
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,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 |
Empty file.
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
|
||
devices = dai.Device.getAllConnectedDevices() | ||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import time | ||
|
||
|
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import depthai as dai | ||
import cv2 | ||
import numpy as np | ||
|
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
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
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
Oops, something went wrong.