{"_id":"@ar-js-org/artoolkit5-wasm","_rev":"4-241845b6b544118182a7df2ec397b113","name":"@ar-js-org/artoolkit5-wasm","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.2":{"name":"@ar-js-org/artoolkit5-wasm","version":"0.1.2","keywords":["artoolkit","artoolkit5","wasm","webassembly","webarkitlib","ar","augmented-reality","marker-tracking","pose-estimation","ar-js"],"author":{"name":"Walter Perdan"},"license":"MIT","_id":"@ar-js-org/artoolkit5-wasm@0.1.2","maintainers":[{"name":"kalwalt","email":"info@kalwaltart.it"},{"name":"nickw1","email":"nickw4426@gmail.com"},{"name":"nicolocarpignoli","email":"nicolocarpignoli@gmail.com"}],"homepage":"https://github.com/ar-js-org/artoolkit5-wasm#readme","bugs":{"url":"https://github.com/ar-js-org/artoolkit5-wasm/issues"},"dist":{"shasum":"50167ec645cf66da4ee9482845e4f892ae020d04","tarball":"https://registry.npmjs.org/@ar-js-org/artoolkit5-wasm/-/artoolkit5-wasm-0.1.2.tgz","fileCount":11,"integrity":"sha512-8P2aey2v7sN0hFGNandBZxEEnOUsgKys2P/GRIrNr/22c/44xV+vp/9A0IOutyDkBARMK3Ds2O2bceOqDamLXw==","signatures":[{"sig":"MEUCIQClQGmdr2eSbTOUkEC1cohr0F3BoXJOxsxi37YZRb+rZwIgUm4nhZWJizpI2/wov/cdQ6eNKgWOtPVovWXCFHQnE+M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":500431},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./loader":{"types":"./dist/loader.d.ts","import":"./dist/loader.js"}},"gitHead":"4c29d4bcbb1001684daec161296cf1319961e679","scripts":{"build":"npm run build:wasm && npm run build:wrap","clean":"node -e \"const fs=require('fs');['dist/index.js','dist/index.js.map','dist/index.d.ts','dist/index.d.ts.map','dist/loader.d.ts','dist/loader.d.ts.map','dist/src'].forEach(p=>{try{fs.rmSync(p,{recursive:true,force:true})}catch{}})\"","lint:cpp":"node scripts/clang-format.mjs --lint","build:wasm":"node scripts/build-wasm-docker.mjs","build:wrap":"npm run clean && vite build && tsc -p tsconfig.build.json","format:cpp":"node scripts/clang-format.mjs"},"_npmUser":{"name":"kalwalt","email":"info@kalwaltart.it"},"repository":{"url":"git+https://github.com/ar-js-org/artoolkit5-wasm.git","type":"git"},"_npmVersion":"10.9.4","description":"A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@ar-js-org/artoolkit5-constants":"^0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^13.0.6","vite":"8.0.16","typescript":"^7.0.2","clang-format":"^1.8.0"},"_npmOperationalInternal":{"tmp":"tmp/artoolkit5-wasm_0.1.2_1786355350529_0.18843753315112188","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@ar-js-org/artoolkit5-wasm","version":"0.1.3","keywords":["artoolkit","artoolkit5","wasm","webassembly","webarkitlib","ar","augmented-reality","marker-tracking","pose-estimation","ar-js"],"author":{"name":"Walter Perdan"},"license":"MIT","_id":"@ar-js-org/artoolkit5-wasm@0.1.3","maintainers":[{"name":"kalwalt","email":"info@kalwaltart.it"},{"name":"nickw1","email":"nickw4426@gmail.com"},{"name":"nicolocarpignoli","email":"nicolocarpignoli@gmail.com"}],"homepage":"https://github.com/ar-js-org/artoolkit5-wasm#readme","bugs":{"url":"https://github.com/ar-js-org/artoolkit5-wasm/issues"},"dist":{"shasum":"a6db9a2293437a0c52127483cbbb9a819d528e4b","tarball":"https://registry.npmjs.org/@ar-js-org/artoolkit5-wasm/-/artoolkit5-wasm-0.1.3.tgz","fileCount":11,"integrity":"sha512-ZFGgHnOaSGMoENE2Ist4siL0aYJJgr9GftWabwfupPjLrzGLX9PH40O3s91CQptEGPVmGuD/bzcSEcKHnnHWxQ==","signatures":[{"sig":"MEQCIFvcily/hRL21+NF3fcB31ROZchsaPPSypG/tIMEvJTmAiAu4eBNmKLn1f2q60oZPjo5KrcK3XVe+hnf0fUffgsSDA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":516579},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./loader":{"types":"./dist/loader.d.ts","import":"./dist/loader.js"}},"gitHead":"bb7612e3454e7d9e4ec9a2be9a8f5593702f577c","scripts":{"build":"npm run build:wasm && npm run build:wrap","clean":"node -e \"const fs=require('fs');['dist/index.js','dist/index.js.map','dist/index.d.ts','dist/index.d.ts.map','dist/loader.d.ts','dist/loader.d.ts.map','dist/src'].forEach(p=>{try{fs.rmSync(p,{recursive:true,force:true})}catch{}})\"","lint:cpp":"node scripts/clang-format.mjs --lint","build:wasm":"node scripts/build-wasm-docker.mjs","build:wrap":"npm run clean && vite build && tsc -p tsconfig.build.json","format:cpp":"node scripts/clang-format.mjs"},"_npmUser":{"name":"kalwalt","email":"info@kalwaltart.it"},"repository":{"url":"git+https://github.com/ar-js-org/artoolkit5-wasm.git","type":"git"},"_npmVersion":"10.9.4","description":"A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@ar-js-org/artoolkit5-constants":"^0.2.0"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^13.0.6","vite":"8.0.16","typescript":"^7.0.2","clang-format":"^1.8.0"},"_npmOperationalInternal":{"tmp":"tmp/artoolkit5-wasm_0.1.3_1786786004189_0.4048939238026399","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ar-js-org/artoolkit5-wasm","version":"0.2.0","keywords":["artoolkit","artoolkit5","wasm","webassembly","webarkitlib","ar","augmented-reality","marker-tracking","pose-estimation","ar-js"],"author":{"name":"Walter Perdan"},"license":"MIT","_id":"@ar-js-org/artoolkit5-wasm@0.2.0","maintainers":[{"name":"kalwalt","email":"info@kalwaltart.it"},{"name":"nickw1","email":"nickw4426@gmail.com"},{"name":"nicolocarpignoli","email":"nicolocarpignoli@gmail.com"}],"homepage":"https://github.com/ar-js-org/artoolkit5-wasm#readme","bugs":{"url":"https://github.com/ar-js-org/artoolkit5-wasm/issues"},"dist":{"shasum":"4ec42d04bfdc5ffb3c18597fa1c3f478e8f26b4b","tarball":"https://registry.npmjs.org/@ar-js-org/artoolkit5-wasm/-/artoolkit5-wasm-0.2.0.tgz","fileCount":11,"integrity":"sha512-O2hx/CGX8wty5Qo9rPJkJvKKFmJw09TcTnIOC5PxHtJIwV2REI+xZJfqOOFzvyP9725/Z5RWjcaDqI9syBfTGA==","signatures":[{"sig":"MEUCIBit/Cqjc166O70Tukal1QMKE9sgu66BJm4U3UJDRiINAiEApddc2rv8wwAUM5imehGfGVCh/1j7VafX6LeQSOI82sw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCU145s/zc/iXNSODYI2/tUOLtF2h2f0sxtF/RIkfBNmgIgSvkYfi0qwoZM68vx+k9ElvfbC//t/Yl4X54dKuZMEkY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":519388},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./loader":{"types":"./dist/loader.d.ts","import":"./dist/loader.js"}},"gitHead":"0b3203b8a5a8d55817b1b1cd4565b6046647c48c","scripts":{"build":"npm run build:wasm && npm run build:wrap","clean":"node -e \"const fs=require('fs');['dist/index.js','dist/index.js.map','dist/index.d.ts','dist/index.d.ts.map','dist/loader.d.ts','dist/loader.d.ts.map','dist/src'].forEach(p=>{try{fs.rmSync(p,{recursive:true,force:true})}catch{}})\"","lint:cpp":"node scripts/clang-format.mjs --lint","build:wasm":"node scripts/build-wasm-docker.mjs","build:wrap":"npm run clean && vite build && tsc -p tsconfig.build.json","format:cpp":"node scripts/clang-format.mjs"},"_npmUser":{"name":"kalwalt","email":"info@kalwaltart.it"},"repository":{"url":"git+https://github.com/ar-js-org/artoolkit5-wasm.git","type":"git"},"_npmVersion":"10.9.4","description":"A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@ar-js-org/artoolkit5-constants":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^13.0.6","vite":"8.0.16","typescript":"^7.0.2","clang-format":"^1.8.0"},"_npmOperationalInternal":{"tmp":"tmp/artoolkit5-wasm_0.2.0_1788211632846_0.7656300326214645","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@ar-js-org/artoolkit5-wasm@0.3.0","bugs":{"url":"https://github.com/ar-js-org/artoolkit5-wasm/issues"},"dist":{"shasum":"7cf0de0c1982c107b15497c5592ccf52f807f21a","tarball":"https://registry.npmjs.org/@ar-js-org/artoolkit5-wasm/-/artoolkit5-wasm-0.3.0.tgz","fileCount":11,"integrity":"sha512-ORmsFPsPNG3fPx8sNyZmMCB/sRnUUjSH9k9sBrFjBPrrKO7GcOdNzpaTz4Cv6LRmuWjKWNSVLPyIr8mfEBBNRg==","signatures":[{"sig":"MEQCIHb0nD8h9yWLWlAlK720gccVOSyx7q5ckVspKH74qgKaAiAE3Iv8TN8RWN3+Jlw7XujJKGgP2jBDgl9w6YqLAVbzLA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDKt2IR8npBeAHBt+rBxSoGUlKd9ATy+SzOv7rwDSF7PAiEAhtRGlewUwMHphmWlROWyM4yROYPhPylU3Y+Wjl+AzYY="}],"unpackedSize":519874},"main":"./dist/index.js","name":"@ar-js-org/artoolkit5-wasm","type":"module","types":"./dist/index.d.ts","author":{"name":"Walter Perdan"},"module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./loader":{"types":"./dist/loader.d.ts","import":"./dist/loader.js"}},"gitHead":"aba737350c2b8013f11f93e16f5956ff9fa547e4","license":"MIT","scripts":{"build":"npm run build:wasm && npm run build:wrap","clean":"node -e \"const fs=require('fs');['dist/index.js','dist/index.js.map','dist/index.d.ts','dist/index.d.ts.map','dist/loader.d.ts','dist/loader.d.ts.map','dist/src'].forEach(p=>{try{fs.rmSync(p,{recursive:true,force:true})}catch{}})\"","lint:cpp":"node scripts/clang-format.mjs --lint","build:wasm":"node scripts/build-wasm-docker.mjs","build:wrap":"npm run clean && vite build && tsc -p tsconfig.build.json","format:cpp":"node scripts/clang-format.mjs"},"version":"0.3.0","_npmUser":{"name":"kalwalt","email":"info@kalwaltart.it"},"homepage":"https://github.com/ar-js-org/artoolkit5-wasm#readme","keywords":["artoolkit","artoolkit5","wasm","webassembly","webarkitlib","ar","augmented-reality","marker-tracking","pose-estimation","ar-js"],"repository":{"url":"git+https://github.com/ar-js-org/artoolkit5-wasm.git","type":"git"},"_npmVersion":"11.19.0","description":"A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.","directories":{},"maintainers":[{"name":"kalwalt","email":"info@kalwaltart.it"},{"name":"nickw1","email":"nickw4426@gmail.com"},{"name":"nicolocarpignoli","email":"nicolocarpignoli@gmail.com"}],"_nodeVersion":"24.20.0","dependencies":{"@ar-js-org/artoolkit5-constants":"^0.3.0"},"_hasShrinkwrap":false,"devDependencies":{"glob":"^13.0.6","vite":"8.0.16","typescript":"^7.0.2","clang-format":"^1.8.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/artoolkit5-wasm_0.3.0_1789027776812_0.8484959402744672"}}},"time":{"created":"2026-08-10T09:49:10.313Z","modified":"2026-09-10T08:09:37.178Z","0.1.2":"2026-08-10T09:49:10.692Z","0.1.3":"2026-08-15T09:26:44.320Z","0.2.0":"2026-08-31T21:27:12.964Z","0.3.0":"2026-09-10T08:09:36.920Z"},"bugs":{"url":"https://github.com/ar-js-org/artoolkit5-wasm/issues"},"author":{"name":"Walter Perdan"},"license":"MIT","homepage":"https://github.com/ar-js-org/artoolkit5-wasm#readme","keywords":["artoolkit","artoolkit5","wasm","webassembly","webarkitlib","ar","augmented-reality","marker-tracking","pose-estimation","ar-js"],"repository":{"url":"git+https://github.com/ar-js-org/artoolkit5-wasm.git","type":"git"},"description":"A high-performance WebAssembly port of WebARKitLib (ARToolKit5) for marker tracking, pose estimation, and marker generation in the browser and Node.js.","maintainers":[{"name":"kalwalt","email":"info@kalwaltart.it"},{"name":"nickw1","email":"nickw4426@gmail.com"},{"name":"nicolocarpignoli","email":"nicolocarpignoli@gmail.com"}],"readme":"# 🚀 artoolkit5-wasm\r\n\r\n[![GitHub stars](https://img.shields.io/github/stars/ar-js-org/artoolkit5-wasm?style=flat-square)](https://github.com/ar-js-org/artoolkit5-wasm/stargazers)\r\n[![GitHub forks](https://img.shields.io/github/forks/ar-js-org/artoolkit5-wasm?style=flat-square)](https://github.com/ar-js-org/artoolkit5-wasm/network/members)\r\n[![CI](https://github.com/ar-js-org/artoolkit5-wasm/actions/workflows/ci.yml/badge.svg)](https://github.com/ar-js-org/artoolkit5-wasm/actions)\r\n[![npm version](https://img.shields.io/npm/v/@ar-js-org/artoolkit5-wasm?style=flat-square)](https://www.npmjs.com/package/@ar-js-org/artoolkit5-wasm)\r\n[![Types](https://img.shields.io/badge/Types-included-blue?style=flat-square)](https://github.com/ar-js-org/artoolkit5-wasm/blob/main/dist/index.d.ts)\r\n[![License](https://img.shields.io/github/license/ar-js-org/artoolkit5-wasm?style=flat-square)](https://github.com/ar-js-org/artoolkit5-wasm/blob/main/LICENSE)\r\n\r\nA 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.\r\n\r\n---\r\n\r\n## 📦 Installation\r\n\r\nInstall the package via `npm`:\r\n\r\n```bash\r\nnpm install @ar-js-org/artoolkit5-wasm\r\n```\r\n\r\n### 🔗 Peer Dependencies\r\nThis library relies on `@ar-js-org/artoolkit5-constants` for shared ARToolKit constant values. Ensure it is installed in your project:\r\n\r\n```bash\r\nnpm install @ar-js-org/artoolkit5-constants\r\n```\r\n\r\n---\r\n\r\n## 🛠️ Usage & API Reference\r\n\r\n### 1. ⚙️ Initialization\r\nInitialize the WebAssembly runtime using the `createARToolKit` factory. You can optionally configure paths for loading the `.wasm` binary:\r\n\r\n```javascript\r\nimport { createARToolKit } from '@ar-js-org/artoolkit5-wasm';\r\n\r\nconst { mod, core, constants } = await createARToolKit({\r\n  locateFile: (path, prefix) => `node_modules/@ar-js-org/artoolkit5-wasm/dist/${path}`,\r\n  quiet: false // Set to true to suppress initialization logs\r\n});\r\n```\r\n\r\n* **`mod`**: The raw Emscripten module.\r\n* **`core`**: The initialized `ARToolKitCore` instance.\r\n* **`constants`**: An object containing essential marker detection constants.\r\n\r\n---\r\n\r\n### 2. 📁 URL Loaders\r\nARToolKit 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`):\r\n\r\n```javascript\r\nimport { loadCameraFromUrl, addMarkerFromUrl } from '@ar-js-org/artoolkit5-wasm';\r\n\r\n// Load camera calibration file\r\nawait loadCameraFromUrl(mod, core, 'path/to/camera_para.dat', '/data/camera_para.dat');\r\n\r\n// Load pattern marker file\r\nconst pattId = await addMarkerFromUrl(mod, core, 'path/to/patt.hiro', '/data/patt.hiro');\r\n```\r\n\r\n---\r\n\r\n### 3. 📹 Video Frame Processing & Tracking\r\nPass video frame data to the WebAssembly module and detect markers inside your frame loop (e.g. `requestAnimationFrame`):\r\n\r\n```javascript\r\n// Initialize camera tracker dimensions\r\ncore.setup(width, height, cameraID);\r\n\r\nfunction processFrame(videoElementData, videoLumaData) {\r\n  // Pass video frames as Uint8Array/typed arrays\r\n  core.passVideoData(videoElementData, videoLumaData, true);\r\n\r\n  // Run marker detection\r\n  const numDetected = core.detectMarker();\r\n  if (numDetected > 0) {\r\n    const markerNum = core.getMarkerNum();\r\n    \r\n    for (let i = 0; i < markerNum; i++) {\r\n      const markerInfo = core.getMarkerInfo(i);\r\n      \r\n      // Calculate pose matrix (places calculation result in a shared C++ memory address)\r\n      const markerWidth = 80; // physical width of marker in millimeters\r\n      core.getTransMatSquare(i, markerWidth);\r\n\r\n      // Access the 3x4 pose matrix directly from WASM heap to avoid copying overhead\r\n      const ptr = core.getTransform();\r\n      const poseMatrix = mod.HEAPF64.subarray(ptr >> 3, (ptr >> 3) + 12);\r\n      \r\n      console.log(`Detected Marker ID: ${markerInfo.id}`);\r\n      console.log(\"3x4 Transform Matrix:\", poseMatrix);\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n---\r\n\r\n## 💻 Development & Building\r\n\r\n### 📋 Prerequisites\r\nTo build the project from source, you need:\r\n* **Node.js** (v22.x or later)\r\n* **Docker** (to compile the C++ source via Emscripten)\r\n* **Git** (for submodule management)\r\n\r\n---\r\n\r\n### 🔨 Compilation Instructions\r\n\r\nFirst, clone the repository recursively to fetch the nested submodules:\r\n```bash\r\ngit clone --recursive https://github.com/ar-js-org/artoolkit5-wasm.git\r\ncd artoolkit5-wasm\r\nnpm install\r\n```\r\n\r\n#### 1. Compile C++ to WebAssembly 🐳\r\nCompiles the C++ source using Emscripten running inside a Docker container:\r\n```bash\r\nnpm run build:wasm\r\n```\r\n\r\n#### 2. Build TypeScript Wrapper 📦\r\nBundles the JS/TS wrappers using Vite and compiles the declarations:\r\n```bash\r\nnpm run build:wrap\r\n```\r\n\r\n#### 3. Build All 🚀\r\nPerforms both C++ WebAssembly and JS/TS wrapper builds:\r\n```bash\r\nnpm run build\r\n```\r\n\r\n---\r\n\r\n### 🔍 Code Quality & Linting\r\nValidate C++ code formatting using `clang-format`:\r\n\r\n```bash\r\n# Run lint check\r\nnpm run lint:cpp\r\n\r\n# Automatically format C++ code\r\nnpm run format:cpp\r\n```\r\n\r\n---\r\n\r\n## 🌐 Examples\r\n\r\nCheck out the included interactive examples in the `examples/` directory:\r\n\r\n1. **`examples/smoke.html`**: A simple, raw WebAssembly initialization and basic marker addition test.\r\n2. **`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.\r\n\r\nTo run the examples locally, start a static file server:\r\n```bash\r\nnpx vite\r\n```\r\nThen navigate to `http://localhost:5173/examples/webcam.html` in your web browser.\r\n\r\n---\r\n\r\n## 📄 License\r\n\r\nThis library is licensed under the **MIT License**.","readmeFilename":"README.md"}