NVIDIA Jetson TK1 – Install OpenCV – [L4T 21.1]

This is just a short note on how to install OpenCV on the Jetson under Linux for Tegra (L4T) 21.1.

Before the installation, you must install Linux for Tegra (L4T) 21.1 and CUDA 6.5 on the Jetson.

Looky here:

There’s also a shell file available:

Enjoy!

15 Comments

  1. Hi, I have installed the L4T 21.1 as you did. Also I installed the Opencv following your steps. But I’m getting errors trying to compile a program.

    /usr/bin/ld: cannot find -lopencv_nonfree
    collect2: error: ld returned 1 exit status
    ubuntu@tegra-ubuntu:~/Downloads$

    Does it comes with the lopencv_nonfree library? Do you know how to install it?

    Thanks in advance.

    • The NVIDIA Jetson does not officially support the lopencv_nonfree library, which means that algorithms such SIFT and SORT are not available without building them yourself.

  2. Hi, I’m having troubles with the lopencv_nonfree library in L4T R21.1. I can’t compile some programs. Do you know how to solve it? Thanks in advance.

    • The NVIDIA Jetson does not officially support the lopencv_nonfree library, which means that algorithms such SIFT and SORT are not available without building them yourself.

      • I might be missing something, but I’m trying to compile OpenCV following the guidelines from the http://elinux.org/Jetson/Installing_OpenCV. However I’m getting the following error.

        .
        .
        .
        [ 75%] Building CXX object apps/traincascade/CMakeFiles/opencv_traincascade.dir/imagestorage.cpp.o
        Linking CXX executable ../../bin/opencv_traincascade
        [ 75%] Built target opencv_traincascade
        make[1]: *** [modules/gpu/CMakeFiles/opencv_gpu.dir/all] Error 2
        make: *** [all] Error 2
        ubuntu@tegra-ubuntu:~/opencv-2.4.9/build$

        In both L4T 21.1 and L4T 21.2 I’m getting the same error. However in L4T 21.2 the error appears around at 85%. I’m compiling the library because I’m using some libraries that are not prebuilt version.

        Any help will be highly appreciated.

        Thank you beforehand folk!

  3. Hey I was wondering if your opencv installation resulted in opengl related functions in opencv to actually work? When I tested for opengl in the samples it came up as “BUILT WITHOUT OPENGL”.

    How do I build this module without wasting an hour reinstalling the whole library?

  4. I have not tried OpenCV in those circumstances. Typically I don’t use the OpenGL related functions as I tend to separate out those functions into my own render loops. Sorry I can’t be of more help.

  5. I have successfully built OpenCV 3.1.0 natively on the Jetson TK1.
    However I ran into difficulty compiling some sample apps.
    I have both OpenCV4Tegra and 3.1.0 installed on my system.
    I have used the the following to compiles but it produces
    undefined reference(s). Please see below.

    #sudo g++ -ggdb `pkg-config –cflags opencv –libs /home/ubuntu/Downloads/opencv-3.1.0/build/unix-install/opencv.pc` edge.cpp -o edge

    #sudo g++ -ggdb `pkg-config –cflags opencv –libs /usr/local/lib/pkgconfig/opencv.pc` edge.cpp -o edge

    #sudo g++ -ggdb `pkg-config –cflags –libs opencv` edge.cpp -o edge

    #sudo g++ edge.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -o edge

    /tmp/ccWPGbXn.o: In function `onTrackbar’:
    /home/ubuntu/Downloads/opencv-3.1.0/samples/cpp/edge.cpp:17: undefined reference to `cv::blur(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_, cv::Point_, int)’
    /home/ubuntu/Downloads/opencv-3.1.0/samples/cpp/edge.cpp:20: undefined reference to `cv::Canny(cv::_InputArray const&, cv::_OutputArray const&, double, double, int, bool)’
    /home/ubuntu/Downloads/opencv-3.1.0/samples/cpp/edge.cpp:21: undefined reference to `cv::Mat::operator=(cv::Scalar_ const&)’

    Any suggestions would be appreciated.

    Thanks
    Steve Lee

    • Hi Steve,
      Not quite sure what to tell you, it’s hard to tell what’s wrong with this information. I’m assuming that it’s a linker issue from what you’re describing. More than likely it’s looking in the wrong place for the 3.1 library, you’ll have to figure out how to point it to the right place. You can probably get more help for this question in the Jetson TK1 forum:

      https://devtalk.nvidia.com/default/board/162/jetson-tk1/

      Sorry I’m not much help on this, but thanks for reading!

  6. I downloaded the .deb file and this the error it shows later

    ubuntu@tegra-ubuntu:~$ sudo dpkg -i libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb
    [sudo] password for ubuntu:
    Selecting previously unselected package libopencv4tegra-repo.
    (Reading database … 147746 files and directories currently installed.)
    Preparing to unpack libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb …
    Unpacking libopencv4tegra-repo (2.4.10.1) …
    dpkg-deb (subprocess): cannot copy archive member from ‘libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb’ to decompressor pipe: unexpected end of file or stream
    dpkg-deb: error: subprocess paste returned error exit status 2
    dpkg: error processing archive libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb (–install):
    cannot copy extracted data for ‘./var/opencv4tegra-repo/libopencv4tegra_2.4.10.1_armhf.deb’ to ‘/var/opencv4tegra-repo/libopencv4tegra_2.4.10.1_armhf.deb.dpkg-new’: unexpected end of file or stream
    Errors were encountered while processing:
    libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb

    • It looks like your download was corrupted:
      dpkg-deb (subprocess): cannot copy archive member from ‘libopencv4tegra-repo_l4t-r21_2.4.10.1_armhf.deb’ to decompressor pipe: unexpected end of file or stream

Leave a Reply

Your email address will not be published.


*