I did a fresh flash of Jetpack 2.3 today and am following the video tutorials to familiarize myself with the TX1. This OpenCV hello world application doesn’t compile for me due to missing libraries. Does the tutorial not work on the most recent version of jetpack or am I doing something wrong? NVIDIA Jetson OpenCV Tutorials - Episode 0 - YouTube
Here’s the code:
hello.cpp
#include <opencv2/highgui/highgui.hpp>
int main() {
cv::Mat img(512, 512, CV_8UC3, cv::Scalar(0));
cv::putText(img,
"Hello OpenCV on Jetson!",
cv::Point(10, img.rows / 2),
cv::FONT_HERSHEY_DUPLEX,
1.0,
CV_RGB(118, 185, 0),
2);
cv::imshow("Hello", img);
cv::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})
ubuntu@tegra-ubuntu:~/Desktop/hello_world/build$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda-8.0 (found suitable exact version "8.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Desktop/hello_world/build
ubuntu@tegra-ubuntu:~/Desktop/hello_world/build$ make
Scanning dependencies of target cv_hello
[ 50%] Building CXX object CMakeFiles/cv_hello.dir/hello.cpp.o
[100%] Linking CXX executable cv_hello
/usr/bin/ld: cannot find -lopencv_dep_cudart
collect2: error: ld returned 1 exit status
CMakeFiles/cv_hello.dir/build.make:121: recipe for target 'cv_hello' failed
make[2]: *** [cv_hello] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/cv_hello.dir/all' failed
make[1]: *** [CMakeFiles/cv_hello.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2