Access Kinect RGB image data from ZigJS

烈酒焚心 提交于 2019-12-04 20:30:18

Assuming you have plugin version 0.9.7, something along the lines of:

var plugin = document.getElementById("ZigPlugin"); // the <object> element
plugin.requestStreams(false, true, false); // tell the plugin to update the RGB image
plugin.addEventListener("NewFrame", function() { // triggered every new kinect frame
    var rgbImage = Base64.decode(plugin.imageMap);
    // plugin.imageMapResolution stores the resolution, right now hard-coded
    // to QQVGA (160x120 for CPU-usage reasons)
    // do stuff with the image
}

Also, I recommend you take the base64 decoder I wrote, from, say, http://motionos.com/webgl because it's an order of magnitude faster than the random javascript decoders I found via Google.

If you have version 0.9.8 of the plugin, there was an API change, so you should call:

plugin.requestStreams({updateImage:true});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!