You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating System / Platform => Ubuntu 16.04 Linux 4 Tegra 24.2.1 aarch64 / Jetson TX1
Compiler => g++ 5.4.0
Detailed description
VideoCapture(string) constructor using a gstreamer pipeline string fails to open a stream, even though the stream can be launched with the same pipeline using gst-launch-1.0. Note that the VideoCapture(int) constructor succeeds at opening a stream with VideoCapture(0) -- although for me, the feed is blank because i currently have no usb camera connected to the tx1.
Steps to reproduce
Flash TX1 with Jetpack 2.3.1.
Build opencv 3.1.0 from source using the instructions found here.
Add the following code to a cpp file named test.cpp
#include"highgui.hpp"
#include"videoio.hpp"
#include"imgproc.hpp"
#include<iostream>
#include<string.h>usingnamespacecv;usingnamespacestd;intmain(int argc, char** argv)
{
string gst_pipe = "videotestsrc ! videoconvert ! appsink";
VideoCapture cap(gst_pipe);
if (!cap.isOpened())
{
std::cout << "Failed to open camera." << endl;
return -1;
}
for(;;)
{
Mat frame;
cap >> frame;
imshow("original", frame);
waitKey(1);
}
cap.release();
}
I have finally alleviated this issue for my setup. It turned out to be a conflict between my OpenCV built from source and one installed by ROS.
The ros-kinetic-opencv3 package had been installed on my system as a dependency of another package I was using for my project. In turn, ROS ended up using the files built from that package when linking rather than the ones I built that specified GStreamer support with the -DWITH_GSTREAMER=ON flag. This caused the stream to fail to open in my program because it wasn't interpreting the string as a GStreamer pipe.
The solution was to manually build the ROS packages I needed (vision_opencv) from source, and specify in the makefile to link the OpenCV I built.
I can't say for certain that this is the same issue @iandreariley had, but given our very similar setups it may very well be.
System information (version)
Detailed description
VideoCapture(string) constructor using a gstreamer pipeline string fails to open a stream, even though the stream can be launched with the same pipeline using gst-launch-1.0. Note that the VideoCapture(int) constructor succeeds at opening a stream with VideoCapture(0) -- although for me, the feed is blank because i currently have no usb camera connected to the tx1.
Steps to reproduce
Flash TX1 with Jetpack 2.3.1.
Build opencv 3.1.0 from source using the instructions found here.
Add the following code to a cpp file named test.cpp
Build it with
g++ -o test -I /usr/include/opencv2 -Wall test.cpp -L/usr/lib -l:libopencv_core.so.3.1.0 -l:libopencv_videoio.so.3.1.0 -l:libopencv_imgproc.so.3.1.0 -l:libopencv_highgui.so.3.1.0
Run the resulting executable with
./test
. Note that no stream is opened, and "Failed to open camera." is printed to the console.The text was updated successfully, but these errors were encountered: