Jetson Nano /dev/video0 no file after adding GigE Camera

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

The file “/dev/video0” would be generated by the driver itself (the file is not a real file, but is instead a driver pretending to be a file). This particular naming convention is for cameras on USB which use a “standard” (non-custom) driver. A USB device can self-describe, and then the driver which works with such a device can take ownership (that driver for USB is USB Video Class, or UVC). Since this is an ethernet camera this will not be the case unless udev performs some trickery to rename the camera.

What I’ll recommend is to investigate what Linux driver and software the camera wants. It would be quite common for the driver to already exist, but not be installed by default. If not, then you’ll need the driver pre-built for aarch64/arm64, or else the source code to build against the current kernel. If you find out which driver is used, then more help can be found here on how to compile and install the driver.

Thx for your reply! I have tried lsusb and my camera cannot be shown and I hence cannot set the rule in /etc/udev/rules.d . The camera is used and driven by the SDK file itself provided by the company (mvsdk.py). Is there any possible way to know what driver the camera needs to be ‘seen’ by the Jetson Nano?

Thxxx!

Isn’t your camera GigE (ethernet, not USB)? In that case it would never show up under lsusb since it is not USB. In the case of ethernet the device cannot self-report, it isn’t “plug-n-play” without something able to auto query and report (which ethernet does not do). The driver and setup would be entirely something from the manufacturer.

Does mvsdk.py really search for “/dev/video0”? If so, then it is probably incorrect since this is not a USB camera. If it really does search for this, then it is because there is a program provided by the camera manufacturer to load a custom driver and produce that naming convention. Do you have a detailed document from the manufacturer regarding installation and setup under Linux? If you have a URL to this it would be quite useful.

Thank you for your reply!

The mvsdk.py not search for /dev/video0 so it works nice. And it cause problem when I need to use cv2.VideoCapture() since it requires /dev/video0

The detailed documentation can be found in (http://www.mindvision.com.cn/uploadfiles/SDK/linuxSDK_V2.1.0.30.tar.gz ). Also, here is the development guide: http://www.mindvision.com.cn/uploadfiles/2018/07/201807311559455945.pdf.

Again, thank you for your kindly help.

I have not worked with “cv2.VideoCapture()”, so I don’t know what alternatives there are. However, it sounds like that particular function was designed for UVC class devices, but the device is not UVC (I have no idea if this matters or not…someone using Python on cameras would have to answer).

The install script is useful, and it verifies it is intended to work with a USB device. However, I can’t verify much. I see manufacturer ID 0x080b, and this is for “Cross Match Technologies”. The other ID is 0xf622, but I see no database entry for them so I cannot say who the manufacturer is. All I can say is that if the device is found on USB, then it will create an entry in “/dev” with the name “mvusb_dev”. This will not occur for an ethernet device.

Other software might create the same device file, but the USB rules won’t work for a non-USB camera, so what do you see from:
find /dev -name 'mvusb*'

If this is found, then perhaps “cv2.VideoCapture()” has an option to set the device to the above mvusb_dev device (which only works if the file exists).

Incidentally, if there is software to run which works with the camera and produces the correct device special file, then you’d have to make sure that program is running. There are some tools associated with that software install, and I have no idea what they do, but it is logical to suspect that one of those tools is for detecting the ethernet camera and setting it up.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.