4 #include "../include/librealsense2/hpp/rs_sensor.hpp" 5 #include "../include/librealsense2/hpp/rs_processing.hpp" 153 auto min_opt = std::make_shared<ptr_option<float>>(0.f, 16.f, 0.1f, 0.f, &
_min,
"Min range in meters");
155 auto max_opt = std::make_shared<ptr_option<float>>(0.f, 16.f, 0.1f, 6.f, &
_max,
"Max range in meters");
158 std::make_shared<max_distance_option>(
163 std::make_shared<min_distance_option>(
170 color_map->set_description(2.
f,
"White to Black");
171 color_map->set_description(3.
f,
"Black to White");
180 auto preset_opt = std::make_shared<ptr_option<int>>(0, 3, 1, 0, &
_preset,
"Preset depth colorization");
181 preset_opt->set_description(0.
f,
"Dynamic");
182 preset_opt->set_description(1.
f,
"Fixed");
183 preset_opt->set_description(2.
f,
"Near");
184 preset_opt->set_description(3.
f,
"Far");
186 preset_opt->on_set([
this](
float val)
188 if (fabs(val - 0.
f) < 1
e-6)
194 if (fabs(val - 1.
f) < 1
e-6)
202 if (fabs(val - 2.
f) < 1
e-6)
210 if (fabs(val - 3.
f) < 1
e-6)
221 auto hist_opt = std::make_shared<ptr_option<bool>>(
false,
true,
true,
true, &
_equalize,
"Perform histogram equalization");
244 auto depth_sensor = As< librealsense::depth_sensor >( snr );
250 auto extendable = As< librealsense::extendable_interface >( snr );
259 LOG_ERROR(
"Failed to query depth units from sensor" );
260 throw std::runtime_error(
"failed to query depth units from sensor" );
271 auto rgb_data =
reinterpret_cast<uint8_t*
>(
const_cast<void *
>(rgb.get_data()));
272 auto coloring_function = [&,
this](
float data) {
275 return (hist_data / pixels);
280 auto depth_data =
reinterpret_cast<const float*
>(depth.
get_data());
282 make_rgb_data<float>(depth_data, rgb_data,
w,
h, coloring_function);
288 make_rgb_data<uint16_t>(depth_data, rgb_data,
w,
h, coloring_function);
296 auto rgb_data =
reinterpret_cast<uint8_t*
>(
const_cast<void *
>(rgb.get_data()));
300 auto depth_data =
reinterpret_cast<const float*
>(depth.
get_data());
304 if (__min < 1
e-6f) { __min = 1
e-6
f; }
307 auto coloring_function = [&,
this](
float data) {
310 make_rgb_data<float>(depth_data, rgb_data,
w,
h, coloring_function);
317 auto coloring_function = [&,
this](
float data) {
318 if (
min >= max)
return 0.f;
321 make_rgb_data<uint16_t>(depth_data, rgb_data,
w,
h, coloring_function);
rs2::stream_profile _source_stream_profile
GLuint const GLchar * name
static const int MAX_DEPTH
bool should_process(const rs2::frame &frame) override
static color_map quantized
stream_profile get_profile() const
static color_map grayscale
static color_map inv_grayscale
GLint GLint GLsizei GLsizei GLsizei depth
const void * get_data() const
rs2::frame process_frame(const rs2::frame_source &source, const rs2::frame &f) override
GLdouble GLdouble GLdouble w
GLfloat GLfloat GLfloat GLfloat h
void register_option(rs2_option id, std::shared_ptr< option > option)
frame allocate_video_frame(const stream_profile &profile, const frame &original, int new_bpp=0, int new_width=0, int new_height=0, int new_stride=0, rs2_extension frame_type=RS2_EXTENSION_VIDEO_FRAME) const
static info update_info_from_frame(const rs2::frame &f)
def info(name, value, persistent=False)
virtual float get_depth_scale() const =0
void make_equalized_histogram(depth_pixel *dst, const rs2::video_frame &depth, const color_map &cm)
std::vector< int > _histogram
std::vector< color_map * > _maps
rs2::stream_profile _target_stream_profile
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
stream_filter _stream_filter
rs2_format format() const
const rs2_stream_profile * get() const
GLsizei GLsizei GLchar * source
float _d2d_convert_factor
static void update_histogram(int *hist, const T *depth_data, int w, int h)
rs2_stream stream_type() const
void make_value_cropped_frame(depth_pixel *dst, const rs2::video_frame &depth, const color_map &cm, float depth_min, float depth_max, float depth_units)
stream_profile clone(rs2_stream type, int index, rs2_format format) const