hi @erik ,
i had some testing and this is how far i have gotten sofar with getting multiple cameras connected with sync. Sadly it hasnt been far as im yet to understand how the getTimestamp
has to be implemented for each camera to know the precise time...
import cv2
import depthai as dai
import contextlib
# Start defining a pipeline
pipeline = dai.Pipeline()
cam_list = ['left', 'rgb', 'right']
cam_socket_opts = {
'rgb' : dai.CameraBoardSocket.RGB,
'left' : dai.CameraBoardSocket.LEFT,
'right': dai.CameraBoardSocket.RIGHT,
}
cam_instance = {
'rgb' : 0,
'left' : 1,
'right': 2,
}
cam = {}
xout = {}
for c in cam_list:
xout[c] = pipeline.createXLinkOut()
xout[c].setStreamName(c)
if c == 'rgb':
cam[c] = pipeline.createColorCamera()
cam[c].setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
cam[c].setIspScale(720, 1080) # 1920x1080 -> 1280x720
cam[c].isp.link(xout[c].input)
else:
cam[c] = pipeline.createMonoCamera()
cam[c].setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P)
cam[c].out.link(xout[c].input)
cam[c].setBoardSocket(cam_socket_opts[c])
cam[c].setFps(30)
# https://docs.python.org/3/library/contextlib.html#contextlib.ExitStack
with contextlib.ExitStack() as stack:
for device_info in dai.Device.getAllAvailableDevices():
device = stack.enter_context(dai.Device(pipeline, device_info))
print("Conected to " + device_info.getMxId())
while True:
if cv2.waitKey(1) == ord('q'):
break