Ask Your Question

iandreariley's profile - activity

2017-01-12 15:19:23 -0500 asked a question OpenCV 3.1 VideoCapture fails to open gstreamer pipe on Tegra

Brief: I've tried to get the following code snippet to open a video stream on an Nvidia TX1 running Ubuntu 16.04, L4T 24.2.1 and opencv 3.1 (which I built from source), but have not been able to do so. Details follow.

#include "highgui.hpp"
#include "videoio.hpp"
#include "imgproc.hpp"
#include <iostream>
#include <string.h>

using namespace cv;
using namespace std;

int main(int argc, char** argv)
  string gst_pipe = "fakesrc silent=false num-buffers=3 ! fakesink silent=false";
  VideoCapture cap(gst_pipe);

  if (!cap.isOpened())
      std::cout << "Failed to open camera." << endl;
      return -1;

      Mat frame;
      cap >> frame;
      imshow("original", frame);


Detail: The gstreamer pipe (which is a basic test pipeline) does work with gst-launch-1.0, however, the VideoCapture(String) constructor cannot open a stream to it. It's also worth noting that when I built opencv 3.1 from source, about a third of the tests failed, including opencv core and videoio. However, opencv says in its install page for Tegra that several of the tests fail on CUDA architecture without further detail, so I figure it may not be a big deal.

Any help is appreciated. Thanks.