34 #ifndef DEPTH_IMAGE_PROC_DEPTH_TRAITS 35 #define DEPTH_IMAGE_PROC_DEPTH_TRAITS 48 static inline bool valid(uint16_t depth) {
return depth != 0; }
49 static inline float toMeters(uint16_t depth) {
return depth * 0.001f; }
50 static inline uint16_t
fromMeters(
float depth) {
return (depth * 1000.0
f) + 0.5f; }
57 static inline bool valid(
float depth) {
return std::isfinite(depth); }
58 static inline float toMeters(
float depth) {
return depth; }
59 static inline float fromMeters(
float depth) {
return depth; }
63 float* start =
reinterpret_cast<float*
>(&buffer[0]);
64 float* end =
reinterpret_cast<float*
>(&buffer[0] + buffer.size());
65 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)