Hello everyone, I am currently using the OAK-D Pro, working on a project in my company where I need to have at least two streams, one for depth and the other for RGB preview, and since the monitor displaying the preview is 4K, ideally, I need to have the stream in 4K at 30/28 fps. I am still in the testing phase, trying to improve the latency of the stream. This is my minimal code so far:
import cv2
import depthai as dai
with dai.Pipeline() as pipeline:
pipeline.setXLinkChunkSize(0)
cam = pipeline.create(dai.node.Camera).build()
output = cam.requestOutput((3840, 2160), dai.ImgFrame.Type.NV12, fps=30)
videoQueue = output.createOutputQueue()
benchmarkIn = pipeline.create(dai.node.BenchmarkIn)
benchmarkIn.setRunOnHost(False)
benchmarkIn.sendReportEveryNMessages(50)
benchmarkIn.setLogLevel(dai.LogLevel.TRACE)
output.link(benchmarkIn.input)
outputQueue = benchmarkIn.report.createOutputQueue()
pipeline.start()
while pipeline.isRunning():
videoIn = videoQueue.get()
assert isinstance(videoIn, dai.ImgFrame)
cv2.imshow("video", videoIn.getCvFrame())
if cv2.waitKey(1) == ord('q'):
break
pipeline.setXLinkChunkSize(0) improved the performance drastically. Looking at the benchmark report, I am at roughly 28fps, 100ms of latency and while I'm satisfied with the framerate, I would like to optimize the latency down to 50ms, if possible. How can this be done? I have read up on the VideoEncoder node, but I haven't found a way to feed the frames into OpenCV.
I would highly appreciate any help!