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 std::vector<rs2_frame*> refs(frames.size(), (
rs2_frame*)
nullptr);
57 for (
size_t i = 0; i < frames.size(); i++)
58 std::swap(refs[i], frames[i].frame_ref);
74 result.frame_ref =
nullptr;
98 on_frame_function(std::move(frm), src);
142 std::swap(f.frame_ref, ptr);
174 _block = std::shared_ptr<rs2_processing_block>(
184 std::shared_ptr<rs2_processing_block> _block;
198 _queue = std::shared_ptr<rs2_frame_queue>(
213 f.frame_ref =
nullptr;
234 typename std::enable_if<std::is_base_of<rs2::frame, T>::value,
bool>::type
poll_for_frame(T* output)
const 240 frame f{ frame_ref };
241 if (res) *output = f;
246 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 252 frame f{ frame_ref };
253 if (res) *output = f;
270 std::shared_ptr<rs2_frame_queue> _queue;
287 auto pb = std::shared_ptr<rs2_processing_block>(
290 _block = std::make_shared<processing_block>(pb);
297 _block->start(_queue);
307 _block->invoke(std::move(depth));
310 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
321 _block->invoke(std::move(mapped));
326 std::shared_ptr<processing_block> _block;
339 _processing_block = std::make_shared<processing_block>(
340 std::shared_ptr<rs2_processing_block>(
354 _processing_block->start(on_frame);
362 _processing_block->operator()(std::move(f));
365 std::shared_ptr<processing_block> _processing_block;
375 :_results(queue_size)
377 _sync.
start(_results);
451 _block = std::make_shared<processing_block>(
452 std::shared_ptr<rs2_processing_block>(
457 _block->start(_queue);
471 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
482 (*_block)(std::move(f));
487 std::shared_ptr<processing_block> _block;
501 auto pb = std::shared_ptr<rs2_processing_block>(
504 _block = std::make_shared<processing_block>(pb);
510 _block->start(_queue);
521 _block->invoke(std::move(depth));
524 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
537 std::shared_ptr<processing_block> _block;
562 auto pb = std::shared_ptr<rs2_processing_block>(
565 _block = std::make_shared<processing_block>(pb);
571 _block->start(_queue);
583 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
592 (*_block)(std::move(f));
597 std::shared_ptr<processing_block> _block;
613 auto pb = std::shared_ptr<rs2_processing_block>(
616 _block = std::make_shared<processing_block>(pb);
622 _block->start(_queue);
634 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
643 (*_block)(std::move(f));
648 std::shared_ptr<processing_block> _block;
665 auto pb = std::shared_ptr<rs2_processing_block>(
668 _block = std::make_shared<processing_block>(pb);
674 _block->start(_queue);
687 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
697 (*_block)(std::move(f));
702 std::shared_ptr<processing_block> _block;
716 auto pb = std::shared_ptr<rs2_processing_block>(
719 _block = std::make_shared<processing_block>(pb);
725 _block->start(_queue);
738 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
748 (*_block)(std::move(f));
753 std::shared_ptr<processing_block> _block;
767 auto pb = std::shared_ptr<rs2_processing_block>(
770 _block = std::make_shared<processing_block>(pb);
776 _block->start(_queue);
788 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
797 (*_block)(std::move(f));
802 std::shared_ptr<processing_block> _block;
806 #endif // LIBREALSENSE_RS2_PROCESSING_HPP decimation_filter()
Definition: rs_processing.hpp:559
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
Definition: rs_frame.hpp:21
Definition: rs_frame.hpp:535
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:783
Definition: rs_frame.hpp:286
Definition: rs_processing.hpp:330
frame_queue(unsigned int capacity)
Definition: rs_processing.hpp:195
rs2_frame * rs2_allocate_composite_frame(rs2_source *source, rs2_frame **frames, int count, rs2_error **error)
void operator()(frame f) const
Definition: rs_processing.hpp:480
points calculate(frame depth)
Definition: rs_processing.hpp:305
Definition: rs_processing.hpp:652
Definition: rs_processing.hpp:757
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:234
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
Definition: rs_frame.hpp:618
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:267
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:94
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:424
virtual ~process_interface()=default
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:629
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:396
Definition: rs_frame.hpp:815
void rs2_delete_frame_queue(rs2_frame_queue *queue)
void operator()(frame f) const
Definition: rs_processing.hpp:151
void map_to(frame mapped)
Definition: rs_processing.hpp:318
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)
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:682
Definition: rs_processing.hpp:107
Definition: rs_context.hpp:104
void frame_ready(frame result) const
Definition: rs_processing.hpp:69
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:160
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
virtual void operator()(frame f) const =0
Definition: rs_processing.hpp:544
void invoke(frame f) const
Definition: rs_processing.hpp:139
void operator()(frame f) const override
Definition: rs_processing.hpp:795
align(rs2_stream align_to)
Definition: rs_processing.hpp:448
Definition: rs_sensor.hpp:100
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)
frame_queue()
Definition: rs_processing.hpp:204
Definition: rs_processing.hpp:17
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
hole_filling_filter()
Definition: rs_processing.hpp:764
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
virtual rs2::frame process(rs2::frame frame)=0
Definition: rs_types.hpp:32
processing_block(S processing_function)
Definition: rs_processing.hpp:171
Definition: rs_processing.hpp:601
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:517
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
spatial_filter()
Definition: rs_processing.hpp:662
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:129
pointcloud()
Definition: rs_processing.hpp:283
Definition: rs_sensor.hpp:114
void operator()(frame f) const override
Definition: rs_processing.hpp:641
void rs2_delete_processing_block(rs2_processing_block *block)
Definition: rs_processing.hpp:277
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
void enqueue(frame f) const
Definition: rs_processing.hpp:210
void start(S on_frame)
Definition: rs_processing.hpp:116
struct rs2_options rs2_options
Definition: rs_types.h:171
void start(S on_frame)
Definition: rs_processing.hpp:352
void operator()(frame f) const
Definition: rs_processing.hpp:360
void operator()(frame f) const
Definition: rs_processing.hpp:259
syncer(int queue_size=1)
Definition: rs_processing.hpp:374
void operator()(frame f) const override
Definition: rs_processing.hpp:590
static void handle(rs2_error *e)
Definition: rs_types.hpp:121
struct rs2_source rs2_source
Definition: rs_types.h:163
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:38
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:413
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:136
Definition: rs_processing.hpp:491
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:220
Definition: rs_types.h:104
void release() override
Definition: rs_processing.hpp:101
Definition: rs_processing.hpp:436
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:94
asynchronous_syncer()
Definition: rs_processing.hpp:336
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:92
rs2_source * _source
Definition: rs_processing.hpp:77
options & operator=(const options &other)
Definition: rs_sensor.hpp:209
Definition: rs_processing.hpp:368
video_frame operator()(frame depth) const
Definition: rs_processing.hpp:534
Definition: rs_processing.hpp:187
Definition: rs_processing.hpp:88
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:386
int rs2_try_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_frame **output_frame, rs2_error **error)
Definition: rs_processing.hpp:552
temporal_filter()
Definition: rs_processing.hpp:610
struct rs2_error rs2_error
Definition: rs_types.h:149
Definition: rs_option.h:59
void operator()(frame f) const override
Definition: rs_processing.hpp:695
frameset process(frameset frame)
Definition: rs_processing.hpp:466
rs2_frame * get() const
Definition: rs_frame.hpp:495
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:246
colorizer()
Definition: rs_processing.hpp:498
struct rs2_frame rs2_frame
Definition: rs_types.h:151
stream_profile get_profile() const
Definition: rs_frame.hpp:462
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:52
int unique_id() const
Definition: rs_frame.hpp:53
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:578