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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ar-js-org/artoolkit5-wasm

v0.3.0

Published

A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.

Readme

🚀 artoolkit5-wasm

GitHub stars GitHub forks CI npm version Types License

A high-performance WebAssembly (WASM) port of WebARKitLib, utilizing a modified and improved version of ARToolKit5 tailored for modern JavaScript and TypeScript environments. 🎯 This package delivers fast, modular, and memory-optimized marker tracking, pose estimation, and marker generation directly in the web browser or Node.js.


📦 Installation

Install the package via npm:

npm install @ar-js-org/artoolkit5-wasm

🔗 Peer Dependencies

This library relies on @ar-js-org/artoolkit5-constants for shared ARToolKit constant values. Ensure it is installed in your project:

npm install @ar-js-org/artoolkit5-constants

🛠️ Usage & API Reference

1. ⚙️ Initialization

Initialize the WebAssembly runtime using the createARToolKit factory. You can optionally configure paths for loading the .wasm binary:

import { createARToolKit } from '@ar-js-org/artoolkit5-wasm';

const { mod, core, constants } = await createARToolKit({
  locateFile: (path, prefix) => `node_modules/@ar-js-org/artoolkit5-wasm/dist/${path}`,
  quiet: false // Set to true to suppress initialization logs
});
  • mod: The raw Emscripten module.
  • core: The initialized ARToolKitCore instance.
  • constants: An object containing essential marker detection constants.

2. 📁 URL Loaders

ARToolKit requires camera calibration parameters (.dat) and marker pattern (.hiro / custom) files. Utility helpers fetch these binaries and load them directly into the Emscripten Virtual File System (mod.FS):

import { loadCameraFromUrl, addMarkerFromUrl } from '@ar-js-org/artoolkit5-wasm';

// Load camera calibration file
await loadCameraFromUrl(mod, core, 'path/to/camera_para.dat', '/data/camera_para.dat');

// Load pattern marker file
const pattId = await addMarkerFromUrl(mod, core, 'path/to/patt.hiro', '/data/patt.hiro');

3. 📹 Video Frame Processing & Tracking

Pass video frame data to the WebAssembly module and detect markers inside your frame loop (e.g. requestAnimationFrame):

// Initialize camera tracker dimensions
core.setup(width, height, cameraID);

function processFrame(videoElementData, videoLumaData) {
  // Pass video frames as Uint8Array/typed arrays
  core.passVideoData(videoElementData, videoLumaData, true);

  // Run marker detection
  const numDetected = core.detectMarker();
  if (numDetected > 0) {
    const markerNum = core.getMarkerNum();
    
    for (let i = 0; i < markerNum; i++) {
      const markerInfo = core.getMarkerInfo(i);
      
      // Calculate pose matrix (places calculation result in a shared C++ memory address)
      const markerWidth = 80; // physical width of marker in millimeters
      core.getTransMatSquare(i, markerWidth);

      // Access the 3x4 pose matrix directly from WASM heap to avoid copying overhead
      const ptr = core.getTransform();
      const poseMatrix = mod.HEAPF64.subarray(ptr >> 3, (ptr >> 3) + 12);
      
      console.log(`Detected Marker ID: ${markerInfo.id}`);
      console.log("3x4 Transform Matrix:", poseMatrix);
    }
  }
}

💻 Development & Building

📋 Prerequisites

To build the project from source, you need:

  • Node.js (v22.x or later)
  • Docker (to compile the C++ source via Emscripten)
  • Git (for submodule management)

🔨 Compilation Instructions

First, clone the repository recursively to fetch the nested submodules:

git clone --recursive https://github.com/ar-js-org/artoolkit5-wasm.git
cd artoolkit5-wasm
npm install

1. Compile C++ to WebAssembly 🐳

Compiles the C++ source using Emscripten running inside a Docker container:

npm run build:wasm

2. Build TypeScript Wrapper 📦

Bundles the JS/TS wrappers using Vite and compiles the declarations:

npm run build:wrap

3. Build All 🚀

Performs both C++ WebAssembly and JS/TS wrapper builds:

npm run build

🔍 Code Quality & Linting

Validate C++ code formatting using clang-format:

# Run lint check
npm run lint:cpp

# Automatically format C++ code
npm run format:cpp

🌐 Examples

Check out the included interactive examples in the examples/ directory:

  1. examples/smoke.html: A simple, raw WebAssembly initialization and basic marker addition test.
  2. examples/webcam.html: A complete real-time camera tracking example showing how to detect pattern markers, compute pose matrices, and output them to the page without flooding the console.

To run the examples locally, start a static file server:

npx vite

Then navigate to http://localhost:5173/examples/webcam.html in your web browser.


📄 License

This library is licensed under the MIT License.