Access Kinect RGB image data from ZigJS

◇◆丶佛笑我妖孽 提交于 2019-12-06 14:41:18

问题


I have ZigJS running in the browser and everything is working well, but I want to record the Kinect webcam images in order to play them back as a recorded video. I've looked through the documentation at http://zigfu.com/apidoc/ but cannot find anything related to the RGB information.

However, this SO answer leads me to believe this is possible:

We also support serialization of the depth and RGB image into canvas objects in the browser

Is it possible to capture the RGB image data from ZigJS and if so how?


回答1:


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});


来源:https://stackoverflow.com/questions/9543248/access-kinect-rgb-image-data-from-zigjs

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