视觉SLAM十四讲 报错 Could not find a configuration file for package "OpenCV" that is compatible with requested version "4".
1. 问题
在编译高博的视觉SLAM十四讲ch8的optical_flow.cpp时,编译报错:
CMake Error at CMakeLists.txt:8 (find_package):
Could not find a configuration file for package "OpenCV" that is compatible
with requested version "4".
The following configuration files were considered but not accepted:
/usr/local/share/OpenCV/OpenCVConfig.cmake, version: 3.4.16
-- Configuring incomplete, errors occurred!
2. 原因
在第八讲的这个程序里,CMakeLists.txt中编译find_package查找的是OpenCV4,而十四讲前面使用的opencv包括

在编译高博的视觉SLAM教程时遇到OpenCV版本不兼容的问题,错误提示找不到合适的OpenCV4配置文件。原因是之前安装的OpenCV版本为3.4.16。解决方案包括修改CMakeLists.txt,将查找OpenCV4改为OpenCV3,或者选择编译OpenCV4。此外,可能还会遇到Sophus或G2o版本过高导致的fmt库问题。通过这些调整,可以成功编译并运行程序。
最低0.47元/天 解锁文章
6347





