gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 12:26:26 24 4
gpt4 key购买 nike

尝试在 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/

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