Hi everyone,
I am using Jetson Nano Developer Kit (4GB) with a MindVision Gige Camera. By using the script provided by the camera industry (http://www.mindvision.com.cn/uploadfiles/SDK/linuxSDK_V2.1.0.30.tar.gz ), I can use the camera by “cv_grab.py” (camera is controlled by mvsdk.py).
However, I cannot use the camera directly from cv2:
$ python
>>import cv2
>>cam=cv2.VideoCapture(0)
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video0'.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
VIDEOIO ERROR: V4L: can't open camera by index 0
I googled for a while and tried this:
$ ls /dev/video*
ls: cannot access '/dev/video*': No such file or directory
Then, I tried to use the v4l2loopback by
$ sudo modprobe v4l2loopback
and I get
$ ls /dev/video*
/dev/video0
$ v4l2-ctl --list-devices
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video0
$ v4l2-ctl --list-devices --all
Dummy video device (0x0000) (platform:v4l2loopback-000):
/dev/video0
Driver Info (not using libv4l2):
Driver name : v4l2 loopback
Card type : Dummy video device (0x0000)
Bus info : platform:v4l2loopback-000
Driver version: 4.9.140
Capabilities : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x85208003
Video Capture
Video Output
Video Memory-to-Memory
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Priority: 0
Video input : 0 (loopback: ok)
Video output: 0 (loopback in)
Format Video Output:
Width/Height : 0/0
Pixel Format : 'BGR4'
Field : None
Bytes per Line : 0
Size Image : 0
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers : 8
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers : 8
User Controls
keep_format 0x0098f900 (bool) : default=0 value=0
sustain_framerate 0x0098f901 (bool) : default=0 value=0
timeout 0x0098f902 (int) : min=0 max=100000 step=1 default=0 value=0
timeout_image_io 0x0098f903 (bool) : default=0 value=0
I go back to cv2 in python and check whether it works or not:
$ python
>> import cv2
>> cam=cv2.VideoCapture(0)
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
VIDEOIO ERROR: V4L2: Could not obtain specifics of capture window.
VIDEOIO ERROR: V4L: can't open camera by index 0
The error messages are different but I still cannot use it.
Am I correct in adding the v4l2loopback for creating /dev/video0? If no, how should I match my Gige Camera with the Jetson Nano? (By using the “cv_grab.py” from camera company, I can eaily get the image from the camera)
Can anyone suggest how can my camera be “seen” and used by cv2?
Info:
Python: 3.6.9 (with virtualenv)
cv2: 4.1.1
Thank you in advance!!
Lester