38 #include <pcl/pcl_config.h>
41 #ifndef __OPENNI_SHIFT_TO_DEPTH_CONVERSION
42 #define __OPENNI_SHIFT_TO_DEPTH_CONVERSION
48 namespace openni_wrapper
67 const std::size_t table_size = 1<<10;
70 lookupTable_.resize(table_size);
73 static const int16_t nConstShift = 800;
74 static const double nParamCoeff = 4.000000;
75 static const double dPlanePixelSize = 0.104200;
76 static const double nShiftScale = 10.000000;
77 static const double dPlaneDsr = 120.000000;
78 static const double dPlaneDcl = 7.500000;
84 for (i=0; i<table_size; ++i)
87 dFixedRefX = (
static_cast<double>(i - nConstShift) / nParamCoeff)-0.375;
88 dMetric = dFixedRefX * dPlanePixelSize;
89 lookupTable_[i] =
static_cast<float>((nShiftScale * ((dMetric * dPlaneDsr / (dPlaneDcl - dMetric)) + dPlaneDsr) ) / 1000.0f);
102 static const float bad_point = std::numeric_limits<float>::quiet_NaN ();
104 float ret = bad_point;
107 if (shift_val<lookupTable_.size())
108 ret = lookupTable_[shift_val];
125 #endif //__OPENNI_SHIFT_TO_DEPTH_CONVERSION
float shiftToDepth(uint16_t shift_val)
Generate a look-up table for converting openni shift values to depth.
std::vector< float > lookupTable_
void generateLookupTable()
This method generates a look-up table to convert openni shift values to depth.
This class provides conversion of the openni 11-bit shift data to depth;.
virtual ~ShiftToDepthConverter()
Destructor.
bool isInitialized() const
ShiftToDepthConverter()
Constructor.