Hi,
I am triggering an OKA-D S2 PoE camera using FSYNC using an external trigger. As we know the color camera works on continuous mode only we need to mention a given FPS and also trigger the camera at the same FPS in order to get the RGB image as well.
I am able to get the RGB images but i see an issue with camera settings. For example, I am trying to use setManualExposure to fix the exposure value to a given value, however I feel as the camera gets triggered it sometimes resets the value to auto exposure. You get to see a blinking effect on each camera side. If i only use the RGB camera in continues mode using camRgb.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT) and make both the stereo camera's in snapshot mode by only using monoLeft.initialControl.setExternalTrigger(4,3) then i don't see the blinking effect in the stereo camera's but still see it in the RGB camera.
I have attached the screen recording of this issue below.
Also I feel this issue is similar to this reported issues I think. Below is my updated code as well for your reference
import depthai as dai
import cv2
import time
pipeline = dai.Pipeline()
camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
camRgb.setIspScale(2,3)
camRgb.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
camRgb.initialControl.setExternalTrigger(4,3)
camRgb.setFps(10)
xoutRgb = pipeline.create(dai.node.XLinkOut)
xoutRgb.setStreamName("color")
camRgb.isp.link(xoutRgb.input)
controlIn = pipeline.create(dai.node.XLinkIn)
controlIn.setStreamName('control')
controlIn.out.link(camRgb.inputControl)
monoLeft = pipeline.create(dai.node.MonoCamera)
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P)
monoLeft.setBoardSocket(dai.CameraBoardSocket.LEFT)
monoLeft.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
monoLeft.initialControl.setExternalTrigger(4,3)
xoutLeft = pipeline.create(dai.node.XLinkOut)
xoutLeft.setStreamName("left")
monoLeft.out.link(xoutLeft.input)
monoRight = pipeline.createMonoCamera()
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P)
monoRight.setBoardSocket(dai.CameraBoardSocket.RIGHT)
monoRight.initialControl.setFrameSyncMode(dai.CameraControl.FrameSyncMode.INPUT)
monoRight.initialControl.setExternalTrigger(4,3)
xoutRight = pipeline.create(dai.node.XLinkOut)
xoutRight.setStreamName("right")
monoRight.out.link(xoutRight.input)
i = 0
# Connect to device with pipeline
device_info = dai.DeviceInfo("192.168.220.10")
with dai.Device(pipeline, device_info) as device:
arr = ['left', 'right', 'color']
queues = {}
frames = {}
controlQueue = device.getInputQueue('control')
ctrl = dai.CameraControl()
#ctrl.AutoFocusMode(dai.CameraControl.AutoFocusMode.AUTO)
#ctrl.setAutoFocusRegion(100,1200,3500,700)
#ctrl.setAutoExposureRegion(2028,0,2028,3040)
#ctrl.setAutoFocusLensRange(100,125)
#ctrl.setManualExposure(10000, 200) #1500, 700
#ctrl.setContrast(8)
ctrl.setManualExposure(15000, 200) # 50 µs, gain 200
ctrl.setManualFocus(158)
#ctrl.setAutoWhiteBalanceMode(dai.CameraControl.AutoWhiteBalanceMode.OFF)
#ctrl.setManualWhiteBalance(4000)
controlQueue.send(ctrl)
for name in arr:
queues[name] = device.getOutputQueue(name)
print("Starting...")
while True:
i += 1
#print("No frames")
for name in arr:
if queues[name].has():
#print("Image Available")
img_frame = queues[name].get().getCvFrame()
frames[name]= img_frame
cv2.imwrite("C:/EMVS_Development_Camera_Scripts/OAK_IO_Triggering/images/"+str(name)+"_Image{}.bmp".format(i), img_frame)
for name, frame in frames.items():
cv2.imshow(name, frame)
#cv2.imwrite("C:/EMVS_Development_Camera_Scripts/OAK_IO_Triggering/images/"+str(name)+"_Image{}.bmp".format(i), frame)
key = cv2.waitKey(1)
if key == ord('q'):
break
Thanks,
Yishu