Hi,
After upgrading from DepthAI 2.24.0.0 to 2.30.0.0, this code
import cv2
import depthai as dai
pipeline = dai.Pipeline()
# rgb
xout2 = pipeline.create(dai.node.XLinkOut)
xout2.setStreamName("color")
camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setCamera("color")
camRgb.video.link(xout2.input)
# disparity
xout = pipeline.create(dai.node.XLinkOut)
xout.setStreamName("disparity")
depth = pipeline.create(dai.node.StereoDepth)
depth.setDepthAlign(dai.CameraBoardSocket.CAM_A)
config = depth.initialConfig.get()
config.postProcessing.decimationFilter.decimationFactor = 2
depth.initialConfig.set(config)
depth.disparity.link(xout.input)
monoLeft = pipeline.create(dai.node.MonoCamera)
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoLeft.setCamera("left")
monoLeft.out.link(depth.left)
monoRight = pipeline.create(dai.node.MonoCamera)
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoRight.setCamera("right")
monoRight.out.link(depth.right)
# run pipeline
with dai.Device(pipeline) as device:
color_queue = device.getOutputQueue(name="color", maxSize=4, blocking=False)
disparity_queue = device.getOutputQueue(name="disparity", maxSize=4, blocking=False)
while True:
cv2.imshow("color", color_queue.get().getCvFrame())
cv2.imshow("disparity", disparity_queue.get().getFrame())
if cv2.waitKey(1) == ord('q'):
break
will throw this error
Traceback (most recent call last):
File "Test.py", line 47, in <module>
cv2.imshow("disparity", disparity_queue.get().getFrame())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: ImgFrame doesn't have enough data to encode specified frame, required 4147200, actual 2073600. Maybe metadataOnly transfer was made?
It seems getFrame() expects twice the amount of data it needs for a full frame.
Before the upgrade, the code ran fine. Not aligning the depth map to the color image or disabling the decimation filter will "resolve" the error, but I need to do both. How can I achieve that?
Thank you in advance for any help!
Cheers,
Tim