Problem with OPENCV4Tegra and USB camera

I am trying to use a USB camera (recognized as eMPIA Technology, Inc.) with tx1 board
Camera is recognized by statement
capture = cv2.VideoCapture(0)
However, capture.read() returns false and no frame is read from capture.

Any idea what is missing and how i can get this to work?

Thanks

Hi AliMohseni,

Thanks for reporting the issue, we are currently investigating the case and we’ll let you know when we have an update.
In the meantime, you can try using the TX1 camera module through gstreamer and/or the nvgstcapture-1.0 sample.
Try this simple pipeline to get camera preview in screen:
gst-launch-1.0 nvcamerasrc ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)I420, framerate=(fraction)30/1’ ! nvtee ! nvoverlaysink -e

Thanks

https://devtalk.nvidia.com/default/topic/913233/

Comment #4, he is saying that OpenCV4Tegra is built without gstreamer support. Any truth to this? I also tried using gstreamer to open the camera module in OpenCV, nothing happened. Using the command in the terminal works just fine, but not in OpenCV4Tegra.

Hi jbrown,

See comment#4 in https://devtalk.nvidia.com/default/topic/907780/jetson-tx1/-python-how-to-use-tx1-camera-with-opencv

You might need this recent OpenCV bug fix applied: https://github.com/Itseez/opencv/pull/5984

Thanks

Hi jbrown. That was the case when I tested with opencv4tegra version 2.4.12. Which version are you using? If you are using a custom built version of opencv then you can build it with gstreamer support.

To check whether your opencv version supports gstreamer, just run the following command:

ldd /path/to/libopencv_highgui.so | grep gst

A few gstreamer libraries should be listed down. If nothing is printed then your opencv does not support gstreamer.

@dilipkumar25 I used Jetpack to install OpenCV4tegra, not sure what version, but whatever version comes with the Jetpack install. I would prefer to use OpenCV4tegra, because it is optimized for the Jetson board. I guess I will have to wait until the next release of OpenCV4tegra or Jetpack.

@kayccc Okay, thanks! I haven’t done much with Github before, so I am not sure how to apply that fix to OpenCV4tegra.