gpt4 book ai didi

c++ - (OpenCV4.1)/usr/bin/ld : cannot find -lopencv_nonfree

转载 作者:行者123 更新时间:2023-12-02 10:27:06 30 4
gpt4 key购买 nike

我在此 https://www.pyimagesearch.com/2018/09/26/install-opencv-4-on-your-raspberry-pi/ 之后安装了 OpenCV 4.1在我的树莓派 3B 上。
我用这些 CMake 标志编译了 OpenCV:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_opencv_java=off -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=OFF -D ENABLE_PRECOMPILED_HEADERS=OFF -D BUILD_JPEG=OFF -D ENABLE_FAST_MATH=ON -D CMAKE_SHARED_LINKER_FLAGS=-latomic -D ENABLE_NEON=ON -D ENABLE_VFPV3=ON -D OPENCV_ENABLE_NONFREE=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules -D WITH_OPENCL=ON -D WITH_PTHREADS_PF=OFF -DEXTRA_C_FLAGS=-mcpu=cortex-a7 -mfpu=neon-vfpv4 -ftree-vectorize -mfloat-abi=hard -D EXTRA_CXX_FLAGS=-mcpu=cortex-a7 -mfpu=neon-vfpv4 -ftree-vectorize -mfloat-abi=hard -D BUILD_EXAMPLES=OFF -D BUILD_PERF_TESTS=OFF ..
当我编译我的项目时,我得到了这个错误:
/usr/bin/ld: impossibile trovare -lopencv_nonfree
collect2: error: ld returned 1 exit status
CMakeFiles/river_flow_velocity_estimation.dir/build.make:271: set di istruzioni per l'obiettivo "river_flow_velocity_estimation" non riuscito
make[2]: *** [river_flow_velocity_estimation] Errore 1
CMakeFiles/Makefile2:67: set di istruzioni per l'obiettivo "CMakeFiles/river_flow_velocity_estimation.dir/all" non riuscito
make[1]: *** [CMakeFiles/river_flow_velocity_estimation.dir/all] Errore 2
Makefile:83: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
与此帖子相同的错误 /usr/bin/ld: cannot find -lopencv_nonfree .
我是初学者,不太清楚可能是什么问题。
我不明白为什么即使我使用了标志 OPENCV_ENABLE_NONFREE=ON我的程序找不到 opencv_nonfree模块。
有谁知道该怎么做?
编辑:我的 CMakeLists.txt
cmake_minimum_required(VERSION 3.5.1)
set (CMAKE_BUILD_TYPE Release)
#set (CMAKE_BUILD_TYPE Debug)
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
add_definitions(-std=c++0x)
project(river_flow_velocity_estimation)
set( OpenCV_DIR "/usr/share/OpenCV" )
set(OPENCV_ENABLE_NONFREE "Enable non-free algorithms" ON)
find_package( OpenCV 4.1.0 REQUIRED)
find_package( OpenMP REQUIRED)
include_directories(include ${OpenCV_LIBRARIES} ${OpenCV_INCLUDE_DIRS} } ${catkin_INCLUDE_DIRS})

set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} -mcpu=cortex-a53 -mfloat-abi=hard -funsafe-math-optimizations -mfpu=neon-fp-armv8")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS} -mcpu=cortex-a53 -mfloat-abi=hard -funsafe-math-optimizations -mfpu=neon-fp-armv8")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")


file(GLOB SOURCES "src/*.cpp")
add_executable(river_flow_velocity_estimation ${SOURCES})
target_link_libraries(river_flow_velocity_estimation opencv_nonfree ${OpenCV_LIBS} ${catkin_LIBRARIES})

最佳答案

opencv_nonfree openCV 4.1 中不再存在。如果您删除 opencv_nonfree来自 target_link_libraries它应该工作。
仅供引用,它们现在直接集成到 modules/xfeatures2d/来自 opencv_contrib .带着你的旗帜OPENCV_ENABLE_NONFREE=ON它们应该可用。

关于c++ - (OpenCV4.1)/usr/bin/ld : cannot find -lopencv_nonfree,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63900952/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com