O'Reilly logo

OpenGL Data Visualization Cookbook by William C. Y. Lo, Raymond C. H. Lo

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

Capturing raw data from depth-sensing cameras

Now that you have installed the prerequisite libraries and drivers, we will demonstrate how to capture raw data from your depth-sensing camera.

How to do it...

To capture sensor data directly in a binary format, implement the following function:

void writeDepthBuffer(openni::VideoFrameRef depthFrame){ static int depth_buffer_counter=0; char file_name [512]; sprintf(file_name, "%s%d.bin", "depth_frame", depth_buffer_counter); openni::DepthPixel *depthPixels = new openni::DepthPixel[depthFrame.getHeight()*depthFrame.getWidth()]; memcpy(depthPixels, depthFrame.getData(), depthFrame.getHeight()*depthFrame.getWidth()*sizeof(uint16_t)); std::fstream myFile (file_name, std::ios::out |std::ios::binary); myFile.write ...

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