OpenCV Not Installed?

I recently got a Jetson TX1 and have started trying to develop on it. I tried to follow the Hello World demo video([url]NVIDIA Jetson OpenCV Tutorials - Episode 0 - YouTube), but when I try to call

[i]cmake ./[/i]

I get an error on the find_package(OpenCV REQUIRED) line of the CMakeLists.txt file.

The error states “…this project has asked CMake to find a package configuration file provided by “OpenCV”, but CMake did not find one…be sure it has been installed”.

Is there something I need to do to install OpenCV? I was under the impression (supported by the video) that it comes installed. FWIW I need GPU support as well.

Thank you

OpenCV 2.4.13 come pre-installed but might not have the feature you’re trying to use or might use opencv_contrib that I think is not included with the pre-installed version. I recall reading that pre-installed OpenCV is optimized for Jetson TX1. You probably giving up some optimization by using the original OpenCV.

To installed OpenCV version 3.1 ( you also can adapt steps to get 3.3) you can follow instructions from this site:
https://docs.opencv.org/trunk/d6/d15/tutorial_building_tegra_cuda.html

I didn’t look at the video you refer to but if it rely on opencv_contrib you have to follow additional steps to get it.

I’ll have the checkout opencv_contrib repo.
Checkout branch corresponding to version of OpenCV you chose to use
Add this to cmake flag:
-DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules

Do you know where OpenCV 2.4.13 is installed? I can’t find it anywhere, and CMake can’t find it either.

Does this application work for you?

hello.cpp

#include <opencv2/highgui/highgui.cpp>

using namespace cv;
int main(){

	cv::Mat img(512, 512, CV_8UC1);
	img.setTo(128);
	imshow("Hello", img);
	waitKey();
}

CMakeLists.txt

cmake_minimum_required (VERSION 2.8)

project(hello)

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(cv_hello hello.cpp)

target_link_libraries(cv_hello ${OpenCV_LIBS})

I can’t get cmake to run when I try it on a new-out-of-the-box Jetson TX1.

After installing OpenCV 3.3:

On my side it’s installed in /usr/lib/ and headers in /usr/include/opencv2/

I suspect OpenCV 2.4.13 was in the same location. I don’t have a system to confirm it at the moment.

Just to confirm, you’ve installed JetPack on your system?

I ran .~/NVIDIA-INSTALLER/installer.sh when I first turned the system on, but otherwise haven’t installed anything from NVIDIA. I am trying that now.

I started from there:

I’m now getting multiple errors downloading packages in JetPack. Is there a way to retry the download for specific packages?

It seems like I was having an issue with drive space (I forgot I’m booting Linux off of a thumb drive on the PC I’m using as the host). When I changed the Jetpack target directory I was able to get everything to download correctly.

However, I’m now hitting an error when it tries to install the CUDA toolkit. The contents of the log are below:


(Reading database … 224570 files and directories currently installed.)
Preparing to unpack …/cuda-repo-ubuntu1604-8-0-local_8.0.34-1_amd64.deb …
Unpacking cuda-repo-ubuntu1604-8-0-local (8.0.34-1) over (8.0.34-1) …
Setting up cuda-repo-ubuntu1604-8-0-local (8.0.34-1) …
OK
Get:1 file:/var/cuda-repo-8-0-local InRelease
Ign:2 cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial InRelease
Ign:1 file:/var/cuda-repo-8-0-local InRelease
Hit:3 cdrom://Ubuntu 16.04.1 LTS Xenial Xerus - Release amd64 (20160719) xenial Release
Get:4 file:/var/cuda-repo-8-0-local Release [574 B]
Get:4 file:/var/cuda-repo-8-0-local Release [574 B]
Hit:7 Index of /ubuntu xenial InRelease
Hit:8 Index of /ubuntu xenial-updates InRelease
Get:9 Index of /ubuntu xenial-security InRelease [102 kB]
Fetched 102 kB in 1s (94.3 kB/s)
Reading package lists…
W: file:///var/cuda-repo-8-0-local/Release.gpg: Signature by key 889BEE522DA690103C4B085ED88C3D385C37D3BE uses weak digest algorithm (SHA1)
Reading package lists…
Building dependency tree…
Reading state information…
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
cuda-toolkit-8-0 : Depends: cuda-samples-8-0 (>= 8.0.34) but it is not going to be installed
Depends: cuda-documentation-8-0 (>= 8.0.34) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.


