Installing OpenCV videoio library and build from source failed

Using Ubuntu and Jetpack 3 and the TK1 along with the OV5640 camera, I am developing a machine vision project. From /home/ubuntu/OpenCV4Tegra I ran the shell script to install OpenCV4Tegra.
I have linked up necessary libraries and build paths in Nsight and whatever OpenCV libraries I have work on the machine. I need to use cv::VideoCapture along with gstreamer to capture images and process them. I already have built my gstreamer pipeline and gotten it working.

I have already tried the following:

  1. following this link - https://elinux.org/Jetson/Installing_OpenCV but option 1 (using prebuilt libraries) does not work. running
sudo dpkg -i libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb

returns no such file or directory.
2. Building from source from both the elinux site and from the openCV documentation. I git cloned both the openCV source files and the OpenCV_contrib repository, then I updated cmake to the latest version and everytime I try to run Cmake with the any sort of flags and options I get the same error message.

Build output check failed:
    Regex: 'command line option .* is valid for .* but not for C\+\+'

I am out of ideas and I need this to be working as soon as possible. All I need is the videoio .so library installed correctly but I am not sure how to do that without completely installing openCV from source. If there is a way to just link that library please let me know. Otherwise I need to get OpenCV built from source on this machine.
Thanks

I should point out that this all started because I tried to run this code written in Nsight

VideoCapture cap(gst_pipeline, CAP_GSTREAMER); // open the pipeline
    // View video
    *cv::Mat frame;
    while (1) {
        cap >> frame;  // Get a new frame from camera

        // Display frame
        imshow("Display window", frame);
        cv::waitKey(1); //needed to show frame
    }

and I got this error:

../src/test.cu(110): error: identifier "CAP_GSTREAMER" is undefined

../src/test.cu(110): error: no instance of constructor "cv::VideoCapture::VideoCapture" matches the argument list
            argument types are: (const std::string, <error-type>)

So if OpenCV4Tegra is not the problem then maybe I did something wrong here but from what I saw on the OpenCV documentation the CAP_GSTREAMER is enumerated in the

videoio.hpp

file

Hi,

Do you install opencv4tegra with JetPack installer?
It looks like you want to build it from source.

Could you try to reflash the system and install the OpenCV package from JetPack?
[url]https://developer.nvidia.com/embedded/jetpack-2_3_1[/url]

Thanks.

I had initially installed OpenCV4Tegra with the JetPack installer only to realize that the videio library is missing from the installation. I need the videio library for my application which is why I was trying to build from source

As far as I remember OpenCV4Tegra hadn’t gstreamer support, so you would have to build and install your own version. I’d suggest to use at least a 3.2 version so that you get some carotene optimizations…
I haven’t tried opencv4 on TK1, but if you want to give it a try be aware that since opencv4 CUDA stuff is now in opencv_contrib.

For the compilation error, with opencv-2.4 it might be CV_CAP_GSTREAMER, but not included in Opencv4tegra. Since opencv3, you may try to use cv namespace instead: cv::CAP_GSTREAMER. That being said, you don’t need to specify this, it should automatically detect a gstreamer pipeline.

You may also face some issues if you keep the opencv4tegra install. You may check this topic if you want to keep it.