Hello everyone, I am having a problem and I would appreciate if you could help me.
I have two modules IXM378 connected to an OAK-FFC-4P module, I want to see on screen only one of the cameras at a time, therefore, when I press the space bar I make a switch to the opposite camera. The problem is that, when I make a switch it shows me 9 frames of the previous moment in which I was using the current camera, instead of showing me directly the current moment, and that there is a fluid transition between both videos. Here is a graphical example to make it clear:

What I find strange is that the buffer is configured with a queue size of 1 frame, that is, all the time the buffer is being updated with the last frame (current moment), so I don't understand where that additional 9 frames from a past moment come from.
Here is the code I am using:
import cv2
import depthai as dai
import numpy as np
def getFrame(queue):
# Get frame from queue
frame = queue.get()
# Convert frame to OpenCV format and return
return frame.getCvFrame()
if __name__ == '__main__':
fps = 3
current_state = "Framecam1a"
# Define a pipeline
pipeline = dai.Pipeline()
device = dai.Device()
# DEFINE SOURCES AND OUTPUTS
cam1a = pipeline.create(dai.node.ColorCamera)
cam1b = pipeline.create(dai.node.ColorCamera)
cam1a.setBoardSocket(dai.CameraBoardSocket.CAM_A) # 4-lane MIPI IMX378
cam1b.setBoardSocket(dai.CameraBoardSocket.CAM_D) # 4-lane MIPI IMX378
cam1a.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
cam1b.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
cam1a.setFps(fps)
cam1b.setFps(fps)
# Set output Xlink
outcam1a = pipeline.create(dai.node.XLinkOut)
outcam1b = pipeline.create(dai.node.XLinkOut)
outcam1a.setStreamName("cam1a")
outcam1b.setStreamName("cam1b")
# LINKING
cam1a.isp.link(outcam1a.input)
cam1b.isp.link(outcam1b.input)
# Pipeline is defined, now we can connect to the device
with device:
device.startPipeline(pipeline)
# Get output queues.
cam1a = device.getOutputQueue(name="cam1a", maxSize=1)
cam1b = device.getOutputQueue(name="cam1b", maxSize=1)
while True:
# Acquire frames only for the current state
if current_state == "Framecam1a":
Frame = getFrame(cam1a)
else:
Frame = getFrame(cam1b)
# Display the current state in the window
cv2.imshow("Frame", Frame)
# Check for keyboard input
key = cv2.waitKey(1) & 0xFF
if key == ord(' '):
n=0
# Change the state
if current_state == "Framecam1a":
current_state = "Framecam1b"
else:
current_state = "Framecam1a"
if key == ord('q'):
break