Hello,
I have been experiencing difficulties for a few hours and am reaching out for your assistance. I am currently working with an OAK-D Pro AF camera. My objective is to capture an image from the RGB sensor at its maximum resolution (4056 x 3040 pixels).
I have been utilizing the following basic code:
from pathlib import Path
import cv2
import depthai as dai
import time
# Create pipeline
pipeline = dai . Pipeline ()
# Define source and output
camRgb = pipeline . create ( dai . node . ColorCamera )
xoutRgb = pipeline . create ( dai . node . XLinkOut )
xoutRgb . setStreamName ( "rgb" )
# Properties
camRgb . setResolution ( dai . ColorCameraProperties . SensorResolution . THE_12_MP )
camRgb . setPreviewSize ( 4056 , 3040 )
camRgb . setInterleaved ( False )
camRgb . setColorOrder ( dai . ColorCameraProperties . ColorOrder . RGB )
# Linking
camRgb . preview . link ( xoutRgb . input )
# Connect to device and start pipeline
with dai . Device ( pipeline ) as device :
# Output queue will be used to get the grayscale frames from the output defined above
qRight = device .getOutputQueue( name = "rgb" , maxSize = 4 , blocking = False )
dirName = "capturas"
Path ( dirName ). mkdir ( parents = True , exist_ok = True )
while True :
inRight = qRight .get() # Blocking call, will wait until a new data has arrived
# Data is originally represented as a flat 1D array, it needs to be converted into HxW form
# Frame is transformed and ready to be shown
cv2 . imshow ( "rgb" , inRight .getCvFrame())
# After showing the frame, it's being stored inside a target directory as a PNG image
cv2 . imwrite ( f " { dirName } / { int ( time . time () * 1000 ) } .png" , inRight .getCvFrame())
if cv2 . waitKey ( 1 ) == ord ( 'q' ):
break
However, I am encountering this error:
[1844301061389A0F00] [1.2] [0.919] [ColorCamera(0)] [critical] Output preview width 4056 can't be bigger than output video width 3840
F: [global] [ 0] [ThreadN] dispatcherResponseServe:928 no request for this response: XLINK_WRITE_RESP 1
The same issue arises when I attempt to use video mode, and the 'still' mode does not function either. Could you please advise on how I can successfully capture an image at the maximum resolution?
Thanks!