4 #ifndef LIBREALSENSE_RS2_PROCESSING_HPP 5 #define LIBREALSENSE_RS2_PROCESSING_HPP 33 const frame& original,
42 original.
get(), new_bpp, new_width, new_height, new_stride, frame_type, &e);
56 const frame& original,
61 original.
get(), frame_type, &e);
67 const frame& original)
const 85 std::vector<rs2_frame*> refs(frames.size(), (
rs2_frame*)
nullptr);
86 for (
size_t i = 0; i < frames.size(); i++)
87 std::swap(refs[i], frames[i].frame_ref);
103 result.frame_ref =
nullptr;
127 on_frame_function(std::move(frm), src);
145 _queue = std::shared_ptr<rs2_frame_queue>(
161 f.frame_ref =
nullptr;
182 typename std::enable_if<std::is_base_of<rs2::frame, T>::value,
bool>::type
poll_for_frame(T* output)
const 188 frame f{ frame_ref };
189 if (res) *output = f;
194 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 200 frame f{ frame_ref };
201 if (res) *output = f;
221 return static_cast<size_t>(res);
239 std::shared_ptr<rs2_frame_queue>
get() {
return _queue; }
242 std::shared_ptr<rs2_frame_queue> _queue;
287 std::swap(f.frame_ref, ptr);
312 _block = std::shared_ptr<rs2_processing_block>(
332 return is_supported > 0;
354 std::shared_ptr<rs2_processing_block>
_block;
374 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
383 filter(std::shared_ptr<rs2_processing_block> block,
int queue_size = 1)
396 filter(S processing_function,
int queue_size = 1) :
421 operator bool()
const {
return _block.get() !=
nullptr; }
462 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
483 std::shared_ptr<rs2_processing_block> init()
487 auto block = std::shared_ptr<rs2_processing_block>(
516 std::shared_ptr<rs2_processing_block> init()
519 auto block = std::shared_ptr<rs2_processing_block>(
548 std::shared_ptr<rs2_processing_block> init()
551 auto block = std::shared_ptr<rs2_processing_block>(
575 std::shared_ptr<rs2_processing_block> init()
578 auto block = std::shared_ptr<rs2_processing_block>(
602 static std::shared_ptr<rs2_processing_block> init()
605 auto block = std::shared_ptr<rs2_processing_block>(
642 std::shared_ptr<rs2_processing_block> init()
645 auto block = std::shared_ptr<rs2_processing_block>(
666 std::shared_ptr<rs2_processing_block> init()
669 auto block = std::shared_ptr<rs2_processing_block>(
687 std::shared_ptr<rs2_processing_block> init()
690 auto block = std::shared_ptr<rs2_processing_block>(
706 :_results(queue_size)
708 _sync.
start(_results);
756 _sync.
invoke(std::move(f));
794 align(std::shared_ptr<rs2_processing_block> block) :
filter(block, 1) {}
798 std::shared_ptr<rs2_processing_block> init(
rs2_stream align_to)
801 auto block = std::shared_ptr<rs2_processing_block>(
851 std::shared_ptr<rs2_processing_block> init()
854 auto block = std::shared_ptr<rs2_processing_block>(
897 std::shared_ptr<rs2_processing_block> init()
900 auto block = std::shared_ptr<rs2_processing_block>(
925 :
filter( init( streams_to_rotate ), 1 )
930 :
filter( init( streams_to_rotate ), 1 )
949 std::shared_ptr< rs2_processing_block > init( std::vector< rs2_stream > streams_to_rotate )
954 streams_list.
list = std::move( streams_to_rotate );
1009 std::shared_ptr<rs2_processing_block> init()
1012 auto block = std::shared_ptr<rs2_processing_block>(
1065 std::shared_ptr<rs2_processing_block> init()
1068 auto block = std::shared_ptr<rs2_processing_block>(
1100 std::shared_ptr<rs2_processing_block> init(
bool transform_to_disparity)
1103 auto block = std::shared_ptr<rs2_processing_block>(
1137 std::shared_ptr<rs2_processing_block> init()
1140 auto block = std::shared_ptr<rs2_processing_block>(
1183 std::shared_ptr<rs2_processing_block> init()
1186 auto block = std::shared_ptr<rs2_processing_block>(
1210 std::shared_ptr<rs2_processing_block> init()
1213 auto block = std::shared_ptr<rs2_processing_block>(
1245 std::shared_ptr<rs2_processing_block> init()
1248 auto block = std::shared_ptr<rs2_processing_block>(
1289 std::shared_ptr<rs2_processing_block> init()
1292 auto block = std::shared_ptr<rs2_processing_block>(
1319 operator bool()
const 1324 const std::shared_ptr<rs2_embedded_filter>&
get()
const 1381 #endif // LIBREALSENSE_RS2_PROCESSING_HPP decimation_filter()
Definition: rs_processing.hpp:873
Definition: rs_types.h:207
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:662
Definition: rs_frame.hpp:369
nv12_decoder()
Definition: rs_processing.hpp:569
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:639
rs2_processing_block * rs2_create_threshold(rs2_error **error)
bool supports(rs2_option option) const
Definition: rs_options.hpp:163
Definition: rs_processing.hpp:678
size_t size() const
Definition: rs_processing.hpp:216
rs2_processing_block * rs2_create_m420_decoder(rs2_error **error)
std::shared_ptr< rs2_processing_block > _block
Definition: rs_processing.hpp:354
y411_decoder()
Definition: rs_processing.hpp:596
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:1171
Definition: rs_processing.hpp:1364
bool supports(rs2_camera_info info) const
Definition: rs_processing.hpp:327
Definition: rs_types.h:180
Definition: rs_processing.hpp:1024
Definition: rs_processing.hpp:1149
Definition: rs_option.h:61
threshold_filter(filter f)
Definition: rs_processing.hpp:628
hdr_merge(filter f)
Definition: rs_processing.hpp:1232
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:26
Definition: rs_types.h:178
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:182
rs2_embedded_filter_type get_type() const
Definition: rs_processing.hpp:1311
Definition: rs_types.h:179
depth_huffman_decoder()
Definition: rs_processing.hpp:1121
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:233
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:181
Definition: rs_types.h:160
Definition: rs_option.h:59
Definition: rs_processing.hpp:1347
Definition: rs_processing.hpp:499
Definition: rs_frame.hpp:763
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:228
Definition: rs_option.h:128
hdr_merge()
Definition: rs_processing.hpp:1230
Definition: rs_option.h:108
align(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:794
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:123
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:754
void register_simple_option(rs2_option option_id, option_range range)
Definition: rs_processing.hpp:348
pointcloud(rs2_stream stream, int index=0)
Definition: rs_processing.hpp:437
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:201
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:726
Definition: rs_frame.hpp:1156
T as() const
Definition: rs_processing.hpp:415
void rs2_delete_frame_queue(rs2_frame_queue *queue)
Definition: rs_processing.hpp:1222
void map_to(frame mapped)
Definition: rs_processing.hpp:469
Definition: rs_context.hpp:11
Definition: rs_processing.hpp:528
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:250
frame_queue _queue
Definition: rs_processing.hpp:423
colorizer(float color_scheme)
Definition: rs_processing.hpp:833
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:98
m420_decoder()
Definition: rs_processing.hpp:542
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:298
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition: rs_processing.hpp:621
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:32
float max
Definition: rs_types.hpp:202
float step
Definition: rs_types.hpp:204
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
void invoke(frame f) const
Definition: rs_processing.hpp:284
align(rs2_stream align_to)
Definition: rs_processing.hpp:778
Definition: rs_frame.hpp:1420
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:369
depth_huffman_decoder(filter f)
Definition: rs_processing.hpp:1124
Definition: rs_option.h:64
frame_queue()
Definition: rs_processing.hpp:151
rotation_filter()
Definition: rs_processing.hpp:919
yuy_decoder()
Definition: rs_processing.hpp:510
Definition: rs_processing.hpp:17
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
bool is() const
Definition: rs_processing.hpp:408
hole_filling_filter()
Definition: rs_processing.hpp:1156
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition: rs_processing.hpp:990
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
frameset process(frameset frames)
Definition: rs_processing.hpp:788
bool is() const
Definition: rs_processing.hpp:1330
frame_queue get_queue()
Definition: rs_processing.hpp:404
Definition: rs_types.hpp:39
Definition: rs_processing.hpp:1257
processing_block(S processing_function)
Definition: rs_processing.hpp:309
Definition: rs_processing.hpp:963
Definition: rs_processing.hpp:560
Definition: rs_types.hpp:199
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:842
int rs2_supports_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
rs2_processing_block * rs2_create_rotation_filter_block(rs2_streams_list streams_to_rotate, rs2_error **error)
decimation_filter(float magnitude)
Definition: rs_processing.hpp:879
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
Definition: rs_types.h:203
rs2_processing_block * get() const
Definition: rs_processing.hpp:320
embedded_filter(std::shared_ptr< rs2_embedded_filter > filter)
Definition: rs_processing.hpp:1305
spatial_filter()
Definition: rs_processing.hpp:1034
sequence_id_filter(filter f)
Definition: rs_processing.hpp:1276
decimation_filter(filter f)
Definition: rs_processing.hpp:884
Definition: rs_types.hpp:34
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:274
pointcloud()
Definition: rs_processing.hpp:435
Definition: rs_options.hpp:155
sequence_id_filter()
Definition: rs_processing.hpp:1264
std::vector< rs2_stream > list
Definition: rs_types.hpp:36
spatial_filter(filter f)
Definition: rs_processing.hpp:1053
void rs2_delete_processing_block(rs2_processing_block *block)
filter(S processing_function, int queue_size=1)
Definition: rs_processing.hpp:396
Definition: rs_types.h:196
Definition: rs_processing.hpp:429
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
void enqueue(frame f) const
Definition: rs_processing.hpp:157
Definition: rs_processing.hpp:613
Definition: rs_option.h:66
nv12_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:572
void keep()
Definition: rs_frame.hpp:463
void start(S on_frame)
Definition: rs_processing.hpp:261
struct rs2_options rs2_options
Definition: rs_types.h:320
void operator()(frame f) const
Definition: rs_processing.hpp:207
Definition: rs_option.h:67
int stream_index() const
Definition: rs_frame.hpp:34
syncer(int queue_size=1)
Definition: rs_processing.hpp:705
static void handle(rs2_error *e)
Definition: rs_types.hpp:167
Definition: rs_sensor.h:50
struct rs2_source rs2_source
Definition: rs_types.h:309
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)
m420_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:545
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:47
rs2_embedded_filter_type
Definition: rs_types.h:282
Definition: rs_processing.hpp:360
points calculate(frame depth) const
Definition: rs_processing.hpp:448
Definition: rs_types.h:176
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:743
Definition: rs_processing.hpp:1115
Definition: rs_option.h:73
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:146
rs2_processing_block * rs2_create_sequence_id_filter(rs2_error **error)
Definition: rs_processing.hpp:810
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:168
rotation_filter(std::vector< rs2_stream > streams_to_rotate, float value)
Definition: rs_processing.hpp:929
Definition: rs_types.h:159
Definition: rs_processing.hpp:1302
void release() override
Definition: rs_processing.hpp:130
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:513
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition: rs_processing.hpp:383
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:66
Definition: rs_option.h:62
Definition: rs_processing.hpp:766
struct rs2_processing_block rs2_processing_block
Definition: rs_types.h:310
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:149
asynchronous_syncer()
Definition: rs_processing.hpp:684
Definition: rs_frame.hpp:362
int rs2_is_embedded_filter_extendable_to(const rs2_embedded_filter *embedded_filter, rs2_extension extension_type, rs2_error **error)
rotation_filter(std::vector< rs2_stream > streams_to_rotate)
Definition: rs_processing.hpp:924
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:256
rs2_embedded_filter_type rs2_get_embedded_filter_type(const rs2_embedded_filter *embedded_filter, rs2_error **error)
sequence_id_filter(float sequence_id)
Definition: rs_processing.hpp:1271
const char * get_info(rs2_camera_info info) const
Definition: rs_processing.hpp:340
float def
Definition: rs_types.hpp:203
Definition: rs_processing.hpp:912
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition: rs_processing.hpp:1045
frame allocate_motion_frame(const stream_profile &profile, const frame &original, rs2_extension frame_type=RS2_EXTENSION_MOTION_FRAME) const
Definition: rs_processing.hpp:55
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:121
rs2_source * _source
Definition: rs_processing.hpp:106
options & operator=(const options &other)
Definition: rs_options.hpp:323
Definition: rs_processing.hpp:699
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition: rs_processing.hpp:142
rs2_processing_block * get() const
Definition: rs_processing.hpp:405
Definition: rs_processing.hpp:133
rotation_filter(filter f)
Definition: rs_processing.hpp:935
Definition: rs_processing.hpp:117
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:716
Definition: rs_option.h:72
Definition: rs_processing.hpp:587
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:177
Definition: rs_types.h:213
Definition: rs_processing.hpp:866
int rs2_is_processing_block_extendable_to(const rs2_processing_block *block, rs2_extension extension_type, rs2_error **error)
embedded_decimation_filter(embedded_filter filter)
Definition: rs_processing.hpp:1350
hole_filling_filter(int mode)
Definition: rs_processing.hpp:1166
temporal_filter()
Definition: rs_processing.hpp:972
struct rs2_error rs2_error
Definition: rs_types.h:293
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
std::shared_ptr< rs2_embedded_filter > _embedded_filter
Definition: rs_processing.hpp:1344
rs2_frame * get() const
Definition: rs_frame.hpp:616
rates_printer()
Definition: rs_processing.hpp:1205
rs2_processing_block * rs2_create_nv12_decoder(rs2_error **error)
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:194
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:848
colorizer()
Definition: rs_processing.hpp:817
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:478
rs2_processing_block * rs2_create_hdr_merge_processing_block(rs2_error **error)
embedded_temporal_filter(embedded_filter filter)
Definition: rs_processing.hpp:1367
struct rs2_frame rs2_frame
Definition: rs_types.h:296
T as() const
Definition: rs_processing.hpp:1337
Definition: rs_types.h:214
Definition: rs_option.h:71
Definition: rs_processing.hpp:1198
const std::shared_ptr< rs2_embedded_filter > & get() const
Definition: rs_processing.hpp:1324
stream_profile get_profile() const
Definition: rs_frame.hpp:583
y411_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:599
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:81
Definition: rs_types.h:202
temporal_filter(filter f)
Definition: rs_processing.hpp:997