Not sure as I’m unable to reproduce your case (I don’t have a Nano and just tried using AGX Orin and Xavier NX running JP5):
import cv2
cap = cv2.VideoCapture("nvarguscamerasrc ! "
"video/x-raw(memory:NVMM), width=(int)3840, height=(int)2160, format=(string)NV12, framerate=(fraction)21/1 ! "
"nvvidconv ! video/x-raw, format=(string)BGRx, width=1280, height=1280 ! "
"videoconvert ! video/x-raw, format=(string)BGR ! "
"queue ! appsink drop=1", cv2.CAP_GSTREAMER)
if not cap.isOpened():
print('failed to open video capture')
exit(-1)
while True:
ret_val, img = cap.read();
if not ret_val:
break
cv2.imshow('Test', img)
if cv2.waitKey(1) == ord('q'):
break
cap.release()
You may try to narrow down if this is related to your camera/driver, gstreamer or opencv version with its gui-backend.
Assuming you have a local display on Jetson with X GUI, does this work ?
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),format=NV12,width=3840,height=2160,framerate=21/1' ! nvvidconv ! queue ! xvimagesink
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),format=NV12,width=3840,height=2160,framerate=21/1' ! nvvidconv ! 'video/x-raw,width=1280,height=1280,pixel-aspect-ratio=1/1' ! queue ! xvimagesink
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),format=NV12,width=3840,height=2160,framerate=21/1' ! nvvidconv ! 'video/x-raw,format=BGRx,width=1280,height=1280,pixel-aspect-ratio=1/1' ! videoconvert ! queue ! xvimagesink
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),format=NV12,width=3840,height=2160,framerate=21/1' ! nvvidconv ! 'video/x-raw,format=BGRx,width=1280,height=1280,pixel-aspect-ratio=1/1' ! videoconvert ! video/x-raw,format=BGR ! videoconvert ! queue ! xvimagesink
If these work, then your issue is in opencv build or its gui backend.