Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@ar-js-org/artoolkit5-js
Advanced tools
This is the artoolkit5-js fork for the AR.js project.
ES6 module port of artoolkit5. Based on the (now defunct) original Emscripten to JavaScript port and improved by Walter Perdan.
This build is uses WASM for best possible performance and is designed to be (more or less) a drop-in replacement for the previous jsartoolkit5. Some parts of the previous API have been refactored to implement an async interface instead of the previous callback based interface.
The @ar-js-org/artoolkit5-js package can be installed via NPM:
npm install @ar-js-org/artoolkit5-js
The module is built in UMD format and can be used in different environments:
<script src="/path/to/ARToolkit.js"></script>
const ARToolkit = require('artoolkit5-js');
import ARToolkit from 'artoolkit5-js';
First you need to create an instance of ARController
:
ARController.initWithDimensions(640, 480, '/data/camera_para.dat').then(controller => { ... });
This will create an ARController instance expecting source images of dimensions 640x480. The second parameter is a camera definition file which describes the characteristics of your image / video input device. If you don't know which file to use just use the default camera_para.dat included with this repository.
There is an alternative initializer initWithImage
available as convenience method which accepts an HTMLImageElement
or HTMLVideoElement
instead of width / height. However this obviously only works in Browser (or MonkeyPatched) environments.
Next you need to load the marker files to track with your controller. In this example the pattern file for the "Hiro" marker is loaded:
controller.artoolkit.addMarker(controller.id, '/data/hiro.patt').then(hiroMarkerId => { ... });
// track with 60 FPS
const FPS = 60;
setInterval(() => {
const result = controller.detectMarker();
if(result !== 0) {
// ARToolkit returning a value !== 0 means an error occured
console.log('Error detecting markers');
return;
}
// get the total number of detected markers in frame
const markerNum = controller.getMarkerNum();
let hiroFound = false;
// check if one of the detected markers is the "Hiro" marker
for(let i = 0; i < markerNum; i++) {
const markerInfo = controller.getMarker(i);
if(markerInfo.idPatt == hiroMarkerId) {
// store the marker ID from the detection result
hiroFound = i;
break;
}
}
if(hiroFound !== false) {
console.log("You have found the HIRO marker");
}
}, 1000 / FPS);
You can access all public ARToolkit methods and class constants like this:
// for the full API documentation see
// https://github.com/artoolkit/artoolkit5
artoolkit.detectMarker( ... );
console.log(artoolkit.AR_LOG_LEVEL_DEBUG);
Due to time constraints this build does not implement multimarker support (yet). Adding support should be trivial though as all the groundwork has already been laid out. I will implement it once time allows but PRs are of course welcome!
FAQs
ES6 module port of artoolkit5
The npm package @ar-js-org/artoolkit5-js receives a total of 256 weekly downloads. As such, @ar-js-org/artoolkit5-js popularity was classified as not popular.
We found that @ar-js-org/artoolkit5-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.