I am currently having Tegra4OpenCV and OpenCV3.1 together installed on my Jetson TX1 and following OpenCV 101 tutorial.
When both Tegra4OpenCV and OpenCV 3.1 (installed from source) installed, i am not able to complied the simplest “Hello OpenCV!” sample code. It threw compilation error as “‘putText’ is not a member of ‘cv’”.
When I uninstalled OpenCV 3.1 manually, everything goes back fine.
I have googled the issue, and even tried to have a customized CMakeLists.txt, it still failed as not a member of ‘cv’ issue.
cmake_minimum_required (VERSION 2.8)
set(OpenCV_DIR "/usr/share/OpenCV")
set(OpenCV_INCLUDE_DIRS "/usr/include/opencv" "/usr/include")
project(hello)
# To find OpenCV package
find_package(OpenCV REQUIRED)
if(OpenCV_FOUND)
message("-- OpenCV version: ${OpenCV_VERSION}")
message("-- OpenCV include directories: ${OpenCV_INCLUDE_DIRS}")
message("-- OpenCV libraries: ${OpenCV_LIBS}")
message("-- OpenCV directory: ${OpenCV_DIR}")
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(cv_hello cv_hello.cpp)
target_link_libraries(cv_hello ${OpenCV_LIBS})
endif(OpenCV_FOUND)
The output of cmake is as below:
ubuntu@tegra-ubuntu:~/Documents/OpenCV/Hello/build$ cmake -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF ..
-- 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
-- Found CUDA: /usr/local/cuda-8.0 (found suitable exact version "8.0")
-- OpenCV version: 2.4.13
-- OpenCV include directories: /usr/include/opencv;/usr/include
-- OpenCV libraries: opencv_vstab;opencv_tegra;opencv_imuvstab;opencv_facedetect;opencv_esm_panorama;opencv_detection_based_tracker;opencv_videostab;opencv_video;opencv_ts;opencv_superres;opencv_stitching;opencv_photo;opencv_objdetect;opencv_ml;opencv_legacy;opencv_imgproc;opencv_highgui;opencv_gpu;opencv_flann;opencv_features2d;opencv_core;opencv_contrib;opencv_calib3d
-- OpenCV directory: /usr/share/OpenCV
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Documents/OpenCV/Hello/build
and the output from make:
ubuntu@tegra-ubuntu:~/Documents/OpenCV/Hello/build$ make
Scanning dependencies of target cv_hello
[ 50%] Building CXX object CMakeFiles/cv_hello.dir/cv_hello.cpp.o
/home/ubuntu/Documents/OpenCV/Hello/cv_hello.cpp: In function 'int main()':
/home/ubuntu/Documents/OpenCV/Hello/cv_hello.cpp:7:5: error: 'putText' is not a member of 'cv'
cv::putText(img,
^
CMakeFiles/cv_hello.dir/build.make:62: recipe for target 'CMakeFiles/cv_hello.dir/cv_hello.cpp.o' failed
make[2]: *** [CMakeFiles/cv_hello.dir/cv_hello.cpp.o] 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
My question is: is there any solution to make it work even OpenCV3.1 is kept installed? and I want to still use OpenCV 2.4.13 for some application. I’ve no idea what’s going on here. Any help? Thanks in advance!