Installed Opencv 4.1.2 pre on Ubuntu 16.04 but version shown is 2.4.9

asked 2019-09-16 01:47:28 -0500

Hi, Recently I installed opencv 4.1.2 pre on Ubuntu 16.04, I followed https://docs.opencv.org/master/d7/d9f.... However, after installation the system prompt me error when I run "opencv_test_core". Then, I tried to use opencv with cmake using https://docs.opencv.org/master/db/df5.... my content for CMakeLists.txt is: cmake_minimum_required(VERSION 2.8) project( test ) find_package( OpenCV REQUIRED ) include_directories( ${OpenCV_INCLUDE_DIRS} ) add_executable( test test.cpp ) target_link_libraries( test ${OpenCV_LIBS} ) I have error message when I key in $ cmake . CMake Error at /opt/ros/kinetic/share/OpenCV-3.3.1-dev/OpenCVModules.cmake:375 (message): The imported target "opencv_viz" references the file

 "/opt/ros/kinetic/lib/x86_64-linux-gnu/libopencv_viz3.so.3.3.1"

but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and contained

    "/opt/ros/kinetic/share/OpenCV-3.3.1-dev/OpenCVModules.cmake"

    but not all the files it references.

Call Stack (most recent call first): /opt/ros/kinetic/share/OpenCV-3.3.1-dev/OpenCVConfig.cmake:112 (include) CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/abc/testcpp/CMakeFiles/CMakeOutput.log".

In addition, when I check the opencv version by using $ pkg-config --modversion opencv I get "2.4.9.1" in return. I tried to re-install opencv a few times, but the version still stuck with 2.4.9.1. Is there any method I can install a latest version for opencv properly, and using opencv with cmake without any error. Thank you very much for the help.

edit retag flag offensive close merge delete