Git Product home page Git Product logo

jsartoolkit5's Introduction

ARToolKit.js

Emscripten port of ARToolKit to JavaScript.

MArkers Types

JSARToolKit5 support these types of markers:

  • Square pictorial markers
  • Square barcode markers
  • Multi square markers set
  • NFT (natural feature tracking) markers

NOTE:

When writing JavaScript and making changes be aware that the emscripten uglifier does not support the ES6 syntax.


Project Structure

  • build/ (compiled debug and minified versions of ARToolKit.js)
  • doc/ (documentation, coming...)
  • emscripten/ (source code for ARToolKit.js)
  • examples/ (demos and examples using ARToolKit.js)
  • js/ (compiled versions of ARToolKit.js with Three.js helper api)
  • tools/ (build scripts for building ARToolKit.js)

WebAssembly

JSARToolKit5 supports WebAssembly. The libary builds two WebAssembly artifacts during the build process. These are build/artoolkit_wasm.js and build/artoolkit_wasm.wasm. To use those, include the artoolkit_wasm.js into your html page and define var artoolkit_wasm_url = '<<PATH TO>>/artoolkit_wasm.wasm'; before loading the artoolkit_wasm.js file, like this:

<script type='text/javascript'>
      var artoolkit_wasm_url = '../build/artoolkit_wasm.wasm';
</script>
<script src="../build/artoolkit_wasm.js"></script>

As loading the WebAssembly artifact is done asynchronously, there is a callback that is called when everything is ready.

window.addEventListener('artoolkit-loaded', () => {
    //do artoolkit stuff here
});

See examples/simple_image_wasm.html for details.

Clone the repository

  1. Clone this repository
  2. Clone ARToolKit5 project to get the latest source files. From within jsartoolkit5 directory do git submodule update --init. If you already cloned ARToolKit5 to a different directory you can:
  • create a link in the jsartoolkit5/emscripten/ directory that points to ARToolKit5 (jsartoolkit5/emscripten/artoolkit5) (Linux and macOS only)
  • or, set the ARTOOLKIT5_ROOT environment variable to point to your ARToolKit5 clone
  • or, change the tools/makem.js file to point to your artoolkit5 clone (line 20)

Build the project

