34 #ifndef DEPTH_IMAGE_PROC_DEPTH_TRAITS 35 #define DEPTH_IMAGE_PROC_DEPTH_TRAITS 49 static inline bool valid(uint16_t depth) {
return depth != 0; }
50 static inline float toMeters(uint16_t depth) {
return depth * 0.001f; }
51 static inline uint16_t
fromMeters(
float depth) {
return (depth * 1000.0
f) + 0.5f; }
58 static inline bool valid(
float depth) {
return std::isfinite(depth); }
59 static inline float toMeters(
float depth) {
return depth; }
60 static inline float fromMeters(
float depth) {
return depth; }
64 float*
start =
reinterpret_cast<float*
>(&buffer[0]);
65 float* end =
reinterpret_cast<float*
>(&buffer[0] + buffer.size());
66 std::fill(start, end, std::numeric_limits<float>::quiet_NaN());
static float toMeters(uint16_t depth)
static float fromMeters(float depth)
static float toMeters(float depth)
static void initializeBuffer(std::vector< uint8_t > &buffer)
static void initializeBuffer(std::vector< uint8_t > &buffer)
static bool valid(float depth)
static uint16_t fromMeters(float depth)
static bool valid(uint16_t depth)