O'Reilly logo

OpenNI Cookbook by Soroush Falahati

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving the color of the nearest point without depth over color registration

Let's say we want to retrieve the color of a pixel from its depth position but don't want to register the whole depth frame to the color frame. In this case, we can use the openni::CoordinateConverter class to get the position of the related depth pixel in the color frame; then, using the returned coordinates, we can get the color of this pixel. In this recipe, we try to find the nearest pixel in the depth frame and then show the color of this pixel from the color frame.

Getting ready

Create a project in Visual Studio 2010 and prepare it for working with OpenNI using the Creating a project in Visual Studio 2010 recipe of Chapter 2, OpenNI and C++.

How to do it...

  1. Add ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required