Migrating Kinect1 to Kinect2 for realtime projection mapping

I have been attempting to migrate some of the realtime tracking and mapping code from a Kinect1 codebase to the Kinect2. I am at a point where I am not quite sure the next logical step. I have a few separate pieces working although there doesn’t seem to be any 1 to 1 code base from the current ofxKinect implementation to any Kinect2 wrapper.

I have looked at these two implementations, currently using ofxKinectForWindows2 and attempting to integrate into ofxKinectProjectorToolkit.

I am mostly curious if any of the core team of contributors are working towards an implementation of the Kinect2 that mirrors the Kinect1. I am still relatively new to working with OpenFrameworks (background primarily using Unity) and would love to contribute and help it grow. Anyone able to offer suggestions on how they might approach this would be greatly appreciated. Thanks!

ps: I imagine using the libfreenect2 library would be a logical approach although I am not quite sure how feature complete it is / the scope of wrapping this library.

Hi @ixikos. As far as I know, the two active addons for KinectV2 are ofxKinectForWindows2 (Windows-only) and ofxMultiKinectV2 (Mac-only-ish*). As you’ve noticed, the API for ofxKFW2 is quite different from ofxKinect, but ofxMultiKinectV2 is pretty similar. That uses libfreenect2 which is cross-platform, though the addon itself is Mac-only and would require some additional work to get it to work on other platforms.

You could take a look at a different addon, ofxKinectBlobFinder, which I’ve updated to work with ofxKFW2 instead of ofxKinect, to see what types of updates are needed. Take a look at src/ofxKinecBlobFinder.h & src/ofxKinecBlobFinder.cpp (not ofxKinect2BlobFinder.h/cpp):

One of the biggest differences is there’s no getWorldCoordinateAt(), though you can see an example of how to do the mapping in these lines:

You could also look at the differences between ofxKinectProjectorToolkit and ofxKinectProjectorToolkitV2 to get a sense of the needed changes.

On a related note, I’ve been working on a new addon, ofxDepthCamera, to help solve this exact problem of addons for different cameras each having their own APIs for accessing camera streams. It’s very much a work in progress, but I have successfully used it with ofxKinect on Mac & Windows, and ofxKFW2 on Windows, and only changing one line of code :smile: If you do end up checking it out and have issues/questions, feel free to let me know.

Good luck!