41#include <pcl/pcl_config.h>
52 class PCL_EXPORTS ShiftToDepthConverter
56 ShiftToDepthConverter () =
default;
61 generateLookupTable ()
64 constexpr std::size_t table_size = 1<<10;
67 lookupTable_.resize(table_size);
70 constexpr std::int16_t nConstShift = 800;
71 constexpr double nParamCoeff = 4.000000;
72 constexpr double dPlanePixelSize = 0.104200;
73 constexpr double nShiftScale = 10.000000;
74 constexpr double dPlaneDsr = 120.000000;
75 constexpr double dPlaneDcl = 7.500000;
77 for (std::size_t i=0; i<table_size; ++i)
80 double dFixedRefX = (
static_cast<double>(i - nConstShift) / nParamCoeff)-0.375;
81 double dMetric = dFixedRefX * dPlanePixelSize;
82 lookupTable_[i] =
static_cast<float>((nShiftScale * ((dMetric * dPlaneDsr / (dPlaneDcl - dMetric)) + dPlaneDsr) ) / 1000.0f);
91 shiftToDepth (std::uint16_t shift_val)
95 static const float bad_point = std::numeric_limits<float>::quiet_NaN ();
97 float ret = bad_point;
100 if (shift_val<lookupTable_.size())
101 ret = lookupTable_[shift_val];
106 inline bool isInitialized()
const
112 std::vector<float> lookupTable_;