from depthai_sdk import OakCamera
from depthai_sdk.classes.packets import FramePacket
import depthai as dai
import cv2
def cb(packet: FramePacket):
# Save the frame to a file
frame = packet.frame
global n
cv2.imwrite(f'frame_{n}.jpg', frame)
n += 1
with OakCamera() as oak:
n = 0
color = oak.create_camera('color', resolution=dai.ColorCameraProperties.SensorResolution.THE_1080_P)
left = oak.create_camera('left')
right = oak.create_camera('right')
oak.visualize([color], fps=True, scale=2/3, callback=cb)
oak.start(blocking=True)