jsartoolkitNFT
jsartoolkitNFT is the Emscripten port of WebARKitLib to JavaScript and TypeScript, compiled to WebAssembly: a modified, lighter version of jsartoolkit5 with only NFT (natural feature tracking) markerless support. It has TypeScript types and runs in browsers. Node.js support and the Python bindings are experimental.
- Repository: webarkit/jsartoolkitNFT
- npm:
@webarkit/jsartoolkit-nft - PyPI:
artoolkitnft(Python bindings) - Releases: GitHub releases
Install
Section titled “Install”npm i @webarkit/jsartoolkit-nftimport { ARToolkitNFT, ARControllerNFT } from '@webarkit/jsartoolkit-nft';| Import | Build |
|---|---|
@webarkit/jsartoolkit-nft |
default (UMD in the browser, Node build in Node.js) |
@webarkit/jsartoolkit-nft/simd |
WebAssembly SIMD build |
@webarkit/jsartoolkit-nft/td |
threaded (pthread) build — experimental, needs COOP/COEP |
@webarkit/jsartoolkit-nft/node |
Node.js build (CommonJS) — experimental |
The tracking loop
Section titled “The tracking loop”Run tracking in a Web Worker, not on the main thread. The typical flow is:
const controller = await new ARControllerNFT(width, height, '/Data/camera_para.dat');const ar = await controller._initialize();
ar.loadNFTMarker('DataNFT/pinball', (id) => { ar.trackNFTMarkerId(id);});
// for every camera frame (RGBA ImageData):ar.process(imageData);When the marker is found the controller emits a getNFTMarker event with the pose; lostNFTMarker when it is lost. See the ES6 example and its worker source for a complete browser implementation, including pose smoothing with the One Euro Filter.
Python bindings
Section titled “Python bindings”The same WebARKitLib C/C++ core is also available from Python, through pybind11 bindings published on PyPI:
pip install artoolkitnftThey expose a high-level ARControllerNFT class and a lower-level artoolkitnft_core extension module, so you can run NFT marker detection from Python. What works today: loading NFT markers (.iset, .fset, .fset3), KPM detection, AR2 tracking with the pose matrix, and the getNFTMarker / lostNFTMarker events. There is no live-camera example yet: the bundled one processes a still image.
Wheels for CPython 3.9–3.13 are available for Linux x86_64, macOS on Apple silicon and Windows x86_64. There is no source distribution and no Intel macOS build, so on an unsupported platform pip reports “no matching distribution found”. To build from source, see the Python bindings README.
API reference
Section titled “API reference”The full API reference can be generated from the repository with npm run docs. Publishing it here is planned.