xiangweizeng / mobile-lpr

Mobile-LPR 是一个面向移动端的准商业级车牌识别库,以NCNN作为推理后端,使用DNN作为算法核心,支持多种车牌检测算法,支持车牌识别和车牌颜色识别。
603 stars 142 forks source link

cmake problem #16

Open duducode opened 4 years ago

duducode commented 4 years ago

The following configuration files were considered but not accepted:

/usr/share/OpenCV/OpenCVConfig.cmake, version: 2.4.9.1
lingxuxiong commented 3 years ago

The latest example code requires exactly OpenCV version 3.0.0 installed, if not, compiling will most probably end up with CMake errors similar to what follows:

  Could not find a configuration file for package "OpenCV" that is compatible
  with requested version "3.0.0".

  The following configuration files were considered but not accepted:

    /Users/nling/opencv/installation/OpenCV-master-debug/lib/cmake/opencv4/OpenCVConfig.cmake, version: 4.5.2

it means, the installed version is not matched with the required one. to fix this, you need to remove the specific OpenCV version or change it to the same version as installed on the dev machine.

# ./example/CMakeLists.txt
find_package(OpenCV REQUIRED COMPONENTS core imgcodecs imgproc highgui)

or

find_package(OpenCV 4.5.2 REQUIRED COMPONENTS core imgcodecs imgproc highgui)

Btw, if libomp is not installed on MacOS, OpenMP related error will arise,

(base) ➜  build git:(master) ✗ cmake ..
-- CMAKE_INSTALL_PREFIX = /usr/local
-- Found OpenCV: /Users/nling/opencv/installation/OpenCV-master-debug (found version "4.5.2") found components: core imgcodecs imgproc highgui
CMake Error at /usr/local/lib/python3.9/site-packages/cmake/data/CMake.app/Contents/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
  Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)

ran brew install libomp fixed it, see MacOS, CMake and OpenMP for more details.