Skip to content

Instantly share code, notes, and snippets.

@fluidglassml
Created April 25, 2014 02:01
Show Gist options
  • Save fluidglassml/11275624 to your computer and use it in GitHub Desktop.
Save fluidglassml/11275624 to your computer and use it in GitHub Desktop.
[wearscript] read tags
<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(''));
model = new WS.PicarusModel(model_ar, function () {
model.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);
}
});
})}
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