Node.js bindings for the AprilTag fiducial marker detection library.
Install the @monumental-works/apriltag-node NPM package.
import AprilTag, { FAMILIES } from '@monumental-works/apriltag-node';
// Create detector with default tag36h11 family
const detector = new AprilTag();
// Or specify family and options
const detector = new AprilTag(FAMILIES.TAG36H11, {
quadDecimate: 2.0,
quadSigma: 0.0,
refineEdges: true,
decodeSharpening: 0.25,
});
// Detect tags in grayscale image
const detections = detector.detect(width, height, imageBuffer);
detections.forEach((detection) => {
console.log(`Tag ID: ${detection.id}`);
console.log(`Center: [${detection.center[0]}, ${detection.center[1]}]`);
console.log(`Corners:`, detection.corners);
});
new AprilTag(family?, options?)
family
: Tag family (default:FAMILIES.TAG36H11
)options
: Detection optionsquadDecimate
: Quad decimation factorquadSigma
: Gaussian blur sigmarefineEdges
: Enable edge refinementdecodeSharpening
: Decode sharpening factor
detect(width, height, imageData)
: Detect tags in grayscale imagesetQuadDecimate(value)
: Set quad decimationsetQuadSigma(value)
: Set Gaussian blur sigmasetRefineEdges(value)
: Enable/disable edge refinementsetDecodeSharpening(value)
: Set decode sharpening
tag36h11
(default) - Recommended for general usetag25h9
- Good balance of performance and robustnesstag16h5
- Fewer unique tags availabletagCircle21h7
- Circular designtagStandard41h12
- Standard formattagCircle49h12
- Large lookup table with 49-bit codestagCustom48h12
- Large lookup table with 48-bit codestagStandard52h13
- Largest family with 52-bit codes
This project is licensed under the MIT License - see the LICENSE file for details.
This package includes the AprilTag library developed by the APRIL Robotics Laboratory at the University of Michigan. The AprilTag library is licensed under the BSD 2-Clause License.
AprilTag Citation:
@INPROCEEDINGS{wang2016iros,
author = {John Wang and Edwin Olson},
title = {{AprilTag 2: Efficient and robust fiducial detection}},
booktitle = {Proceedings of the {IEEE} International Conference on Robotics and
Automation ({ICRA})},
year = {2016},
month = {May},
}
For more information about AprilTag, visit: https://april.eecs.umich.edu/software/apriltag