Created
April 18, 2014 06:06
-
-
Save bwhite/11026949 to your computer and use it in GitHub Desktop.
[weariverse] Picarus AR Tags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<head> | |
<!-- You can include external scripts here like so... --> | |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
</head> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
function armarkers() { | |
var model_ar = btoa(msgpack.pack([{'kw': {}, 'name': 'picarus.ARMarkerDetector'}]).map(function (x) {return String.fromCharCode(x)}).join('')); | |
WS.log(model_ar); | |
var model = new WS.PicarusModel(model_ar, function () { | |
WS.say('loaded') | |
model.processStream(function (x) { | |
WS.log("Input:" + x); | |
var data = msgpack.unpack(x); | |
WS.log(JSON.stringify(data)) | |
if (typeof data[0][0] !== 'undefined') | |
WS.say(data[0][0]); | |
WS.log(JSON.stringify(data)); | |
}); | |
}) | |
WS.cameraOnBackgroundUnsafe(.25, 360, 640); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
armarkers() | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment