4 #ifndef LIBREALSENSE_RS2_PROCESSING_HPP 5 #define LIBREALSENSE_RS2_PROCESSING_HPP 34 const frame& original,
43 original.
get(), new_bpp, new_width, new_height, new_stride, frame_type, &e);
57 const frame& original,
62 original.
get(), frame_type, &e);
68 const frame& original)
const 86 std::vector<rs2_frame*> refs(frames.size(), (
rs2_frame*)
nullptr);
87 for (
size_t i = 0; i < frames.size(); i++)
88 std::swap(refs[i], frames[i].frame_ref);
104 result.frame_ref =
nullptr;
128 on_frame_function(std::move(frm), src);
146 _queue = std::shared_ptr<rs2_frame_queue>(
162 f.frame_ref =
nullptr;
183 typename std::enable_if<std::is_base_of<rs2::frame, T>::value,
bool>::type
poll_for_frame(T* output)
const 189 frame f{ frame_ref };
190 if (res) *output = f;
195 typename std::enable_if<std::is_base_of<rs2::frame, T>::value,
bool>::type
try_wait_for_frame(T* output,
unsigned int timeout_ms = 5000)
const 201 frame f{ frame_ref };
202 if (res) *output = f;
222 return static_cast<size_t>(res);
240 std::shared_ptr<rs2_frame_queue>
get() {
return _queue; }
243 std::shared_ptr<rs2_frame_queue> _queue;
288 std::swap(f.frame_ref, ptr);
313 _block = std::shared_ptr<rs2_processing_block>(
333 return is_supported > 0;
355 std::shared_ptr<rs2_processing_block>
_block;
375 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
384 filter(std::shared_ptr<rs2_processing_block> block,
int queue_size = 1)
397 filter(S processing_function,
int queue_size = 1) :
422 operator bool()
const {
return _block.get() !=
nullptr; }
463 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
484 std::shared_ptr<rs2_processing_block> init()
488 auto block = std::shared_ptr<rs2_processing_block>(
517 std::shared_ptr<rs2_processing_block> init()
520 auto block = std::shared_ptr<rs2_processing_block>(
544 static std::shared_ptr<rs2_processing_block> init()
547 auto block = std::shared_ptr<rs2_processing_block>(
584 std::shared_ptr<rs2_processing_block> init()
587 auto block = std::shared_ptr<rs2_processing_block>(
608 std::shared_ptr<rs2_processing_block> init()
611 auto block = std::shared_ptr<rs2_processing_block>(
629 std::shared_ptr<rs2_processing_block> init()
632 auto block = std::shared_ptr<rs2_processing_block>(
648 :_results(queue_size)
650 _sync.
start(_results);
698 _sync.
invoke(std::move(f));
736 align(std::shared_ptr<rs2_processing_block> block) :
filter(block, 1) {}
740 std::shared_ptr<rs2_processing_block> init(
rs2_stream align_to)
743 auto block = std::shared_ptr<rs2_processing_block>(
793 std::shared_ptr<rs2_processing_block> init()
796 auto block = std::shared_ptr<rs2_processing_block>(
839 std::shared_ptr<rs2_processing_block> init()
842 auto block = std::shared_ptr<rs2_processing_block>(
900 std::shared_ptr<rs2_processing_block> init()
903 auto block = std::shared_ptr<rs2_processing_block>(
956 std::shared_ptr<rs2_processing_block> init()
959 auto block = std::shared_ptr<rs2_processing_block>(
991 std::shared_ptr<rs2_processing_block> init(
bool transform_to_disparity)
994 auto block = std::shared_ptr<rs2_processing_block>(
1028 std::shared_ptr<rs2_processing_block> init()
1031 auto block = std::shared_ptr<rs2_processing_block>(
1074 std::shared_ptr<rs2_processing_block> init()
1077 auto block = std::shared_ptr<rs2_processing_block>(
1101 std::shared_ptr<rs2_processing_block> init()
1104 auto block = std::shared_ptr<rs2_processing_block>(
1136 std::shared_ptr<rs2_processing_block> init()
1139 auto block = std::shared_ptr<rs2_processing_block>(
1180 std::shared_ptr<rs2_processing_block> init()
1183 auto block = std::shared_ptr<rs2_processing_block>(
1192 #endif // LIBREALSENSE_RS2_PROCESSING_HPP decimation_filter()
Definition: rs_processing.hpp:815
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
Definition: rs_frame.hpp:22
rs2_camera_info
Read-only strings that can be queried from the device. Not all information attributes are available o...
Definition: rs_sensor.h:22
Definition: rs_frame.hpp:638
Definition: rs_frame.hpp:345
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:581
rs2_processing_block * rs2_create_threshold(rs2_error **error)
bool supports(rs2_option option) const
Definition: rs_options.hpp:163
Definition: rs_processing.hpp:620
size_t size() const
Definition: rs_processing.hpp:217
std::shared_ptr< rs2_processing_block > _block
Definition: rs_processing.hpp:355
y411_decoder()
Definition: rs_processing.hpp:538
rs2_frame * rs2_allocate_composite_frame(rs2_source *source, rs2_frame **frames, int count, rs2_error **error)
hole_filling_filter(filter f)
Definition: rs_processing.hpp:1062
bool supports(rs2_camera_info info) const
Definition: rs_processing.hpp:328
Definition: rs_types.h:167
Definition: rs_processing.hpp:915
Definition: rs_processing.hpp:1040
Definition: rs_option.h:61
threshold_filter(filter f)
Definition: rs_processing.hpp:570
hdr_merge(filter f)
Definition: rs_processing.hpp:1123
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:26
Definition: rs_types.h:165
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:183
Definition: rs_types.h:166
depth_huffman_decoder()
Definition: rs_processing.hpp:1012
rs2_frame * rs2_allocate_points(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, rs2_error **error)
rs2_processing_block * rs2_create_units_transform(rs2_error **error)
bool keep_frames() const
Definition: rs_processing.hpp:234
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
rs2_format format() const
Definition: rs_frame.hpp:44
Definition: rs_types.h:168
Definition: rs_types.h:147
Definition: rs_option.h:59
Definition: rs_processing.hpp:500
Definition: rs_frame.hpp:739
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:229
hdr_merge()
Definition: rs_processing.hpp:1121
Definition: rs_option.h:108
align(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:736
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:124
rs2_processing_block * rs2_create_hole_filling_filter_block(rs2_error **error)
rs2_processing_block * rs2_create_sync_processing_block(rs2_error **error)
void operator()(frame f) const
Definition: rs_processing.hpp:696
void register_simple_option(rs2_option option_id, option_range range)
Definition: rs_processing.hpp:349
pointcloud(rs2_stream stream, int index=0)
Definition: rs_processing.hpp:438
rs2_processing_block * rs2_create_y411_decoder(rs2_error **error)
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
float min
Definition: rs_types.hpp:196
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:668
Definition: rs_frame.hpp:957
T as() const
Definition: rs_processing.hpp:416
void rs2_delete_frame_queue(rs2_frame_queue *queue)
Definition: rs_processing.hpp:1113
void map_to(frame mapped)
Definition: rs_processing.hpp:470
Definition: rs_context.hpp:11
rs2_frame_queue * rs2_create_frame_queue(int capacity, rs2_error **error)
rs2_frame * rs2_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_error **error)
void rs2_process_frame(rs2_processing_block *block, rs2_frame *frame, rs2_error **error)
Definition: rs_processing.hpp:251
frame_queue _queue
Definition: rs_processing.hpp:424
colorizer(float color_scheme)
Definition: rs_processing.hpp:775
rs2_processing_block * rs2_create_huffman_depth_decompress_block(rs2_error **error)
Definition: rs_context.hpp:96
int rs2_frame_queue_size(rs2_frame_queue *queue, rs2_error **error)
void frame_ready(frame result) const
Definition: rs_processing.hpp:99
int rs2_processing_block_register_simple_option(rs2_processing_block *block, rs2_option option_id, float min, float max, float step, float def, rs2_error **error)
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:299
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition: rs_processing.hpp:563
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
Definition: rs_processing.hpp:33
float max
Definition: rs_types.hpp:197
float step
Definition: rs_types.hpp:199
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
void invoke(frame f) const
Definition: rs_processing.hpp:285
align(rs2_stream align_to)
Definition: rs_processing.hpp:720
Definition: rs_frame.hpp:1180
rs2_frame * rs2_allocate_synthetic_video_frame(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, int new_bpp, int new_width, int new_height, int new_stride, rs2_extension frame_type, rs2_error **error)
rs2_processing_block * rs2_create_align(rs2_stream align_to, rs2_error **error)
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:370
depth_huffman_decoder(filter f)
Definition: rs_processing.hpp:1015
Definition: rs_option.h:64
frame_queue()
Definition: rs_processing.hpp:152
yuy_decoder()
Definition: rs_processing.hpp:511
Definition: rs_processing.hpp:18
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
bool is() const
Definition: rs_processing.hpp:409
hole_filling_filter()
Definition: rs_processing.hpp:1047
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition: rs_processing.hpp:881
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
frameset process(frameset frames)
Definition: rs_processing.hpp:730
frame_queue get_queue()
Definition: rs_processing.hpp:405
Definition: rs_types.hpp:34
Definition: rs_processing.hpp:1148
processing_block(S processing_function)
Definition: rs_processing.hpp:310
Definition: rs_processing.hpp:854
Definition: rs_types.hpp:194
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:784
int rs2_supports_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
decimation_filter(float magnitude)
Definition: rs_processing.hpp:821
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
Definition: rs_types.h:190
rs2_processing_block * get() const
Definition: rs_processing.hpp:321
spatial_filter()
Definition: rs_processing.hpp:925
sequence_id_filter(filter f)
Definition: rs_processing.hpp:1167
decimation_filter(filter f)
Definition: rs_processing.hpp:826
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:275
pointcloud()
Definition: rs_processing.hpp:436
Definition: rs_options.hpp:155
sequence_id_filter()
Definition: rs_processing.hpp:1155
spatial_filter(filter f)
Definition: rs_processing.hpp:944
void rs2_delete_processing_block(rs2_processing_block *block)
filter(S processing_function, int queue_size=1)
Definition: rs_processing.hpp:397
Definition: rs_types.h:183
Definition: rs_processing.hpp:430
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
void enqueue(frame f) const
Definition: rs_processing.hpp:158
Definition: rs_processing.hpp:555
Definition: rs_option.h:66
void keep()
Definition: rs_frame.hpp:439
void start(S on_frame)
Definition: rs_processing.hpp:262
struct rs2_options rs2_options
Definition: rs_types.h:254
void operator()(frame f) const
Definition: rs_processing.hpp:208
Definition: rs_option.h:67
int stream_index() const
Definition: rs_frame.hpp:34
syncer(int queue_size=1)
Definition: rs_processing.hpp:647
static void handle(rs2_error *e)
Definition: rs_types.hpp:162
struct rs2_source rs2_source
Definition: rs_types.h:245
rs2_processing_block * rs2_create_disparity_transform_block(unsigned char transform_to_disparity, rs2_error **error)
rs2_processing_block * rs2_create_colorizer(rs2_error **error)
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:43
Definition: rs_processing.hpp:361
points calculate(frame depth) const
Definition: rs_processing.hpp:449
Definition: rs_types.h:163
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:685
Definition: rs_processing.hpp:1006
Definition: rs_option.h:73
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
rs2_processing_block * rs2_create_sequence_id_filter(rs2_error **error)
Definition: rs_processing.hpp:752
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:169
Definition: rs_types.h:146
void release() override
Definition: rs_processing.hpp:131
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:514
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition: rs_processing.hpp:384
rs2_frame * rs2_allocate_synthetic_motion_frame(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, rs2_extension frame_type, rs2_error **error)
frame allocate_points(const stream_profile &profile, const frame &original) const
Definition: rs_processing.hpp:67
Definition: rs_option.h:62
Definition: rs_processing.hpp:708
struct rs2_processing_block rs2_processing_block
Definition: rs_types.h:246
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:136
asynchronous_syncer()
Definition: rs_processing.hpp:626
Definition: rs_frame.hpp:338
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:256
sequence_id_filter(float sequence_id)
Definition: rs_processing.hpp:1162
const char * get_info(rs2_camera_info info) const
Definition: rs_processing.hpp:341
float def
Definition: rs_types.hpp:198
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition: rs_processing.hpp:936
frame allocate_motion_frame(const stream_profile &profile, const frame &original, rs2_extension frame_type=RS2_EXTENSION_MOTION_FRAME) const
Definition: rs_processing.hpp:56
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:122
rs2_source * _source
Definition: rs_processing.hpp:107
options & operator=(const options &other)
Definition: rs_options.hpp:323
Definition: rs_processing.hpp:641
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition: rs_processing.hpp:143
rs2_processing_block * get() const
Definition: rs_processing.hpp:406
Definition: rs_processing.hpp:134
Definition: rs_processing.hpp:118
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:658
Definition: rs_option.h:72
Definition: rs_processing.hpp:529
int rs2_try_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_frame **output_frame, rs2_error **error)
Definition: rs_types.h:164
Definition: rs_processing.hpp:808
int rs2_is_processing_block_extendable_to(const rs2_processing_block *block, rs2_extension extension_type, rs2_error **error)
hole_filling_filter(int mode)
Definition: rs_processing.hpp:1057
temporal_filter()
Definition: rs_processing.hpp:863
struct rs2_error rs2_error
Definition: rs_types.h:229
rs2_stream stream_type() const
Definition: rs_frame.hpp:39
const char * rs2_get_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
Definition: rs_option.h:65
rs2_frame * get() const
Definition: rs_frame.hpp:592
rates_printer()
Definition: rs_processing.hpp:1096
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type try_wait_for_frame(T *output, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:195
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:790
colorizer()
Definition: rs_processing.hpp:759
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:479
rs2_processing_block * rs2_create_hdr_merge_processing_block(rs2_error **error)
struct rs2_frame rs2_frame
Definition: rs_types.h:232
Definition: rs_option.h:71
Definition: rs_processing.hpp:1089
stream_profile get_profile() const
Definition: rs_frame.hpp:559
y411_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:541
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:82
Definition: rs_types.h:189
temporal_filter(filter f)
Definition: rs_processing.hpp:888