Hi all,
I am using a IMX390-GMSL2 camera with Xavier NX based embedded device. By using the below terminal command, I am able to launch gstreamer display of the camera output successfully.
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12' ! nvvidconv ! xvimagesink
Now, I want to launch the same display using OpenCV for which I was the below script:
import cv2
import sys
gst_str = ("nvarguscamerasrc sensor-id=0 ! video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12 ! nvvidconv ! xvimagesink")
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
if not cap.isOpened():
print('Failed to open camera!')
sys.exit()
while(True):
_, img = cap.read() # grab the next image frame from camera
cv2.imshow("cam", img)
key = cv2.waitKey(10)
The output I get is “Failed to open camera!”. Can someone suggest the changes which could make it work ?
Thanks!