c++ - 无法在 OpenCV 中运行 SFM 模块的程序

标签 c++ linux opencv 3d-reconstruction structure-from-motion

尝试在 SFM 模块中执行示例代码时出现错误。最初 SFM 不存在于我的 contrib 目录中。所以我下载了最新的 contrib 并将 sfm 文件夹粘贴到我的 contrib 目录中。我使用了 sfm 模块中的 CMakeLists.txt。 然后我尝试使用 scene_reconstruction.cpp 和我从 sfm 模块获取的 CMakeLists.txt 在我自己的目录中构建它。以下是我得到的错误

-- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found installed version of Eigen: /usr/lib/cmake/eigen3 -- Found required Ceres dependency: Eigen version 3.2.92 in /usr/include/eigen3 -- Found required Ceres dependency: glog -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE -- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success -- Found required Ceres dependency: gflags -- Found Ceres version: 1.13.0 installed in: /usr/local with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, OpenMP] -- Checking SFM deps... TRUE -- Module opencv_sfm disabled because the following dependencies are not found: Eigen CMake Error at CMakeLists.txt:35 (ocv_module_disable): Unknown CMake command "ocv_module_disable". CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as cmake_minimum_required(VERSION 3.5) should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. -- Configuring incomplete, errors occurred!

PS:在开始之前,我已经完成了 SFM 文档页面中提到的库的所有必需下载。

最佳答案

我建议您安装所需的依赖项,如 Eigen、Google log、Google Flags 和 Ceres,并为您的 opencv 下载相应的 opencv_contrib 版本并使用

-DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules

并使用以下 CMakeLists.txt 文件:

cmake_minimum_required(VERSION 2.8)
project( main )
find_package( OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( main main.cpp )
target_link_libraries( main ${OpenCV_LIBS} )

假设您有 main.cpp 文件,如果安装正确,它应该可以工作。

更多信息请访问:

https://github.com/opencv/opencv_contrib/tree/master/modules/sfm

https://github.com/opencv/opencv_contrib/issues/476

关于c++ - 无法在 OpenCV 中运行 SFM 模块的程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44492929/

相关文章:

c++ - 为什么静态数据成员不能与非静态数据成员同名?

c++ - ofxEtherdream 在 Windows 上编译

c++ - opencv将一个矩阵复制到另一个矩阵的第一列

c++ - 如何直接从 LLVM 源代码树使用新编译的 LLVM 工具?

opencv - cvSetErrMode 不工作

c++ - OpenCV 人物检测样本崩溃

c++ - 强大的相机校准

linux - 如何在不安装mp3编解码器的情况下播放音乐

java - 代码在 IDE 内部运行但在外部失败

java - 在 Ubuntu 上安装 Tomcat 5.5(使用 apt)导致 CATALINA_HOME 未设置