I'm testing an IMX582 connected to an OAK-FFC-4P. It is the only connected camera and it's connected in slot A. The setup works fine using cam_test.py at the full resolution of 32MP afforded by the camera.
The problem comes when I try using my "triggering" code
#!/usr/local/bin/python3
import numpy as np # numpy - manipulate the packet data returned by depthai
import cv2 # opencv - display the video stream
import depthai # depthai - access the camera and its data packets
import time
pipeline = depthai.Pipeline()
cam_rgb = pipeline.create(depthai.node.ColorCamera)
cam_rgb.setPreviewSize(300, 300)
cam_rgb.setInterleaved(False)
cam_rgb.setBoardSocket(depthai.CameraBoardSocket.CAM_A) # Same as CameraBoardSocket.RGB
cam_rgb.setResolution(depthai.ColorCameraProperties.SensorResolution.THE_5312X6000)
# cam_rgb.setResolution(depthai.ColorCameraProperties.SensorResolution.THE_4000X3000)
cam_rgb.initialControl.setAutoFocusMode(depthai.RawCameraControl.AutoFocusMode.CONTINUOUS_VIDEO)
cam_rgb.initialControl.setAutoFocusTrigger()
xout_rgb = pipeline.create(depthai.node.XLinkOut)
xout_rgb.setStreamName("rgb")
cam_rgb.still.link(xout_rgb.input)
trigger_in = pipeline.create(depthai.node.XLinkIn)
trigger_in.setNumFrames(1)
trigger_in.setStreamName("trigger")
trigger_in.out.link(cam_rgb.inputControl)
with depthai.Device(pipeline) as device:
q_rgb = device.getOutputQueue("rgb", maxSize=1)
q_trigg = device.getInputQueue("trigger", maxSize=1)
while True:
x = input("Do trigger?")
start = time.time()
ctrl = depthai.CameraControl()
ctrl.setCaptureStill(True)
q_trigg.send(ctrl)
print(f"Sent trigger request at {time.time() - start} seconds")
in_rgb = q_rgb.get()
if in_rgb is not None:
frame = in_rgb.getCvFrame()
print(f"Got frame back at {time.time() - start} seconds")
cv2.imwrite("/code/tmp/im.png", frame)
This code works as expected at the 4K resolution but not when setting the resolution to 5312X6000. I get
[2024-09-09 14:43:18.629] [depthai] [warning] [14442C10E134C8D600] [3.4] Flashed bootloader version 0.0.26, less than 0.0.28 is susceptible to bootup/restart failure. Upgrading is advised, flashing main/factory (not user) bootloader. Available: 0.0.28
Traceback (most recent call last):
File "/code/trigger.py", line 30, in <module>
with depthai.Device(pipeline) as device:
RuntimeError: ColorCamera(0) - Out of memory while creating pool for 'still' frames. Number of frames: 4 each with size: 47808000B
I understand that the device has limited ram and there's only so many frames that can be clunking around in there. For my application I only really need one or two at most to stay in the buffer. I looked for a few ways to reduce this number by using setNumFrames on my trigger_in node and trying to set queue sizes but none of it seemed to help.
Can anything be done here?