0

我正在尝试使用 arUco 构建一个项目。

我正在使用 openCV v.3.1,它显然包括 aruco。但是,我收到错误:

opencv2/aruco/dictionary.hpp: No such file or directory
    #include "opencv2/aruco/dictionary.hpp"
                                           ^

然后我下载了 arUco,构建了它,并尝试构建http://www.uco.es/investiga/grupos/ava/node/26底部描述的示例。我得到错误:

fatal error: aruco/aruco.h: No such file or directory
    #include <aruco/aruco.h>
                            ^

使用的 CMakeLists.txt 是:

cmake_minimum_required(VERSION 2.8)
project(aruco_testproject)
SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/ )
MESSAGE(${CMAKE_MODULE_PATH})
find_package(aruco REQUIRED )
add_executable(aruco_simple aruco_simple.cpp)
target_link_libraries(aruco_simple  ${aruco_LIBS})

我已将 Findaruco.cmake 复制到 /usr/local/lib/cmake/

如果有人可以提供帮助,那就太好了。我一直在寻找解决方案一段时间,我觉得真的被困住了。非常感谢!

4

1 回答 1

0

你错过了这include_directories节。另外我认为库的正确变量名后缀应该是_LIBRARIES, not _LIBS,但是 afaik,cmake 无法使用流氓 cmake 模块强制执行任何规则,所以最好的选择可能是尝试几个常见的后缀。这是cmake的暴行之一。

cmake_minimum_required(VERSION 2.8)
project(aruco_testproject)
SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/lib/cmake/ )
MESSAGE(${CMAKE_MODULE_PATH})
find_package(aruco REQUIRED )
add_executable(aruco_simple aruco_simple.cpp)
include_directories(${ARUCO_INCLUDE_DIR} ${ARUCO_INCLUDE_DIRS})
target_link_libraries(aruco_simple ${ARUCO_LIBRARY} ${ARUCO_LIBRARIES})

对于标题包含,#include <aruco/aruco.h>看起来不错,但不是 #include "opencv2/aruco/xxx".

于 2016-06-19T23:35:27.483 回答