4 #ifndef LIBREALSENSE_RS2_PROCESSING_HPP 5 #define LIBREALSENSE_RS2_PROCESSING_HPP 17 const frame& original,
26 original.
get(), new_bpp, new_width, new_height, new_stride, frame_type, &e);
35 std::vector<rs2_frame*> refs(frames.size(), (
rs2_frame*)
nullptr);
36 for (
size_t i = 0; i < frames.size(); i++)
37 std::swap(refs[i], frames[i].frame_ref);
49 result.frame_ref =
nullptr;
73 on_frame_function(std::move(frm), src);
100 std::swap(f.frame_ref, ptr);
121 _block = std::shared_ptr<rs2_processing_block>(
131 std::shared_ptr<rs2_processing_block> _block;
145 _queue = std::shared_ptr<rs2_frame_queue>(
160 f.frame_ref =
nullptr;
181 typename std::enable_if<std::is_base_of<rs2::frame, T>::value,
bool>::type
poll_for_frame(T* output)
const 187 frame f{ frame_ref };
188 if (res) *output = f;
200 std::shared_ptr<rs2_frame_queue> _queue;
211 auto pb = std::shared_ptr<rs2_processing_block>(
214 _block = std::make_shared<processing_block>(pb);
221 _block->start(_queue);
226 _block->invoke(std::move(depth));
229 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
236 _block->invoke(std::move(mapped));
241 std::shared_ptr<processing_block> _block;
251 _processing_block = std::make_shared<processing_block>(
252 std::shared_ptr<rs2_processing_block>(
262 _processing_block->start(on_frame);
267 _processing_block->operator()(std::move(f));
270 std::shared_ptr<processing_block> _processing_block;
277 :_results(queue_size)
279 _sync.
start(_results);
336 _block = std::make_shared<processing_block>(
337 std::shared_ptr<rs2_processing_block>(
342 _block->start(_queue);
356 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
362 (*_block)(std::move(f));
367 std::shared_ptr<processing_block> _block;
377 auto pb = std::shared_ptr<rs2_processing_block>(
380 _block = std::make_shared<processing_block>(pb);
386 _block->start(_queue);
393 _block->invoke(std::move(depth));
396 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
405 std::shared_ptr<processing_block> _block;
426 auto pb = std::shared_ptr<rs2_processing_block>(
429 _block = std::make_shared<processing_block>(pb);
435 _block->start(_queue);
443 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
449 (*_block)(std::move(f));
454 std::shared_ptr<processing_block> _block;
464 auto pb = std::shared_ptr<rs2_processing_block>(
467 _block = std::make_shared<processing_block>(pb);
473 _block->start(_queue);
481 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
487 (*_block)(std::move(f));
492 std::shared_ptr<processing_block> _block;
502 auto pb = std::shared_ptr<rs2_processing_block>(
505 _block = std::make_shared<processing_block>(pb);
511 _block->start(_queue);
519 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
525 (*_block)(std::move(f));
530 std::shared_ptr<processing_block> _block;
540 auto pb = std::shared_ptr<rs2_processing_block>(
543 _block = std::make_shared<processing_block>(pb);
549 _block->start(_queue);
557 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
563 (*_block)(std::move(f));
568 std::shared_ptr<processing_block> _block;
578 auto pb = std::shared_ptr<rs2_processing_block>(
581 _block = std::make_shared<processing_block>(pb);
587 _block->start(_queue);
595 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
601 (*_block)(std::move(f));
606 std::shared_ptr<processing_block> _block;
610 #endif // LIBREALSENSE_RS2_PROCESSING_HPP decimation_filter()
Definition: rs_processing.hpp:423
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
Definition: rs_frame.hpp:21
Definition: rs_frame.hpp:407
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:590
Definition: rs_frame.hpp:202
Definition: rs_processing.hpp:245
frame_queue(unsigned int capacity)
Definition: rs_processing.hpp:142
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:360
points calculate(frame depth)
Definition: rs_processing.hpp:224
Definition: rs_processing.hpp:496
Definition: rs_processing.hpp:572
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:181
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
Definition: rs_frame.hpp:482
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:197
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:69
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:309
virtual ~process_interface()=default
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:476
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:298
Definition: rs_frame.hpp:630
void rs2_delete_frame_queue(rs2_frame_queue *queue)
void operator()(frame f) const
Definition: rs_processing.hpp:107
void map_to(frame mapped)
Definition: rs_processing.hpp:233
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:514
Definition: rs_processing.hpp:79
Definition: rs_context.hpp:78
void frame_ready(frame result) const
Definition: rs_processing.hpp:44
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:112
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:16
virtual void operator()(frame f) const =0
Definition: rs_processing.hpp:412
void invoke(frame f) const
Definition: rs_processing.hpp:97
void operator()(frame f) const override
Definition: rs_processing.hpp:599
align(rs2_stream align_to)
Definition: rs_processing.hpp:333
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:151
Definition: rs_processing.hpp:13
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
hole_filling_filter()
Definition: rs_processing.hpp:575
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:118
Definition: rs_processing.hpp:458
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:389
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
spatial_filter()
Definition: rs_processing.hpp:499
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:91
pointcloud()
Definition: rs_processing.hpp:207
Definition: rs_sensor.hpp:114
void operator()(frame f) const override
Definition: rs_processing.hpp:485
void rs2_delete_processing_block(rs2_processing_block *block)
Definition: rs_processing.hpp:204
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
void enqueue(frame f) const
Definition: rs_processing.hpp:157
void start(S on_frame)
Definition: rs_processing.hpp:83
struct rs2_options rs2_options
Definition: rs_types.h:171
void start(S on_frame)
Definition: rs_processing.hpp:260
void operator()(frame f) const
Definition: rs_processing.hpp:265
void operator()(frame f) const
Definition: rs_processing.hpp:192
syncer(int queue_size=1)
Definition: rs_processing.hpp:276
void operator()(frame f) const override
Definition: rs_processing.hpp:447
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
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:79
Definition: rs_processing.hpp:371
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:167
Definition: rs_types.h:104
void release() override
Definition: rs_processing.hpp:76
Definition: rs_processing.hpp:321
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:94
asynchronous_syncer()
Definition: rs_processing.hpp:248
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:67
rs2_source * _source
Definition: rs_processing.hpp:52
options & operator=(const options &other)
Definition: rs_sensor.hpp:209
Definition: rs_processing.hpp:273
video_frame operator()(frame depth) const
Definition: rs_processing.hpp:402
Definition: rs_processing.hpp:134
Definition: rs_processing.hpp:63
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:288
Definition: rs_processing.hpp:420
temporal_filter()
Definition: rs_processing.hpp:461
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:523
frameset process(frameset frame)
Definition: rs_processing.hpp:351
rs2_frame * get() const
Definition: rs_frame.hpp:367
colorizer()
Definition: rs_processing.hpp:374
struct rs2_frame rs2_frame
Definition: rs_types.h:151
stream_profile get_profile() const
Definition: rs_frame.hpp:345
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:31
int unique_id() const
Definition: rs_frame.hpp:32
rs2::frame process(rs2::frame frame) override
Definition: rs_processing.hpp:438