38 #include <pcl/pcl_config.h>
41 #ifndef __OPENNI_SHIFT_TO_DEPTH_CONVERSION
42 #define __OPENNI_SHIFT_TO_DEPTH_CONVERSION
47 namespace openni_wrapper
63 generateLookupTable ()
66 const std::size_t table_size = 1<<10;
69 lookupTable_.resize(table_size);
72 static const int16_t nConstShift = 800;
73 static const double nParamCoeff = 4.000000;
74 static const double dPlanePixelSize = 0.104200;
75 static const double nShiftScale = 10.000000;
76 static const double dPlaneDsr = 120.000000;
77 static const double dPlaneDcl = 7.500000;
83 for (i=0; i<table_size; ++i)
86 dFixedRefX = (
static_cast<double>(i - nConstShift) / nParamCoeff)-0.375;
87 dMetric = dFixedRefX * dPlanePixelSize;
88 lookupTable_[i] =
static_cast<float>((nShiftScale * ((dMetric * dPlaneDsr / (dPlaneDcl - dMetric)) + dPlaneDsr) ) / 1000.0f);
97 shiftToDepth (uint16_t shift_val)
101 static const float bad_point = std::numeric_limits<float>::quiet_NaN ();
103 float ret = bad_point;
106 if (shift_val<lookupTable_.size())
107 ret = lookupTable_[shift_val];
112 inline bool isInitialized()
const
124 #endif //__OPENNI_SHIFT_TO_DEPTH_CONVERSION