Also, thank you very much for your help so far, I appreciate it.

I don’t recall running into this problem.
Which version of Ubuntu you have installed on the Host?

16.04. The host is a PC that has a CUDA capable GPU, but I’m running Linux off of a thumb drive. Could that be the issue?

I don’t think running Linux off thumb drive would lead to this issue.

Running Linux from a thumb drive should not be an issue. However, there are places where running Linux on a thumb drive not formatted as ext4 (or other native Linux file system type) can cause problems.

In cases where the thumb drive distribution was intended to be minimal, and not a “real and full” Linux, there might be missing kernel features, e.g., loopback might have been left out. An ordinary Ubuntu desktop distribution (or most other desktop distributions) won’t care about being on an SD card.

Is there a way I could test whether I’ve got a “real and full” version of Linux running?

Did you install from a DVD? Knowing what the install source says it is will be the way to know. If you installed just ordinary desktop Ubuntu PC type software, then you have a full install. If you installed something which is intended to run as a rescue disk or on a thumb drive right from the start, then it is unlikely to be a full install.

I didn’t install anything, I’m booting off of the thumb drive. “Try Linux without installing.” or something like that. Does that mean it’s probably not a full version?

That is correct…those versions do not normally include all of the kernel features you would get in a regular desktop distribution. You could get an Ubuntu DVD and tell it the partition is the USB thumb drive (make sure it is something like ext4).

Thank you for your help. I did a full install on a PC, and (after figuring out that I needed an ethernet connection) was able to get the installation to proceed.

The problem I’ve run into now is that the host can’t find the IP address of the Jetson board, and the Jetson board is displaying a blue and purple login page, but is completely unresponsive to any keyboard or mouse input. Is that something you’ve ever seen before? Is there a way I can use the fact that the Jetson is mounted on the host PC as a drive to resolve the issue?

Thanks you for your help.

How is the Jetson connected to the network…through a dedicated router appliance, or through the PC? Either way the Jetson gets its address through an ordinary DHCP request. If you use the PC you can probably see the address in the logs (e.g., dmesg about DHCP). If you use a router appliance, then it probably has logs as to the address request and response.

It is common for the system to be up and running, yet have video configuration issues…it might be that things are mostly working correctly, but you just can’t see video. If you find the address in router or PC logs, then ssh to that. You can also use a serial console which is very reliable (but requires a cable). See:
[url]http://www.jetsonhacks.com/2017/03/24/serial-console-nvidia-jetson-tx2/[/url]

One issue which can cause problems is if your host is a VM. In that case you have to go through extra effort to get network and USB to work correctly.

If your host flashes from a non-native Linux file system, or if command line install was used without sufficient use of “sudo” (JetPack prompts for passwords), then flash will succeed, but content won’t be valid.

Is your PC native or VM? Do you see DHCP information in logs of the PC or router? Also, are there any video cable adapters? VGA won’t work.

I had it connected via the router. Both the host and the Jetson were plugged into the router via ethernet cables. When I checked on the “connected devices” list on my router’s config page I could see the host, but not the Jetson, so it seems like the Jetson is not making a connection to the network.

Furthermore, I’ve completely lost the USB port on the board. It’s not supplying power any more, so I’m unable to use a keyboard or mouse.

Since I can’t SSH into it and I can’t interact with it with a keyboard and mouse, I’m unsure of how to proceed. Is there a way to use the host PC reflash the Jetson to the stock Ubuntu and start over?