If I try to access the camera(s) attached to the CSI port, i get the message that no camera are available.
here is my pyton code:
import cv2
sensor=0
width = 800
height =600
camSet_str = ('nvarguscamerasrc sensor-id={} ! ’
'video/x-raw(memory:NVMM), width=1920, height=1080, framerate=60/1, format=NV12 ! ’
'nvvidconv flip-method=2 ! ’
'video/x-raw, width={}, height={}, format=BGRx ! ’
'videoconvert ! ’
'video/x-raw, format=BGR ! ’
‘appsink’).format(sensor,width,height)
cam=cv2.VideoCapture(camSet_str)
while True:
_, frame = cam.read()
cv2.imshow(‘myCam’, frame)
cv2.moveWindow(‘myCam’,0,0)
if cv2.waitKey(1)==ord(‘q’):
break
cam.release()
cv2.destroyAllWindows
and that is the error message I get:
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:645 No cameras available
(python3:8932): GStreamer-CRITICAL **: 11:50:19.843: gst_mini_object_set_qdata: assertion ‘object != NULL’ failed
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
Traceback (most recent call last):
File “/home/iguelkanat/Desktop/PyPro/OpenCV/PiCam.py”, line 19, in
cv2.imshow(‘myCam’, frame)
cv2.error: OpenCV(4.1.1) /home/nvidia/host/build_opencv/nv_opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘imshow’
the command: ls /dev/video* says that there is no such file or directory (only if I have attached a USB camera, I have /dev/video0 available)
Thx for the help