0

I'm trying to build a project with arUco.

I am using openCV v.3.1, which apparently includes aruco. However, I get the error:

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

I then downloaded arUco, built it, and tried to build the example described at the bottom of http://www.uco.es/investiga/grupos/ava/node/26 . I get the error:

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

The CMakeLists.txt used is:

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})

I've copied Findaruco.cmake to /usr/local/lib/cmake/

If anyone could help, that'd be fantastic. I've been looking for a solution for a while and I feel really stuck. Thanks a lot!

user2121792
  • 221
  • 1
  • 5
  • 12
  • You are confusing two seperate libraries. OpenCV has its own implementation of [aruco](http://docs.opencv.org/3.1.0/d9/d6a/group__aruco.html), nothing to do with the other one you linked to.. It is contained in a separate module in `opencv_contrib` (so you have to explicitly build it from source). – Amro Oct 25 '16 at 14:03

1 Answers1

0

You are missing the include_directories stanza. Also I think the correct variable name suffix for the library should be _LIBRARIES, not _LIBS, but afaik, cmake is unable to enforce any rule with rogue cmake modules, so the best bet is probably to try several common suffixes. That's one of cmake's atrocities.

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})

For the header inclusion, #include <aruco/aruco.h> looks fine, but not #include "opencv2/aruco/xxx".

Johan Boulé
  • 1,936
  • 15
  • 19