npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@monumental-works/apriltag-node

v1.3.0

Published

Node.js bindings for AprilTag detection library

Readme

apriltag-node

Node.js bindings for the AprilTag fiducial marker detection library.

Usage

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

// Synchronous detection (blocks main thread)
const detections = detector.detect(width, height, imageBuffer);

// Asynchronous detection (non-blocking)
const detections = await detector.detectAsync(width, height, imageBuffer);

// Optionally pre-initialize for consistent timing
await detector.ensureInitialized();

detections.forEach((detection) => {
  console.log(`Tag ID: ${detection.id}`);
  console.log(`Center: [${detection.center[0]}, ${detection.center[1]}]`);
  console.log(`Corners:`, detection.corners);
});

API

Constructor

new AprilTag(family?, options?)
  • family: Tag family (default: FAMILIES.TAG36H11)
  • options: Detection options
    • quadDecimate: Quad decimation factor
    • quadSigma: Gaussian blur sigma
    • refineEdges: Enable edge refinement
    • decodeSharpening: Decode sharpening factor
    • numThreads: Number of threads for detection

Methods

Detection Methods

  • detect(width, height, imageData): Detect tags synchronously (blocks main thread)
    • Returns: AprilTagDetection[] - Array of detected tags
  • detectAsync(width, height, imageData): Detect tags asynchronously (non-blocking)
    • Returns: Promise<AprilTagDetection[]> - Promise that resolves to detected tags
  • ensureInitialized(): Pre-initialize the detector for consistent timing
    • Returns: Promise<boolean> - Promise that resolves when initialization is complete
    • Multiple calls return the same promise instance (cached)
    • Useful for warming up the detector before timing-critical operations

Configuration Methods

  • setQuadDecimate(value): Set quad decimation
  • setQuadSigma(value): Set Gaussian blur sigma
  • setRefineEdges(value): Enable/disable edge refinement
  • setDecodeSharpening(value): Set decode sharpening
  • setNumThreads(value): Set number of threads for detection

Supported Tag Families

  • tag36h11 (default) - Recommended for general use
  • tag25h9 - Good balance of performance and robustness
  • tag16h5 - Fewer unique tags available
  • tagCircle21h7 - Circular design
  • tagStandard41h12 - Standard format
  • tagCircle49h12 - Large lookup table with 49-bit codes
  • tagCustom48h12 - Large lookup table with 48-bit codes
  • tagStandard52h13 - Largest family with 52-bit codes

Performance & Threading

Asynchronous Detection

The detectAsync() method runs detection on a background thread, keeping the main Node.js thread free for other operations:

// Start detection without blocking
const detectionPromise = detector.detectAsync(width, height, imageBuffer);

// Main thread remains responsive
setInterval(() => {
  console.log('Main thread is free!');
}, 100);

// Wait for results when needed
const detections = await detectionPromise;

Pre-initialization

Tag family initialization can be slow (50-150ms for large families). Use ensureInitialized() to pre-warm the detector:

const detector = new AprilTag(FAMILIES.TAGSTANDARD52H13);

// Pre-initialize to avoid delay on first detection
await detector.ensureInitialized();

// Subsequent detections start immediately
const detections = await detector.detectAsync(width, height, imageBuffer);

Thread Safety

Both sync and async detection methods can be called concurrently from multiple async operations.

License

This project is licensed under the MIT License - see the LICENSE file for details.

AprilTag Library

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