OpenNI 1.5.4
|
Source file: Click the following link to view the source code file:
- Statistics.cpp
This file contains the code for calculating the statistics for the frames from the OpenNI generator nodes.
Global Type Declarations for Statistics.cpp
The XnPixelStatistics data structure is defined in Statistics.h of this sample program.
XnPixelStatistics* g_PixelStatistics = NULL;
enum XnCollectionStatus
{
NOT_COLLECTING,
SHOULD_COLLECT,
COLLECTING,
COLLECTION_ENDED,
} g_StatisticsState;
Function: statisticsInit() - Initializes the Statistics Collecting Mechanism
This function initializes the statistics collecting mechanism.
This function gets a saved Frame Objects DepthGenerator node's "frame object", assigning them to pDepthMD
. The frame object is a snapshot of the generated data, saved as a metadata object, at a certain point in time. The xn::OutputMetaData::Data() method gets a pointer to the data frame of the frame object saved in the metadata.
const DepthMetaData* pDepthMD = getDepthMetaData(); if (pDepthMD != NULL) { g_PixelStatistics = new XnPixelStatistics[pDepthMD->FullXRes() * pDepthMD->FullYRes()]; }
The above code uses the FullXRes() method to calculate the scaling factor between the depth map and the GL window. FullXRes() gets the full frame resolution, i.e., the entire field-of-view, ignoring cropping of the FOV in the scene.
In the following, the xn::DepthGenerator::GetDeviceMaxDepth() method gets the maximum depth value that the DepthGenerator node can generate. The maximum depth value is a hardware specification of the sensor.
XnDepthPixel nMaxDepth = getDepthGenerator()->GetDeviceMaxDepth();
Function: statisticsAddFrame() - Adds a Further Data Frame to the Statistics Collection
This function adds a further data frame to the statistics collection.
This function uses OpenNI operation types that have already been described in this program sample.
Generated on Wed May 16 2012 10:16:06 for OpenNI 1.5.4 by 1.7.5.1