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 ((char*)depthPixels, depthFrame.getHeight()*depthFrame.getWidth()*sizeof(uint16_t)); depth_buffer_counter++; printf("Dumped Depth Buffer %d\n",depth_buffer_counter); myFile.close(); delete...