Apriltag源码C版本编译以及运行

AprilTag官网:https://april.eecs.umich.edu/software/apriltag.html?nsukey=6yUi4Iya263%2F2CEQLJ8uEkE%2FYP3b0h6Zb8PEzmhDhylkW2IAJ%2ByRA%2F92zKk9GTGqE5MBJsQ98FJpYw9BxT1A%2F4Yio0lpqjFwHMoXlxXPA5s1mJH0z%2Br7pQNP2DCIWh82diapY3LZzeNxpLGGaBR789MOpeqsJB5rQJgM3DZlsIT%2BiDdfkpBrZ7XDam1VRYgn

下载源码,解压得到如下的文件:

.
├── apriltag.c
├── apriltag.h
├── apriltag_math.h
├── apriltag.pc.in
├── apriltag_quad_thresh.c
├── common  # ******************这是文件夹
├── example # ******************这是文件夹
├── install.sh
├── Makefile
├── README
├── tag16h5.c
├── tag16h5.h
├── tag25h7.c
├── tag25h7.h
├── tag25h9.c
├── tag25h9.h
├── tag36artoolkit.c
├── tag36artoolkit.h
├── tag36h10.c
├── tag36h10.h
├── tag36h11.c
└── tag36h11.h

新建一个目录,在该目录下建立如下的结构:

├── apriltag
│   ├── apriltag.c
│   ├── apriltag.h
│   ├── apriltag_math.h
│   ├── apriltag_quad_thresh.c
│   ├── CMakeLists.txt
│   ├── CMakeLists.txt~
│   ├── common # ******************这是文件夹
│   ├── tag16h5.c
│   ├── tag16h5.h
│   ├── tag25h7.c
│   ├── tag25h7.h
│   ├── tag25h9.c
│   ├── tag25h9.h
│   ├── tag36artoolkit.c
│   ├── tag36artoolkit.h
│   ├── tag36h10.c
│   ├── tag36h10.h
│   ├── tag36h11.c
│   └── tag36h11.h
├── cbiuld # ******************这是文件夹
├── CMakeLists.txt
└── opencv_demo.cpp

根目录下的CMakeLists.txt内容如下:

cmake_minimum_required(VERSION 2.8.3)
project(apriltag)

#add_definitions(-std=c99 -Wl --no-as-needed)
add_compile_options(-std=c99)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl --no-as-needed")

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
find_package (Threads)

add_subdirectory(apriltag)
aux_source_directory(. srcs)

add_executable(solve_tag ${srcs})
target_link_libraries(solve_tag 
    apriltag
    ${OpenCV_LIBS}
    ${CMAKE_THREAD_LIBS_INIT}
)

下一级的CMakeLists.txt内容如下:

cmake_minimum_required(VERSION 2.8)

add_compile_options(-std=c99)
set(CMAKE_SHARED_LINKER_FLAGS "-Wl --no-as-needed")
aux_source_directory(common common_src)
aux_source_directory(. apriltag_src)
add_library(apriltag STATIC ${common_src} ${apriltag_src})

编译

注意,将所有#include <common/*.h>中的common/删除
之后进入cbuild文件夹,

cmake ..
make
./solve_tag
  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值