我在 Ubuntu 18.04 LTS 上安装了 OpenCV 4.1。问题是当我编译我的项目的 CMake 文件时,输出是:
/usr/bin/ld: cannot find -lopencv_nonfree
collect2: error: ld returned 1 exit status
CMakeFiles/river_flow_velocity_estimation.dir/build.make:274: recipe for target 'river_flow_velocity_estimation' failed
make[2]: *** [river_flow_velocity_estimation] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/river_flow_velocity_estimation.dir/all' failed
make[1]: *** [CMakeFiles/river_flow_velocity_estimation.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
我编译 OpenCV 时的 CMake 标志是:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D BUILD_EXAMPLES=ON -D OPENCV_GENERATE_PKGCONFIG=YES -D OPENCV_ENABLE_NONFREE=ON -D WITH_OPENMP=ON -D WITH_OPENCL=ON -D INSTALL_CREATE_DISTRIB=ON -DBUILD_opencv_world=OFF -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
有人能帮我吗?