4 #include "../include/librealsense2/hpp/rs_sensor.hpp" 5 #include "../include/librealsense2/hpp/rs_processing.hpp" 37 _persistence_param(persistence_default),
38 _alpha_param(temp_alpha_default),
39 _one_minus_alpha(1- _alpha_param),
40 _delta_param(temp_delta_default),
41 _width(0), _height(0), _stride(0), _bpp(0),
43 _current_frm_size_pixels(0)
48 auto temporal_persistence_control = std::make_shared<ptr_option<uint8_t>>(
55 temporal_persistence_control->set_description(0,
"Disabled");
56 temporal_persistence_control->set_description(1,
"Valid in 8/8");
57 temporal_persistence_control->set_description(2,
"Valid in 2/last 3");
58 temporal_persistence_control->set_description(3,
"Valid in 2/last 4");
59 temporal_persistence_control->set_description(4,
"Valid in 2/8");
60 temporal_persistence_control->set_description(5,
"Valid in 1/last 2");
61 temporal_persistence_control->set_description(6,
"Valid in 1/last 5");
62 temporal_persistence_control->set_description(7,
"Valid in 1/8");
63 temporal_persistence_control->set_description(8,
"Always on");
65 temporal_persistence_control->on_set([
this,temporal_persistence_control](
float val)
67 if (!temporal_persistence_control->is_valid(val))
69 <<
"Unsupported temporal persistence param " 70 << (int)val <<
" is out of range.");
77 auto temporal_filter_alpha = std::make_shared<ptr_option<float>>(
82 &
_alpha_param,
"Alpha factor of Exp. moving average, 1=no filter, 0=infinite filter");
83 temporal_filter_alpha->on_set([
this](
float val)
88 auto temporal_filter_delta = std::make_shared<ptr_option<uint8_t>>(
94 temporal_filter_delta->on_set([
this, temporal_filter_delta](
float val)
96 if (!temporal_filter_delta->is_valid(val))
98 <<
"Unsupported temporal delta: " << val <<
" is out of range.");
118 temp_jw_smooth<float>(
const_cast<void*
>(tgt.get_data()),
_last_frame.data(),
_history.data());
120 temp_jw_smooth<uint16_t>(
const_cast<void*
>(tgt.get_data()),
_last_frame.data(),
_history.data());
194 unsigned char last_7 = !!(
i & 1);
195 unsigned char last_6 = !!(
i & 2);
196 unsigned char last_5 = !!(
i & 4);
197 unsigned char last_4 = !!(
i & 8);
198 unsigned char last_3 = !!(
i & 16);
199 unsigned char last_2 = !!(
i & 32);
200 unsigned char last_1 = !!(
i & 64);
201 unsigned char lastFrame = !!(
i & 128);
205 int sum = lastFrame + last_1 + last_2 + last_3 + last_4 + last_5 + last_6 + last_7;
211 int sum = lastFrame + last_1 + last_2;
217 int sum = lastFrame + last_1 + last_2 + last_3;
223 int sum = lastFrame + last_1 + last_2 + last_3 + last_4 + last_5 + last_6 + last_7;
229 int sum = lastFrame + last_1;
235 int sum = lastFrame + last_1 + last_2 + last_3 + last_4;
241 int sum = lastFrame + last_1 + last_2 + last_3 + last_4 + last_5 + last_6 + last_7;
255 std::array<uint8_t, PRESISTENCY_LUT_SIZE> credible_threshold;
256 credible_threshold.fill(0);
258 for (
auto phase = 0; phase < 8; phase++)
262 unsigned char mask = 1 << phase;
265 for (i = 0; i < 256; i++) {
266 unsigned char pos = (
unsigned char)((i << (8 - phase)) | (i >> phase));
268 credible_threshold[
i] |=
mask;
const float temp_alpha_default
static const textual_icon lock
void on_set_delta(float val)
const uint8_t temp_delta_default
const uint8_t persistence_default
stream_profile get_profile() const
rs2::stream_profile _target_stream_profile
void on_set_persistence_control(uint8_t val)
const uint8_t persistence_min
const void * get_data() const
std::array< uint8_t, PRESISTENCY_LUT_SIZE > _persistence_map
const uint8_t temp_delta_step
void on_set_alpha(float val)
void register_option(rs2_option id, std::shared_ptr< option > option)
const uint8_t temp_delta_max
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
const uint8_t persistence_max
std::vector< uint8_t > _history
rs2_extension _extension_type
rs2::stream_profile _source_stream_profile
std::vector< uint8_t > _last_frame
const uint8_t temp_delta_min
void recalc_persistence_map()
stream_filter _stream_filter
const size_t PERSISTENCE_MAP_NUM
void update_configuration(const rs2::frame &f)
const float temp_alpha_max
rs2_format format() const
rs2::frame prepare_target_frame(const rs2::frame &f, const rs2::frame_source &source)
const rs2_stream_profile * get() const
const uint8_t persistence_step
GLsizei GLsizei GLchar * source
const float temp_alpha_step
const float temp_alpha_min
size_t _current_frm_size_pixels
uint8_t _persistence_param
stream_profile clone(rs2_stream type, int index, rs2_format format) const
rs2::frame process_frame(const rs2::frame_source &source, const rs2::frame &f) override
std::string to_string(T value)