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

Converting the depth unit to millimetre

Until now, we have used the data of the depth stream relatively without knowing its real-world units; in this recipe, however, we are going to show you how it is possible to convert depth data into millimetre units. This could be used for generating point cloud, calculating distance, and so on.

First we try to find the depth value of the center pixel in the depth frame and then use the openni::CoordinateConverter class to convert this value into a real-world millimetre unit.

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 the following lines at the top of your ...

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