Hi erik and jakaskerl,
Thanks for your suggestions. I've tried using isp
instead but I still get slow fps, with no USB hub at all.
This is my test code (please check the first if-statement):
import datetime
import depthai as dai
pipeline = dai.Pipeline()
# Configure camera
cam_rgb = pipeline.createColorCamera()
cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
cam_rgb.setFps(30)
# Configure XLinkOut (to send data from device to host)
xout_rgb = pipeline.createXLinkOut()
xout_rgb.setStreamName('rgb')
if False:
# Script node
script = pipeline.create(dai.node.Script)
script.setScript('''
ctrl = CameraControl()
ctrl.setCaptureStill(True)
while True:
node.io['out'].send(ctrl)
''')
# Connections: Linking camera to XLink input, so that the frames will be sent to host
script.outputs['out'].link(cam_rgb.inputControl)
cam_rgb.still.link(xout_rgb.input)
else:
cam_rgb.isp.link(xout_rgb.input)
# Disable chunking for higher FPS (chunk size is for splitting device-sent XLink packets)
pipeline.setXLinkChunkSize(0)
with dai.Device(pipeline, maxUsbSpeed=dai.UsbSpeed.SUPER_PLUS) as device:
queue_rgb = device.getOutputQueue('rgb', maxSize=60, blocking=False)
tic = datetime.datetime.now()
while device.isPipelineRunning():
# Try to fetch data from queue. Returns either all data packets or None if there isn't any
queue_frames = queue_rgb.tryGetAll()
if len(queue_frames) > 0:
toc = datetime.datetime.now()
dt = (toc - tic)
fps = len(queue_frames) / dt.total_seconds()
print(f'Received {len(queue_frames)} frames in {str(dt)} --> Rate: {fps:.2f} fps')
tic = toc
This is the output:
Received 2 frames in 0:00:00.309474 --> Rate: 6.46 fps
Received 2 frames in 0:00:00.102032 --> Rate: 19.60 fps
Received 3 frames in 0:00:00.163704 --> Rate: 18.33 fps
Received 2 frames in 0:00:00.126305 --> Rate: 15.83 fps
Received 2 frames in 0:00:00.126683 --> Rate: 15.79 fps
Received 3 frames in 0:00:00.163115 --> Rate: 18.39 fps
Received 2 frames in 0:00:00.101160 --> Rate: 19.77 fps
Received 2 frames in 0:00:00.100358 --> Rate: 19.93 fps
Received 2 frames in 0:00:00.106135 --> Rate: 18.84 fps
Received 3 frames in 0:00:00.145875 --> Rate: 20.57 fps
Received 3 frames in 0:00:00.151619 --> Rate: 19.79 fps
Received 1 frames in 0:00:00.053159 --> Rate: 18.81 fps
Received 3 frames in 0:00:00.151166 --> Rate: 19.85 fps
Received 3 frames in 0:00:00.151327 --> Rate: 19.82 fps
Received 2 frames in 0:00:00.101480 --> Rate: 19.71 fps
Received 2 frames in 0:00:00.114627 --> Rate: 17.45 fps
...
As per Jaka's output, he receives Received 1 frames
in every print, but I get not only 1 but a few as well. May that have anything to do with this issue?