I've come across a bug in depthai 2.23.0.0. Function getProfilingData() wraps its count of number of bytes read and written at 2^32 (eg MAX_VAL of uint32). This seems to imply that it is kept as such under the hood in c++ and that is insufficient because it gets exceeded by streaming 1980p video in only a few seconds which is imho reasonable load.
Simple testing program which exceeds this limit in just a few secs is provided below:
import cv2
import depthai as dai
import blobconverter # blobconverter - compile and download MyriadX neural network blobs
# Closer-in minimum depth, disparity range is doubled (from 95 to 190):
extended_disparity = False
# Better accuracy for longer distance, fractional disparity 32-levels:
subpixel = False
# Better handling for occlusions:
lr_check = True
pipeline = dai.Pipeline()
cam_rgb = pipeline.create(dai.node.ColorCamera)
cam_rgb.setPreviewSize(1920, 1080)
cam_rgb.setInterleaved(False)
monoLeft = pipeline.create(dai.node.MonoCamera)
monoRight = pipeline.create(dai.node.MonoCamera)
depth = pipeline.create(dai.node.StereoDepth)
xout = pipeline.create(dai.node.XLinkOut)
xout.setStreamName("stereo")
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoLeft.setCamera("left")
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoRight.setCamera("right")
# Create a node that will produce the depth map (using disparity output as it's easier to visualize depth this way)
depth.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)
# Options: MEDIAN_OFF, KERNEL_3x3, KERNEL_5x5, KERNEL_7x7 (default)
depth.initialConfig.setMedianFilter(dai.MedianFilter.KERNEL_7x7)
depth.setLeftRightCheck(lr_check)
depth.setExtendedDisparity(extended_disparity)
depth.setSubpixel(subpixel)
# Linking
monoLeft.out.link(depth.left)
monoRight.out.link(depth.right)
depth.disparity.link(xout.input)
xout_rgb = pipeline.create(dai.node.XLinkOut)
xout_rgb.setStreamName("rgb")
cam_rgb.preview.link(xout_rgb.input)
with dai.Device(pipeline) as device:
q_rgb = device.getOutputQueue("rgb")
q_stereo = device.getOutputQueue("stereo")
frame = None
stereo = None
prev_read = 0
prev_written = 0
while True:
in_rgb = q_rgb.tryGet()
in_stereo = q_stereo.tryGet()
if in_rgb is not None:
frame = in_rgb.getCvFrame()
if in_stereo is not None:
stereo = in_stereo.getCvFrame()
if frame is not None:
cv2.imshow("preview", frame)
cv2.imshow("disparity", stereo)
if cv2.waitKey(1) == ord('q'):
break
if hasattr(device, "getProfilingData"):
xlink_stats = device.getProfilingData()
print(f"{xlink_stats.numBytesWritten=}, {xlink_stats.numBytesRead=}")
if prev_read > xlink_stats.numBytesRead or prev_written > xlink_stats.numBytesWritten:
break
prev_read = xlink_stats.numBytesRead
prev_written = xlink_stats.numBytesWritten
I've come across a bug in depthai 2.23.0.0. Function getProfilingData() wraps its count of number of bytes read and written at 2^32 (eg MAX_VAL of uint32). This seems to imply that it is kept as such under the hood in c++ and that is insufficient because it gets exceeded by streaming 1980p video in only a few seconds which is imho reasonable load. Simple testing program which exceeds this limit in just a few secs is provided below: