opencv error, displaying CSI camera

I’m using opencv version 4.1.1
The camera is imx 219

The problem is camera display doesn’t show up.

Here is the python code:

import cv2

print(cv2.version)

dispW=640
dispH=480
flip=2
camSet=‘nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=’+str(flip)+’ ! video/x-raw, width=’+str(dispW)+’, height=’+str(dispH)+’, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink’
cam = cv2.VideoCapture(camSet)
while True:
ret,frame=cam.read()
cv2.imshow(‘piCam’, frame)
if cv2.waitKey(1)==ord(‘q’):
break

cam.release()
cv2.destroyAllWindows()

And here is the result

Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:532 No cameras available
[ 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/baam/Desktop/pypro/openCV/opencv2.py”, line 12, in
cv2.imshow(‘piCam’, 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’

I tried tucking the CSI camera in the right spot serveral times.
I’m concerning whether my camera is dud.

hello qkr4qja5tjr6,

had you confirm sensor streaming works with standard gstreamer pipeline?

$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1, format=NV12' ! nvoverlaysink -ev

kevin@nano:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! ‘video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1, format=NV12’ ! nvoverlaysink -ev
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstNvOverlaySink-nvoverlaysink:nvoverlaysink-nvoverlaysink0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1
(Argus) Error Timeout: (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 215)
(Argus) Error Timeout: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:526 Failed to create CameraProvider
Got EOS from element “pipeline0”.
Execution ended after 0:01:00.068292578
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

and after two hours I still can’t say my new camera works…

hello kangusz1fss,

it seems your sensor streaming working for one minutes,
did you force stop the camera sensor? could you please check the kernel message which might caused below timeout errors.

(Argus) Error Timeout: (propagating from src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 215)
(Argus) Error Timeout: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:526 Failed to create CameraProvider
Got EOS from element "pipeline0".
Execution ended after 0:01:00.068292578

please contact with your sensor vendors if there’s stability issue about the sensor streaming,
thanks

I moved the camera to a Raspberry PI and tried, it is/was a new camera and I’d never tried it before. Seems the Seeed Studio Raspberry PI V2 8 megapixle camera is defective. When I moved the camera to the PI I disconnected the camera from the cable at the camera head so I didn’t have to disassemble the Nano case again, after finding the issue I disassembled the Nano case and discovered the left corner of the connector on the Nano is missing. I have no idea what happen to it but when working on ‘stuff’ with very small parts I use a bin under the ‘stuff’ to catch anything I drop, saves me a lot of time crawling around with a magnet, there was nothing from the corner that fell out so it has been missing for awhile I guess, I didn’t notice it when I installed the cable.
You wouldn’t happen to have the part number of the connector handy or a link to the BOM?
Thanks

Hi guys!
I solved the problem.
The CSI camera was a dud.
So I got new onee which works correctly.
If anyone has same problem with me, your camera might not be recognized on your jetson nano board.

I ‘spoke’ with Amazon and they ‘forwarded’ me to Seeed so it will be awhile and of course they will ask for ‘pictures and video’ meanwhile I ordered a new Jetson Nano (from Nvidia) and camera. I can’t find the BOM for the ‘old’ Jetson Nano carrier.