Recommended: Build using Docker

  1. Install Docker (if you havn't already): get Docker
  2. Clone artoolkit5 repository on your machine: git submodule update --init
  3. npm install
  4. From inside jsartoolkit5 directory run docker run -dit --name emscripten -v $(pwd):/src trzeci/emscripten-slim:latest bash to download and start the container, in preparation for the build
  5. docker exec emscripten npm run build-local to build JS version of artoolkit5
  6. docker stop emscripten to stop the container after the build, if needed
  7. docker rm emscripten to remove the container
  8. docker rmi trzeci/emscripten-slim:latest to remove the Docker image, if you don't need it anymore
  9. The build artifacts will appear in /build. There's a build with debug symbols in artoolkit.debug.js file and the optimized build with bundled JS API in artoolkit.min.js; also, a WebAssembly build artoolkit_wasm.js and artoolkit_wasm.wasm

⚠️ Not recommended ⚠️ : Build local with manual emscripten setup

To prevent issues with Emscripten setup and to not have to maintain several build environments (macOS, Windows, Linux) we only maintain the Build using Docker. Following are the instructions of the last know build on Linux which we verified are working. Use at own risk. ** Not working on macOS!**

  1. Install build tools
  2. Install node.js (https://nodejs.org/en/)
  3. Install python2 (https://www.python.org/downloads/)
  4. Install emscripten (https://emscripten.org/docs/getting_started/downloads.html#download-and-install) We used emscripten version 1.39.5-fastcomp 1.38.44-fastcomp

jsartoolkit5 aim is to create a Javascript version of artoolkit5. First, you need the artoolkit5 repository on your machine: 2. Clone ARToolKit5 project to get the latest source files. From within jsartoolkit5 directory do git submodule update --init. If you already cloned ARToolKit5 to a different directory you can:

  • create a link in the jsartoolkit5/emscripten/ directory that points to ARToolKit5 (jsartoolkit5/emscripten/artoolkit5)
  • or, set the ARTOOLKIT5_ROOT environment variable to point to your ARToolKit5 clone
  • or, change the tools/makem.js file to point to your artoolkit5 clone (line 20)
  1. Building
  2. Make sure EMSCRIPTEN env variable is set (e.g. EMSCRIPTEN=/usr/lib/emsdk_portable/emscripten/master/ node tools/makem.js
  3. Run npm install
  4. Run npm run build-local

During development, you can run npm run watch, it will rebuild the library everytime you change ./js/ directory.

  1. The built ASM.js files are in /build. There's a build with debug symbols in artoolkit.debug.js and the optimized build with bundled JS API in artoolkit.min.js.

ARToolKit JS API

<script src="../build/artoolkit.min.js">
// include optimized ASM.js build and JS API
</script>

ARToolKit JS debug build

<script async src="../build/artoolkit.debug.js">
// - include debug build
</script>
<script src="../js/artoolkit.api.js">
// - include JS API
</script>

ARToolKit Three.js helper API

<script src="../build/artoolkit.min.js">
// - include optimized ASM.js build and JS API
</script>
<script src="js/third_party/three.js/three.min.js">
// - include Three.js
</script>
<script src="../js/artoolkit.three.js">
// - include Three.js helper API
</script>
<script>
window.ARThreeOnLoad = function () {
console.log("Three.js helper API loaded");
};
if (window.ARController && window.ARController.getUserMediaThreeScene) {
ARThreeOnLoad();
};
</script>

Examples

See examples/ for examples on using the raw API and the Three.js helper API.

The basic operation goes like this:

  1. Load a ARCameraParam object
  2. Create a ARController object
  3. Set pattern detection mode
  4. Load pattern markers or multimarkers if needed
  5. Add a 'getMarker' event listener
  6. Call ARController.process(img)

Basic example with an image source and a pattern marker ( hiro )

<script src="../build/artoolkit.min.js"></script>
<script>
  var param = new ARCameraParam();

  param.onload = function () {
    var img = document.getElementById('my-image');
    var ar = new ARController(img.width, img.height, param);

    // Set pattern detection mode to detect both pattern markers and barcode markers.
    // This is more error-prone than detecting only pattern markers (default) or only barcode markers.
    //
    // For barcode markers, use artoolkit.AR_MATRIX_CODE_DETECTION
    // For pattern markers, use artoolkit.AR_TEMPLATE_MATCHING_COLOR
    //
    ar.setPatternDetectionMode(artoolkit.AR_TEMPLATE_MATCHING_COLOR_AND_MATRIX);

    ar.addEventListener('markerNum', function (ev) {
      console.log('got markers', markerNum);
    });
    ar.addEventListener('getMarker', function (ev) {
      console.log('found marker?', ev);
    });
    ar.loadMarker('Data/patt.hiro', function (marker) {
      console.log('loaded marker', marker);
      ar.process(img);
    });
};

  param.src = 'Data/camera_para.dat';
</script>

Basic example with a worker and a NFT marker

NFT (Natural Feature Tracking) is a markerless technology that let you track almost any images you want. To use this feature take a look at the nft_improved_worker example folder. If you want to create your custom NFT marker you can use the online tool NFT-Marker-Creator. Before proceeding with the creation of your markers, carefully read the information on the wiki.

In the code below a summarized example:

<div id="container">
    <video id="video"></video>
    <canvas style="position: absolute; left:0; top:0" id="canvas_draw"></canvas>
</div>
// main worker create the web worker see in the examples/nft_improved_worker for details
<script src="main_worker.js"></script>
<script>
var container = document.getElementById('container');
var video = document.getElementById('video');
var canvas_draw = document.getElementById('canvas_draw');

if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
    var hint = {};
    if (isMobile()) {
        hint = {
            facingMode: {"ideal": "environment"},
            audio: false,
            video: {
                width: {min: 240, max: 240},
                height: {min: 360, max: 360},
            },
        };
    }

    navigator.mediaDevices.getUserMedia({video: hint}).then(function (stream) {
        video.srcObject = stream;
        video.play();
        video.addEventListener("loadedmetadata", function() {
            start(container, markers["pinball"], video, video.videoWidth, video.videoHeight, canvas_draw, function() { statsMain.update() }, function() { statsWorker.update()) };
        });
    });
}
</script>

Constants

prepend all these constants with Module. or artoolkit.CONSTANTS to access them

- AR_DEBUG_DISABLE
- AR_DEBUG_ENABLE
- AR_DEFAULT_DEBUG_MODE
- AR_LABELING_WHITE_REGION
- AR_LABELING_BLACK_REGION
- AR_DEFAULT_LABELING_MODE
- AR_DEFAULT_LABELING_THRESH
- AR_IMAGE_PROC_FRAME_IMAGE
- AR_IMAGE_PROC_FIELD_IMAGE
- AR_DEFAULT_IMAGE_PROC_MODE
- AR_TEMPLATE_MATCHING_COLOR
- AR_TEMPLATE_MATCHING_MONO
- AR_MATRIX_CODE_DETECTION
- AR_TEMPLATE_MATCHING_COLOR_AND_MATRIX
- AR_TEMPLATE_MATCHING_MONO_AND_MATRIX
- AR_DEFAULT_PATTERN_DETECTION_MODE
- AR_USE_TRACKING_HISTORY
- AR_NOUSE_TRACKING_HISTORY
- AR_USE_TRACKING_HISTORY_V2
- AR_DEFAULT_MARKER_EXTRACTION_MODE
- AR_MAX_LOOP_COUNT
- AR_LOOP_BREAK_THRESH
- AR_MATRIX_CODE_3x3
- AR_MATRIX_CODE_3x3_HAMMING63 5
- AR_MATRIX_CODE_3x3_PARITY65 2
- AR_MATRIX_CODE_4x4
- AR_MATRIX_CODE_4x4_BCH_13_9_3 7
- AR_MATRIX_CODE_4x4_BCH_13_5_5 10
- AR_LABELING_THRESH_MODE_MANUAL
- AR_LABELING_THRESH_MODE_AUTO_MEDIAN
- AR_LABELING_THRESH_MODE_AUTO_OTSU
- AR_LABELING_THRESH_MODE_AUTO_ADAPTIVE
- AR_MARKER_INFO_CUTOFF_PHASE_NONE
- AR_MARKER_INFO_CUTOFF_PHASE_PATTERN_EXTRACTION
- AR_MARKER_INFO_CUTOFF_PHASE_MATCH_GENERIC
- AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONTRAST
- AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_NOT_FOUND
- AR_MARKER_INFO_CUTOFF_PHASE_MATCH_BARCODE_EDC_FAIL
- AR_MARKER_INFO_CUTOFF_PHASE_MATCH_CONFIDENCE
- AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR
- AR_MARKER_INFO_CUTOFF_PHASE_POSE_ERROR_MULTI
- AR_MARKER_INFO_CUTOFF_PHASE_HEURISTIC_TROUBLESOME_MATRIX_CODES

Build the tests

You can run an automated routine to make some tests, in the main jsartoolkit5 folder just run in a console the command:

npm run test

Then open the tests page:

http://localhost:8085/tests/index.html

Build the documentation

It is possible to build the api documentation, run this command in the main jsartoolkit5 folder:

npm run create-doc

The api documentation will be created in the doc folder. Navigate to the reference folder to view the api docs.

Issue tracker

If you found a bug or you have a feature request, or for any inquiries related to jsartoolkit5 development file an issue at:

github.com/artoolkitx/jsartoolkit5/issues

jsartoolkit5's People

Contributors

alexrobinson- avatar avin avatar hakandilek avatar jensarps avatar jeromeetienne avatar kalwalt avatar kbouw avatar kig avatar neuroforge avatar nicolocarpignoli avatar nylki avatar philip-lamb avatar ralphtheninja avatar takahirox avatar thorstenbux avatar yccgabriel avatar zz85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsartoolkit5's Issues

navigator.mediaDevices.getUserMedia is not a function

Issue by kevinwu
Tuesday May 17, 2016 at 18:12 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/23


I am following introduction.html; however, I have been getting the error above. Taking a look at artoolkit.min.js, getUserMedia does seem to be defined for ARController. Perhaps, I am overseeing something?

This is the code for reference:

var video = ARController.getUserMedia({
                maxARVideoSize: 320, // do AR processing on scaled down video of this size
                facing: "environment",
                onSuccess: function(video) {
                    console.log('got video', video);
                }
            });

Note that I have included artoolkit.min.js in the header.

Need a way stop AR on a-scene unloading

Issue by paztis
Monday Nov 20, 2017 at 20:53 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/73


Currently, when we remove the dom element, all 3d is stopped.
But the video and the overlay helpers (markersAreaEnabled and
trackingBackend) are still present.
If I restart again the AR, new overlay helpers arppears near the first one.

Is there a way to stop properly the AR (ie stop video, remove overlays, destroy ARController, ...) ? I really need it to display/hide the AR in an applicaiton lifetime.

Thanks

artoolkit.setup is not a function

Issue by Flikker
Wednesday Sep 27, 2017 at 09:07 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/66


I've got jsartoolkit working fine in an Android Cordova app - users click on a link (window.open) and jsartoolkit launches. But if I tap the back button then click on the link again, after a couple of times I get a nostream error saying "Typeerror: artoolkit.setup is not a function". I've pinpointed that it happens when it tries to load the ARCameraParam (Data/camera_para.dat).
It always works fine the first time and if I force close the app then try again.
Anyone know what might be going wrong?
A few possible issues I've thought through:

  • It always works the first time, so is there a process running that's preventing it working on subsequent loads, or preventing artoolkit.min.js from loading?
  • I don't think it's a caching issue; if I go into Settings and clear the app cache when it happens then try it again, it still doesn't work.
  • I've tried arcontroller.dispose to see if that was an issue; it didn't help, but maybe I wasn't using it correctly.
    Thank you for any help or insights you're able to give!

Passes the deviceId to getUserMedia

Issue by sdwolf
Tuesday Mar 28, 2017 at 19:57 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/pull/53


Also uses navigator.mediaDevices.getUserMedia() as first choice, falling back to navigator.getUserMedia(), just in case. I could not find anything that suggests current browsers have MediaStreamTrack.getSources() so I removed it (see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack)

This allows you to select a camera for Chrome on Android, and any other browser, as following:

function ARThreeOnLoad() {
  navigator
    .mediaDevices
    .enumerateDevices()
    .then(function(devices) {
      var device = devices.find(function(element) {
        return element.label.indexOf('back') !== -1
      })

      var videoParams = {deviceId: device ? {exact: device.deviceId} : undefined}

      cameraSuccess(videoParams);
    })
    .catch(function(err) {
      alert(err.name + ": " + err.message);
    })
}

function cameraSuccess(videoParams) {
  ARController.getUserMediaThreeScene({
    maxARVideoSize: 640,
    cameraParam:    'camera_para.dat',
    deviceId:       videoParams.deviceId,
    onSuccess:      createAR
  })
}

sdwolf included the following code: https://github.com/artoolkit/jsartoolkit5/pull/53/commits

CSS3Drenderer integration

Issue by daviderq
Thursday Nov 24, 2016 at 16:31 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/39


Any ideas on how to integrate html object (div, iframe, etc..) in the markerRoot scene using CSS3DRenderer of three.js?

(I'm not sure this is the correct place to post...)

I'm tring to follow these steps:

var renderer = new THREE.WebGLRenderer({antialias: true});
var rendererCSS = new THREE.CSS3DRenderer();
document.body.appendChild( renderer.domElement );
document.body.appendChild( rendererCSS.domElement );
markerRoot = arController.createThreeBarcodeMarker(20);
var element = document.createElement('div');
.... some html stuff....
var cssObject = new THREE.CSS3DObject( element );
... defining cssObjectproperties ...
markerRoot.add(cssObject);
arScene.cssScene.add(markerRoot); [i have defined a new cssScene in the arScene to be rendered with the css3drenderer]
var tick = function() {
arScene.process();
arScene.renderOn(renderer,rendererCSS);
....

In the "ARController.prototype.createThreeScene" (artoolkit.three.js file) I have addded:

		var cssScene = new THREE.Scene();

                   renderOn: function(renderer, cssRenderer) {
				videoTex.needsUpdate = true;
				var ac = renderer.autoClear;
				renderer.autoClear = false;
				cssRenderer.autoClear = false;
				renderer.clear();
				renderer.render(this.videoScene, this.videoCamera);
				renderer.render(this.scene, this.camera);
				cssRenderer.render(this.cssScene, this.camera);
				renderer.autoClear = ac;
				cssRenderer.autoClear = ac;
			}

Thanks.

is it possible to console log a marker's id?

Issue by dimpapadop
Monday Oct 30, 2017 at 19:07 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/69


hallo, i am using the following code from some examples i found...

<html>
<body>

<img id="my-image" src="Data/ee1.jpg"></img>
<script src="artoolkit.min.js"></script>
<script>
  var param = new ARCameraParam();

  param.onload = function () {
    var img = document.getElementById('my-image');
    var ar = new ARController(img.width, img.height, param);

    // Set pattern detection mode to detect both pattern markers and barcode markers.
    // This is more error-prone than detecting only pattern markers (default) or only barcode markers.
    //
    // For barcode markers, use artoolkit.AR_MATRIX_CODE_DETECTION
    // For pattern markers, use artoolkit.AR_TEMPLATE_MATCHING_COLOR
    //
    ar.setPatternDetectionMode(artoolkit.AR_TEMPLATE_MATCHING_COLOR_AND_MATRIX);
	//ar.setMatrixCodeType(artoolkit.CONSTANTS.AR_MATRIX_CODE_5x5);

    //ar.setPatternDetectionMode(artoolkit.AR_TEMPLATE_MATCHING_COLOR);
	//ar.setPatternDetectionMode(artoolkit.AR_MATRIX_CODE_DETECTION);
	
	
    ar.addEventListener('markerNum', function (ev) {
      console.log('got markers', markerNum);
    });
    ar.addEventListener('getMarker', function (ev) {
      console.log('found marker?', ev);
    });
    ar.loadMarker('Data/patt.hiro', function (marker) {
      console.log('loaded marker', marker);
      ar.process(img);
    });
};

  param.src = 'Data/camera_para.dat';
</script>
</body>
</html>

in the console log i am getting the message:
loaded marker 0

and as many messages as markers.. like the following
found marker? Object { name: "getMarker", target: Object, data: Object }

is it possible to console log each marker's id and x,y coordinates?
I need to get multiple marker id's & coordinates (many of them are repeated in an image file)
thank you.

Memory issue on Firefox

Issue by yuccai
Tuesday Aug 09, 2016 at 12:57 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/31


Hi,

I'm using jsartookit5 and I've noticed a memory problem on Firefox (I'm using version 50.0a2 (2016-08-08) developer desktop).
When I load the page, it uses around 250MB but each time I reload it, it adds these 250MB to the previous. So if I reload the page 3 times, it uses 750MB.
You can see what happen more precisely in the "about:memory" Firefox tab. In the section Web Content/Explicit Allocations, you can see that the "non-heap/elements/asm.js" is taking most of the memory size and this is this resource that is increased each time you reload the page.
I don't know where this issue comes from because it is non existent on chrome (both desktop and mobile). Mobiles without a lot of RAM suffers the most because only one reloading provokes an "out of memory" error.
Could you please explain to me the nature of the problem and a way to fix it? It would be wonderful :).

Thanks,
screenshot_20160809_145759

Safari11 on iOS11 Public beta and Android's Chrome

Issue by osper66
Sunday Aug 13, 2017 at 11:52 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/62


Hi.

I have tried to this a frame-ar on Android Firefox and it works well.

And then I did for Sarari11 and Android Chrome, however they showed only forward camera's video.

Knowing Following site, I could access to their rear cameras.

https://webrtc.github.io/samples/src/content/devices/input-output/

Could you add these function in current code?

Thanks for advance.

Make camera param configurable during runtime

Issue by jensarps
Wednesday Mar 16, 2016 at 11:38 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/18


As the camera param file seems to contain vital data regarding input aspect ration and camera properties, it would be great to be able to set/modify it.

To be able to do so, one would need to know how the file is constructed. I digged through the C code, but it didn't really tell me a lot. Is there a human readable documentation of the param file somewhere?

QUESTION: What is the Data Format of 'Data/patt.hiro'?

Issue by uscivics
Friday Sep 01, 2017 at 22:41 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/65


I'm looking to understand the format of the Data/patt.hiro and Data/patt.kanji maker files, and how to convert in order to generate my own.

They're included in the examples/pattern_and_barcode_threejs.html file.

I didn't see any reference as to what format they were in, so if anyone could shed some light that would be appreciated.

Thanks.

[CLOSED] [QUESTION] How to modify the default parameter of setPattRatio function? Is it related to the thickness/width of the borders of square markers?

Issue by Angelo8828
Monday Jan 08, 2018 at 07:37 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/80


According to this guide, the arSetPattRatio is the one that can be used to modify the width of a border's marker. Is it possible to change the width of a border of a square marker using that and if possible, then how?

EDIT: I rephrased the question so that it will become much clearer

Memory issue on Firefox

Issue by yuccai
Tuesday Aug 09, 2016 at 12:57 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/31


Hi,

I'm using jsartookit5 and I've noticed a memory problem on Firefox (I'm using version 50.0a2 (2016-08-08) developer desktop).
When I load the page, it uses around 250MB but each time I reload it, it adds these 250MB to the previous. So if I reload the page 3 times, it uses 750MB.
You can see what happen more precisely in the "about:memory" Firefox tab. In the section Web Content/Explicit Allocations, you can see that the "non-heap/elements/asm.js" is taking most of the memory size and this is this resource that is increased each time you reload the page.
I don't know where this issue comes from because it is non existent on chrome (both desktop and mobile). Mobiles without a lot of RAM suffers the most because only one reloading provokes an "out of memory" error.
Could you please explain to me the nature of the problem and a way to fix it? It would be wonderful :).

Thanks,
screenshot_20160809_145759

barcode 4x4 markers not working

Issue by teongleong
Saturday Dec 30, 2017 at 11:55 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/78


This issue is replicating a forum post's report.
https://stackoverflow.com/questions/46147947/artoolkit-ar-matrix-code-4x4
I verified that 4x4 bch 13 9 3 barcodes are indeed not work. Either that or I am doing something wrong.

#test 1#
arController.setPatternDetectionMode(artoolkit.AR_MATRIX_CODE_DETECTION);
arController.setMatrixCodeType(artoolkit.AR_MATRIX_CODE_4×4_BCH_13_9_3);

marker images:
http://www.mperfect.net/wpfAugReal/artoolkit_AllIdMarkers.gif

I've printed out the markerInfo
{pos: Array(2), line: Array(4), vertex: Array(4), area: 30335, id: -1, …}
area:31411
cf:0.1
cfMatrix:0.1
cfPatt:0
dir:0
dirMatrix:1
dirPatt:0
errorCorrected:0
id:-1
idMatrix:-1
idPatt:0
line:(4) [Array(3), Array(3), Array(3), Array(3)]
pos:(2) [781.475830078125, 669.177734375]
vertex:(4) [Array(2), Array(2), Array(2), Array(2)]
proto:Object

#test 2#
arController.setMatrixCodeType(artoolkit.AR_MATRIX_CODE_4×4);

marker images:
http://studierstube.icg.tugraz.at/handheld_ar.recent/images/artoolkit_BCH_thin_board.png

Only some of these can be tracked and the id are all out of order which makes me wonder if I am using the right markers.

Could we have the 4x4, 4x4_bch13_9_2, 4x4_bch_13_5_5 marker images hosted so that they can be more easily found?

Object Tap, Ray Caster and Intro Example.

Issue by tarikbenmerar
Sunday Apr 23, 2017 at 18:20 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/54


Hi,

I have been developing an AR game where we interact with 3D objects. I have used the Ray Caster example from Three.JS as a base but failed.

Then I tried the intro example where we open the box by tapping but didn't work on my phone. I have used a samsung S6 Edge Plus on a chrome browser.

I am really stuck here, I am rarely. Needs some help.

navigator.mediaDevices.getUserMedia is not a function

Issue by kevinwu
Tuesday May 17, 2016 at 18:12 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/23


I am following introduction.html; however, I have been getting the error above. Taking a look at artoolkit.min.js, getUserMedia does seem to be defined for ARController. Perhaps, I am overseeing something?

This is the code for reference:

var video = ARController.getUserMedia({
                maxARVideoSize: 320, // do AR processing on scaled down video of this size
                facing: "environment",
                onSuccess: function(video) {
                    console.log('got video', video);
                }
            });

Note that I have included artoolkit.min.js in the header.

Build not working on windows 10

Issue by NightkingCH
Monday May 22, 2017 at 21:34 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/55


Did anyone ever tried to get the build running on a windows machine?

"npm run build" does not work on a windows machine. Or at least on latest nodejs 7.10. It seems that npm assumes the ";" belongs to the file name.

Error: Cannot find module 'C:\Projects\jsartoolkit5\tools\makem.js;'

Then if I install "Emscripten" under the default path "C:\Program Files[...]" it throws an error like following: "The command 'C:\Program' could not be found". This is also windows related, would be great to see a warning or something else which states this :). After I uninstalled it, just move it around didn't fixed the problem, cause some variables which were set somewhere deep depended on the old path.

After 3 hours of trying I got stuck on this one:

Running command: C:\Emscripten\emscripten\1.35.0\emcc -IC:\Projects\jsartoolkit5\emscripten\artoolkit5\include -IC:\Projects\jsartoolkit5\build/ -IC:\Projects\jsartoolkit5\emscripten/ C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\AR\arLabelingSub*.c C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\AR*.c C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\ARICP*.c C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\ARMulti*.c C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\Gl\gsub_lite.c -Oz -Wno-warn-absolute-paths -s TOTAL_MEMORY=268435456 -s NO_BROWSER=1 --memory-init-file 0 --bind -o C:\Projects\jsartoolkit5\build/libar.bc

stderr: ERROR:root:C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\AR\arLabelingSub*.c: No such file or directory ("C:\Projects\jsartoolkit5\emscripten\artoolkit5\lib\SRC\AR\arLabelingSub*.c" was expected to be an input file, based on the commandline arguments provided)

So the glob pattern here doesn't work on windows either. He thinks "*.c" is a file.

Now I'm not able to build this beautiful project :(, anyone got an idea?

Make camera param configurable during runtime

Issue by jensarps
Wednesday Mar 16, 2016 at 11:38 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/18


As the camera param file seems to contain vital data regarding input aspect ration and camera properties, it would be great to be able to set/modify it.

To be able to do so, one would need to know how the file is constructed. I digged through the C code, but it didn't really tell me a lot. Is there a human readable documentation of the param file somewhere?

Barcode multimarker example not working

Issue by enguerranws
Tuesday Sep 13, 2016 at 13:17 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/34


On the example Barcode multimarker:
https://artoolkit.github.io/jsartoolkit5/examples/multimarker_barcode_threejs.html

I'm encountering this error:

Error opening pattern file '/00         ' for reading.
artoolkit.min.js:1 Error processing multimarker config file '/multi_marker_0': Unable to load pattern '/00          '.
artoolkit.min.js:1 config data load error !!
artoolkit.min.js:1 ARToolKitJS(): Unable to set up AR multimarker.

The relevant file is https://github.com/artoolkit/jsartoolkit5/blob/master/examples/Data/multi-barcode-4x3.dat

On Chrome 52, MacOs.

Is NFT Marker working in mobile?

Issue by densetsughem
Wednesday Jun 14, 2017 at 12:58 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/56


I tried using the sample loadNFTMArker but is it working in mobile?

arController.loadNFTMarker('nft-digify/data/pinball', function(markerId) {
var markerRoot = arController.createThreeNFTMarker(markerId);
alert(markerId);
// document.getElementById("mm").innerHTML = "LOAD NFT";

		console.log(markerRoot);
		
		markerRoot.add(sphere);
		arScene.scene.add(markerRoot);
	});

The code didn't detect the pinball marker.
thanks.

CSS3Drenderer integration

Issue by daviderq
Thursday Nov 24, 2016 at 16:31 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/39


Any ideas on how to integrate html object (div, iframe, etc..) in the markerRoot scene using CSS3DRenderer of three.js?

(I'm not sure this is the correct place to post...)

I'm tring to follow these steps:

var renderer = new THREE.WebGLRenderer({antialias: true});
var rendererCSS = new THREE.CSS3DRenderer();
document.body.appendChild( renderer.domElement );
document.body.appendChild( rendererCSS.domElement );
markerRoot = arController.createThreeBarcodeMarker(20);
var element = document.createElement('div');
.... some html stuff....
var cssObject = new THREE.CSS3DObject( element );
... defining cssObjectproperties ...
markerRoot.add(cssObject);
arScene.cssScene.add(markerRoot); [i have defined a new cssScene in the arScene to be rendered with the css3drenderer]
var tick = function() {
arScene.process();
arScene.renderOn(renderer,rendererCSS);
....

In the "ARController.prototype.createThreeScene" (artoolkit.three.js file) I have addded:

		var cssScene = new THREE.Scene();

                   renderOn: function(renderer, cssRenderer) {
				videoTex.needsUpdate = true;
				var ac = renderer.autoClear;
				renderer.autoClear = false;
				cssRenderer.autoClear = false;
				renderer.clear();
				renderer.render(this.videoScene, this.videoCamera);
				renderer.render(this.scene, this.camera);
				cssRenderer.render(this.cssScene, this.camera);
				renderer.autoClear = ac;
				cssRenderer.autoClear = ac;
			}

Thanks.

Can't use posterior camera while using ARThreeOnLoad

Issue by anargu
Monday Feb 13, 2017 at 05:04 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/49


According to the samples and documentation to use JsArtoolKit and Three.js (ARThreeOnLoad) I can pass an option object in which I can define which camera I want to use to then recognize the target and do something. i pass the following option object.

window.ARThreeOnLoad = function () {
	ARController.getUserMediaThreeScene( { 	
						facingMode: {exact:'environment'},
						maxARVideoSize: 320, 
						cameraParam: 'Data/camera_para-iPhone 5 rear 640x480 1.0m.dat',
	onSuccess: function(arScene, arController, arCamera) {

The documentation says facingMode can take any of these values: facingMode : 'environment' | 'user' | 'left' | 'right' | { exact: 'environment' | ... }

And if you want to take the posterior camera you should choose {exact:'environment'} (reference ) thing that I did but it doesn't work. Can anyone knows how to make it work? Thanks in advance

Barcode multimarker example not working

Issue by enguerranws
Tuesday Sep 13, 2016 at 13:17 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/34


On the example Barcode multimarker:
https://artoolkit.github.io/jsartoolkit5/examples/multimarker_barcode_threejs.html

I'm encountering this error:

Error opening pattern file '/00         ' for reading.
artoolkit.min.js:1 Error processing multimarker config file '/multi_marker_0': Unable to load pattern '/00          '.
artoolkit.min.js:1 config data load error !!
artoolkit.min.js:1 ARToolKitJS(): Unable to set up AR multimarker.

The relevant file is https://github.com/artoolkit/jsartoolkit5/blob/master/examples/Data/multi-barcode-4x3.dat

On Chrome 52, MacOs.

z-fighting issue with gltf 2.0 and obj models

Issue by DJviolin
Wednesday Aug 02, 2017 at 20:45 GMT
Originally opened as https://github.com/artoolkit/jsartoolkit5/issues/61


The history of this issue started in AR.js in issue #146 than I realised it's an issue within jsartoolkit5. This minimal example:

<html>
<head>
<title>Pattern marker example with Three.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<style>
html,body { margin: 0; padding: 0; width: 100%; text-align: center; overflow-x: hidden; }
.portrait canvas { transform-origin: 0 0; transform: rotate(-90deg) translateX(-100%); }
.desktop canvas { transform: scale(-1, 1); }
</style>
</head>
<body>

<script defer src='//rawcdn.githack.com/artoolkit/jsartoolkit5/77733182a4c519b8e683cbf246a22920d94f3deb/build/artoolkit.min.js'></script>
<script defer src='//rawcdn.githack.com/mrdoob/three.js/r84/build/three.min.js'></script>
<script defer src='//rawcdn.githack.com/artoolkit/jsartoolkit5/77733182a4c519b8e683cbf246a22920d94f3deb/js/artoolkit.three.js'></script>
<script defer src='//rawcdn.githack.com/mrdoob/three.js/288709543605a598a99e45a9c9bc1c388e0df76e/examples/js/loaders/GLTF2Loader.js'></script>

<script defer>
  window.ARThreeOnLoad = function() {
    ARController.getUserMediaThreeScene({maxARVideoSize: 320, cameraParam: 'data-jsartoolkit5/camera_para.dat',
      onSuccess: function(arScene, arController, arCamera) {
        var scene = new THREE.Scene();
        var renderer = new THREE.WebGLRenderer({
          antialias: true,
        });
        renderer.setPixelRatio(window.devicePixelRatio);
        renderer.setSize(window.innerWidth, window.innerHeight);
        document.body.appendChild(renderer.domElement);

        var ambient = new THREE.AmbientLight(0x222222);
        ambient.intensity = 5;
        arScene.scene.add(ambient);

        // Instantiate a loader
        var loader = new THREE.GLTF2Loader();
        // Load a glTF resource
        var url = './models/model.gltf';
        loader.load(url, function (gltf) {
          sphere = gltf.scene || gltf.scenes[0];
          sphere.rotation.x = 90 * (Math.PI / 180);
          sphere.rotation.y = 270 * (Math.PI / 180);
          sphere.rotation.z = 0 * (Math.PI / 180);

          arController.loadMarker('data-jsartoolkit5/patt.hiro', function(markerId) {
            var markerRoot = arController.createThreeMarker(markerId);
            markerRoot.add(sphere);
            arScene.scene.add(markerRoot);
          });

        });

        var tick = function() {
          arScene.process();
          arScene.renderOn(renderer);
          requestAnimationFrame(tick);
        };
        tick();
      }
    });
    delete window.ARThreeOnLoad;
  };

  if (window.ARController && ARController.getUserMediaThreeScene) {
    ARThreeOnLoad();
  }
</script>

</body>
</html>

Causing these strange triangle edges and dimming, maybe z-fighting?

fireshot capture 25 - pattern marker example with thre_ - http___127 0 0 1_8080_pattern_threejs html

gltf 2.0 workflow:

Sketchup -> Collada -> collada2gltf 2.0

Not related issue, but the latest working three.js release with jsartoolkit5 is r84.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.