Hi @ramkunchur so, a simple way to do fullscreen mode while also maintaining desired resolution is using this -
#!/usr/bin/env python3
import cv2
import depthai as dai
# Start defining a pipeline
pipeline = dai.Pipeline()
# Define a source - color camera
camRgb = pipeline.createColorCamera()
camRgb.setPreviewSize(192, 108)
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setInterleaved(False)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
# Create output
xoutRgb = pipeline.createXLinkOut()
xoutRgb.setStreamName("rgb")
camRgb.preview.link(xoutRgb.input)
# Pipeline is defined, now we can connect to the device
with dai.Device(pipeline) as device:
# Start pipeline
device.startPipeline()
# Output queue will be used to get the rgb frames from the output defined above
qRgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=False)
while True:
inRgb = qRgb.get() # blocking call, will wait until a new data has arrived
# Retrieve 'bgr' (opencv format) frame
cv2.namedWindow("bgr", cv2.WND_PROP_FULLSCREEN)
cv2.setWindowProperty("bgr",cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
cv2.imshow("bgr", cv2.resize(inRgb.getCvFrame(), (1920, 1080)))
if cv2.waitKey(1) == ord('q'):
break
So here you can set the desired resolution input for the image frame using setPreviewsize, but ofcourse when you go fullscreen, you need to take into account that the output resolution might look low taking into account the input res. So, set a value for the output resolution based on your screen resolution from here -
cv2.imshow("bgr", cv2.resize(inRgb.getCvFrame(), (1920, 1080)))
and this will make the output go fullscreen.