1

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?

Community
  • 1
  • 1
zackdever
  • 1,642
  • 1
  • 13
  • 22

1 Answers1

4

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});
Roee Shenberg
  • 1,457
  • 1
  • 13
  • 22
  • You mentioned that the image map is hard-coded to 160x120. Is this still the case? Are there any plans to allow access to higher resolutions? – Jake Walsh Sep 22 '13 at 21:37
  • Unfortunately as long as the plugin model remains NPAPI it's untenable to change this. – Roee Shenberg Sep 24 '13 at 08:55