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" );
157 auto max_dist_opt = std::make_shared< max_distance_option >( max_opt, min_opt );
159 auto min_dist_opt = std::make_shared< min_distance_option >( min_opt, max_opt );
165 auto hist_opt = std::make_shared< ptr_option< bool > >(
false,
170 "Perform histogram equalization" );
172 auto weak_hist_opt = std::weak_ptr< ptr_option< bool > >( hist_opt );
174 max_dist_opt->add_observer( [weak_hist_opt](
float val ) {
175 auto strong_hist_opt = weak_hist_opt.lock();
176 if( strong_hist_opt )
177 strong_hist_opt->set(
false );
180 min_dist_opt->add_observer( [weak_hist_opt](
float val ) {
181 auto strong_hist_opt = weak_hist_opt.lock();
182 if( strong_hist_opt )
183 strong_hist_opt->set(
false );
189 color_map->set_description(2.
f,
"White to Black");
190 color_map->set_description(3.
f,
"Black to White");
199 auto preset_opt = std::make_shared<ptr_option<int>>(0, 3, 1, 0, &
_preset,
"Preset depth colorization");
200 preset_opt->set_description(0.
f,
"Dynamic");
201 preset_opt->set_description(1.
f,
"Fixed");
202 preset_opt->set_description(2.
f,
"Near");
203 preset_opt->set_description(3.
f,
"Far");
205 preset_opt->on_set([
this](
float val)
207 if (fabs(val - 0.
f) < 1
e-6)
213 if (fabs(val - 1.
f) < 1
e-6)
221 if (fabs(val - 2.
f) < 1
e-6)
229 if (fabs(val - 3.
f) < 1
e-6)
273 auto rgb_data =
reinterpret_cast<uint8_t*
>(
const_cast<void *
>(rgb.get_data()));
274 auto coloring_function = [&,
this](
float data) {
277 return (hist_data / pixels);
282 auto depth_data =
reinterpret_cast<const float*
>(depth.
get_data());
284 make_rgb_data<float>(depth_data, rgb_data,
w,
h, coloring_function);
290 make_rgb_data<uint16_t>(depth_data, rgb_data,
w,
h, coloring_function);
298 auto rgb_data =
reinterpret_cast<uint8_t*
>(
const_cast<void *
>(rgb.get_data()));
302 auto depth_data =
reinterpret_cast<const float*
>(depth.
get_data());
306 if (__min < 1
e-6f) { __min = 1
e-6
f; }
309 auto coloring_function = [&,
this](
float data) {
312 make_rgb_data<float>(depth_data, rgb_data,
w,
h, coloring_function);
319 auto coloring_function = [&,
this](
float data) {
320 if (
min >= max)
return 0.f;
323 make_rgb_data<uint16_t>(depth_data, rgb_data,
w,
h, coloring_function);
GLsizei GLsizei GLchar * source
rs2::stream_profile _source_stream_profile
GLuint const GLchar * name
static const int MAX_DEPTH
rs2_format format() const
bool should_process(const rs2::frame &frame) override
static color_map quantized
static color_map grayscale
static color_map inv_grayscale
GLint GLint GLsizei GLsizei GLsizei depth
rs2::frame process_frame(const rs2::frame_source &source, const rs2::frame &f) override
GLdouble GLdouble GLdouble w
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
void register_option(rs2_option id, std::shared_ptr< option > option)
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
const rs2_stream_profile * get() const
const void * get_data() const
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
stream_profile get_profile() const