I installed JetPackTK1-1.1 and flashed to board. I checked everything from download and install tab so installer downloaded and installed OpenCV4Tegra too. Now I want to start a project but where are the OpenCV library files (include, lib… etc.)? Should I install OpenCV4Tegra from terminal or another way? I didn’t find any document or sample about OpenCV4Tegra. Thanks.
Did you check this wiki page:
It is said OpenCV4Tegra is a CPU & GPU optimized version of OpenCV, available as a prebuilt library in JetPack or as separate .deb packages (available for L4T rel-19 and L4T rel-21) at the first option and I installed JetPack1 with enable OpenCV4Tegra. But I didn’t see OpenCV libs anywhere of neither Jetson TK1 nor Ubuntu. Should I install it to Jetson TK1 again and should I compile it from my ubuntu to cross development cuda + opencv? So it is, what is advantages of this JetPack?
I’ve already checked the page. There is a notation about OpenCV4Tegra under Prebuilt OpenCV library versus Building the OpenCV library from source header below from the Option 1) Prebuilt OpenCV4Tegra library for L4T: OpenCV4Tegra is a CPU & GPU optimized version of OpenCV, available as a prebuilt library in JetPack or as separate .deb packages (available for L4T rel-19 and L4T rel-21.x) eg: For OpenCV v22.214.171.124, run the following commands to manually install the prebuilt packages:… I installed JetPack1-1.0 but I didn’t find the OpenCV libs or include files. Should I install OpenCV4Tegra with apt-get from the Jetson-TK1 and should I compile the OpenCV Lib from Ubuntu to cross-compile for Jetson-TK1. If so, what is the advantages of JetPack?
I couldn’t tell you what’s best to do, but the advantage of Jetpack has always been to bundle compatible versions of just about everything and install to both host and Jetson where relevant (e.g., eclipse only to host, x86_64 CUDA on host but ARMv7 CUDA to Jetson; any CUDA on Jetpack for R19.x would be version 6.0, while any CUDA on Jetpack for R21.x would be version 6.5). Each part has a separate installation available for host or Jetson, but more digging and research is needed for that. I don’t have an Ubuntu host so I don’t use Jetpack.
If you used JetPack to install OpenCV4Tegra, at the top level Home directory JetPack installed the ‘OpenCV4Tegra’ folder which it then used to install libopencv4tegra using the shell file ocv.sh. Amongst other things, this performed:
$ sudo apt-get install -y --force=yes libopencv4tegra libopencv4tegra-dev
If you’re looking for the default location of the installed OpenCV4Tegra files, on my machine they are located in:
Data files (used by the classifiers and such):
/usr/bin has a few sample executables such as opencv_createsamples, opencv_performance, etc
(You can use something like ‘$ sudo find -name libopencv*’ from the ‘/’ directory to hunt down those varmints if need be)
Note that this is equivalent to downloading the .deb file and installing it yourself. Also, OpenCV4Tegra does not include OpenCVs’ SIFT or SURF commands, as those two algorithms are patented and not freely distributable. If you must use those algorithms, you will have to use regular OpenCV. You can ‘$ sudo apt-get install libopencv-dev’ for the regular one, or compile it as instructed on the wiki. Compiling OpenCV from sources uses the GPU for acceleration, but is not optimized on the CPU side with things like NEON instructions and such.
The advantage of JetPack is that you don’t have to do much other than check some boxes to do an install. Before JetPack, people would fat finger in the wrong command line parameters before flashing (the line:
$ sudo ./flash.sh -S 14580MiB jetson-tk1 mmcblk0p1
was notorious with the usual ‘zero’ ‘o’ ‘one’ and ‘l’ problems). People had trouble figuring out the correct partition sizes, and how much room was available on the eMMC (16GB flash memory). Also, setting up permissions and expanding the Jetsons system image on the host presented some issues when people encounter it for the first time, especially if they are coming from the Windows/Mac world and haven’t had much experience in Linux or embedded development before.
Not to say JetPack is perfect, but it is much easier to get a good install and flash the first time through, especially if you’re installing CUDA and OpenCV for Tegra. Certainly the number of questions on the forum about installation have dropped dramatically.
It would be nice to know where the libraries and include files are after installing packages, but that feels more like a Linux thing than a Jetson thing.
Sorry for late, I’m in trouble with Nvidia drivers at Ubuntu. Thanks for the answers. I want to cross development so if possible, how can I set OpenCV4Tegra for cross-development? Or is compile opencv with cmake_carma.sh to be enough?
A small sample and it’s configuration for Nsight to cross-compile OpenCV4Tegra code:
(Before running this code, make sure you can run CUDA C/C++ Project sample successfully and installed OpenCV4Tegra)
Create a CUDA C/C++ Project CUDA Runtime Project. And clean main page. Write down following code:
cv::Mat img(512, 512, CV_8UC3, cv::Scalar(0));
“Hello, OpenCV on Jetson!”,
cv::Point(10, img.rows / 2),
CV_RGB(118, 185, 0),
NVCC Compiler > Includes > Include paths: /usr/include (OpenCV4Tegra’s include folder)
NVCC Linker > Libraries > Libraries:
(Their file names are libopencv_core.so, libcudart.so, libtbb.so, libz.so respectively. I don’t know why to change names which makes me crazy! And you may need to find where these files are to fill in Library search path. I add all the libopencv* files in usr/lib to library, you can use find libopencv* to add in.)
NVCC Linker > Library search path
[Your libraries directory]
is there a way to install OpenCV4Tegra on a Jetson TX1? If yes, can you please redirect me to any documentation about the same?