修改了 tag25h9
的头文件与实现,
修改了opencv_demo的family,
创建了tag_example文件夹存放生成的tag,
TODO: 精简apriltag项目为只有tag25h9族
AprilTag is the subject of the following papers.
AprilTag: A robust and flexible visual fiducial system
AprilTag 2: Efficient and robust fiducial detection
Flexible Layouts for Fiducial Tags
Officially only Linux operating systems are supported, although users have had success installing on Windows too.
The default installation will place headers in /usr/local/include and shared library in /usr/local/lib. It also installs a pkg-config script into /usr/local/lib/pkgconfig and will install a python wrapper if python3 is installed.
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target install
This will build shared (*.so) libraries by default. If you need static (*.a) libraries set BUILD_SHARED_LIBS
to OFF
:
cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
cmake --build build --target install
If you have Ninja (sudo apt install ninja-build
) installed, you can use:
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build --target install
to generate and compile via the ninja build script. It will be much faster than with cmake's default Makefile generator.
You can omit --target install
if you only want to use this locally without installing.
For the vast majority of applications, the tagStandard41h12 family will be the correct choice. You can find the images for the tags in the apriltag-imgs repo. Scale up the images in your favorite editor and print them out.
Some heuristics for when to choose other tag families:
- If you need more tags, use tagStandard52h13
- If you need to maximize the use of space on a small circular object, use tagCircle49h12 (or tagCircle21h7).
- If you want to make a recursive tag use tagCustom48h12.
- If you want compatibility with the ArUcO detector use tag36h11
If none of these fit your needs, generate your own custom tag family here.
import cv2
import numpy as np
from apriltag import apriltag
imagepath = 'test.jpg'
image = cv2.imread(imagepath, cv2.IMREAD_GRAYSCALE)
detector = apriltag("tagStandard41h12")
detections = detector.detect(image)
Alternately you can use the AprilTag python bindings created by duckietown.
image_u8_t* im = image_u8_create_from_pnm("test.png");
apriltag_detector_t *td = apriltag_detector_create();
apriltag_family_t *tf = tagStandard41h12_create();
apriltag_detector_add_family(td, tf);
zarray_t *detections = apriltag_detector_detect(td, im);
for (int i = 0; i < zarray_size(detections); i++) {
apriltag_detection_t *det;
zarray_get(detections, i, &det);
// Do stuff with detections here.
}
// Cleanup.
apriltag_detections_destroy(detections);
tagStandard41h12_destroy(tf);
apriltag_detector_destroy(td);