Hello dear community, I recently bought a jetson orin nano. I try to open the csi camera that comes with but there is an error. I try NoIR camera, and rpi v1.3 camera and still cannot open the camera.
Here is my code:
#!/usr/bin/env python
# encoding: utf-8
import cv2 as cv
import time
capture = cv.VideoCapture("nvarguscamerasrc ! video/x-raw(memory:NVMM), width=1280, height=720, format=(string)NV12, framerate=(fraction)60/1 ! nvvidconv flip-method=0 ! video/x-raw, width=1280, height=720, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink", cv.CAP_GSTREAMER)
print ("capture get FPS : ",capture.get(cv.CAP_PROP_FPS))
while capture.isOpened():
start = time.time()
ret, frame = capture.read()
if cv.waitKey(1) & 0xFF == ord('q'): break
end = time.time()
fps = 1 / (end - start)
text="FPS : "+str(int(fps))
cv.putText(frame, text, (20, 30), cv.FONT_HERSHEY_SIMPLEX, 0.9, (0, 0, 255), 1)
cv.imshow('frame', frame)
capture.release()
cv.destroyAllWindows()
and here is the error I got:
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:751 No cameras available
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
capture get FPS : 60.0
Traceback (most recent call last):
File "test_camera_csi.py", line 17, in <module>
cv.imshow('frame', frame)
cv2.error: OpenCV(4.2.0) ../modules/highgui/src/window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'
I am not sure if I have to install a driver for this camera. I ask for your help. Many thanks in advance.