Skip to content

Instantly share code, notes, and snippets.

@fluidglassml
Created May 17, 2014 03:51
Show Gist options
  • Save fluidglassml/72f76c3019b81f5efd5d to your computer and use it in GitHub Desktop.
Save fluidglassml/72f76c3019b81f5efd5d to your computer and use it in GitHub Desktop.
[wearscript] failed effort to retrofit new ar syntax
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<script>
function main() {
WS.say("Hello A R");
if (WS.scriptVersion(1)) return;
WS.cameraOnBackgroundUnsafe(1, 360, 640);
var model_ar = btoa(msgpack.pack([{'kw': {}, 'name': 'picarus.ARMarkerDetector'}]).map(function (x) {return String.fromCharCode(x)}).join(''));
WS.picarusModelFactory(model_ar, (function (model) {
this.model = model;
// model = new WS.PicarusModel(model_ar, function () {
this.processStream(function (tags) {
tags = msgpack.unpack(tags);
if (tags && tags[0].length) {
var numTags = tags[0].length / 9;
var tagNames = '';
for (var i = 0; i < numTags; i++) {
tagNames += tags[0][9 * i] + ' ';
}
console.log(JSON.stringify(tagNames));
// WS.say(tagNames);
}
}).bind(this);
}).bind(this));
}
window.onload = main;
</script>
</body>
</html>
{"name":"Costello Myo"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment