0

我在尝试编译包时遇到此错误。这是我有错误的CMAKE:

    cmake_minimum_required(VERSION 2.8.3)
project(aruco_marker_detector)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  geometry_msgs
  image_transport
  roscpp
  std_msgs
  tf
  tf_conversions
  uvc_camera
)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

##############################################################################
# OpenCV
##############################################################################
find_package(OpenCV REQUIRED)

##############################################################################
# Eigen
##############################################################################
find_package(Eigen REQUIRED)
add_definitions(${EIGEN_DEFINITIONS})

##############################################################################
# AruCo
##############################################################################
find_package(aruco REQUIRED )

错误是关于 Aruco,系统找不到库!!

我现在真的不知道如何解决它。我已经按照本网站“ http://maztories.blogspot.com.es/2013/07/installing-aruco-augmented-reality.html ”中的说明安装了 aruco 1.2.4 。

4

2 回答 2

1

如果你正确配置了 OpenCV,你可以自己生成 ArUco 的库:

# latest aruco version available at: http://sourceforge.net/projects/aruco/files/
# also, aruco is now part of OpenCV: http://docs.opencv.org/master/d9/d6d/tutorial_table_of_content_aruco.html
# here I'm demonstrating the usage of v1.2.5

# useful definitions
set(ARUCO_DIR     "/PATH/TO/aruco-1.2.5")
set(ARUCO_INCLUDE "${ARUCO_DIR}/include")
set(ARUCO_SRC     "${ARUCO_DIR}/src")
set(ARUCO_LIB      aruco-1.2.5)

# find the source files
file(GLOB hdrs "${ARUCO_INCLUDE}/aruco/*.h*")
file(GLOB srcs "${ARUCO_SRC}/*.c*")

# create aruco's cmake target
add_library(${ARUCO_LIB} STATIC "${hdrs}" "${srcs}")

# link aruco against OpenCV
find_package(OpenCV REQUIRED)
include_directories(SYSTEM "${OpenCV_INCLUDE_DIRS}" ${OpenCV_LIBS})


# use aruco in your project
# useful project definitions
set(MY_SOURCES    "list your sources here")
set(MY_EXECUTABLE super_ar_program)

# create the executable's cmake target
add_executable(${MY_EXECUTABLE} "${MY_SOURCES}")

# the executable against aruco
include_directories(SYSTEM "${ARUCO_INCLUDE}" "${OpenCV_INCLUDE_DIRS}")
target_link_libraries(${MY_EXECUTABLE} ${ARUCO_LIB} ${OpenCV_LIBS})

编辑:我已将脚本更改为使用include_directories()而不是target_include_directories().

于 2015-10-22T23:55:23.567 回答
0

这是我用 aruco 3.09 简化的 cmake 文件。应该也适用于 3.0+ 的其他版本,只需更改目录名称。

cmake_minimum_required( VERSION 2.8 )

## Required software
#find_package( <<<name>>> REQUIRED )

## Sources and headers
include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
include_directories("/home/corvus/opencv/include/opencv2/")
include_directories("/home/corvus/aruco-3.0.9/aruco-3.0.9/aruco_src/include/")
link_directories( /home/corvus/aruco-3.0.9/aruco-3.0.9/aruco_src/lib/ )

## Find all source and header files to be compiled into object files
file( GLOB SOURCES *.cc *.cpp *.hpp *.hh )

## Find all aruco source and header files to be compiled into object files
## file(GLOB ARUCO_HEADERS "${ARUCO_INCLUDE}/aruco/*.h*")
## file(GLOB ARUCO_SOURCES "${ARUCO_SRC}/*.c*")

## Add OpenCV Library
add_library(OpenCV SHARED IMPORTED)
set_property(TARGET OpenCV PROPERTY IMPORTED_LOCATION "/usr/local/lib")
find_package( OpenCV REQUIRED )

## Add Eigen3
find_package(Eigen3 REQUIRED)

## C++ compiler options
set( CMAKE_CXX_FLAGS "-Wall -Wextra -std=c++11 -pthread -I/usr/include/eigen3/ -L/usr/local/libs \ -lopencv_objdetect \ " )
    ## to disable all warnings 
    ## set( CMAKE_CXX_FLAGS "" ) 
set( CMAKE_CXX_FLAGS_DEBUG "-g -O0" )
set( CMAKE_CXX_FLAGS_RELEASE "-O3" )
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS ON) #...with compiler extensions like gnu++11

## Source file containing the "main" function
set( MAIN_SOURCES main.cpp )
## Specify a name for the generated executable file
set( MAIN_EXE_NAME MarkerDetection )


## 1. Compile...
add_executable( ${MAIN_EXE_NAME} ${MAIN_SOURCES}
                                 ${SOURCES}
              )


## 2. Link...
target_link_libraries( ${MAIN_EXE_NAME} )
target_link_libraries(${MAIN_EXE_NAME} ${OpenCV_LIBS})
target_link_libraries(${MAIN_EXE_NAME} aruco)


## 3. Install...
install( TARGETS ${MAIN_EXE_NAME}
         RUNTIME DESTINATION bin )
于 2018-10-19T09:04:41.543 回答