Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
|
Go to the documentation of this file.
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;
225 std::shared_ptr<rs2_frame_queue> _queue;
270 std::swap(f.frame_ref, ptr);
295 _block = std::shared_ptr<rs2_processing_block>(
315 return is_supported > 0;
337 std::shared_ptr<rs2_processing_block>
_block;
357 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
366 filter(std::shared_ptr<rs2_processing_block> block,
int queue_size = 1)
379 filter(S processing_function,
int queue_size = 1) :
404 operator bool()
const {
return _block.get() !=
nullptr; }
445 throw std::runtime_error(
"Error occured during execution of the processing block! See the log for more info");
466 std::shared_ptr<rs2_processing_block> init()
470 auto block = std::shared_ptr<rs2_processing_block>(
499 std::shared_ptr<rs2_processing_block> init()
502 auto block = std::shared_ptr<rs2_processing_block>(
540 std::shared_ptr<rs2_processing_block> init()
543 auto block = std::shared_ptr<rs2_processing_block>(
564 std::shared_ptr<rs2_processing_block> init()
567 auto block = std::shared_ptr<rs2_processing_block>(
585 std::shared_ptr<rs2_processing_block> init()
588 auto block = std::shared_ptr<rs2_processing_block>(
604 :_results(queue_size)
606 _sync.
start(_results);
654 _sync.
invoke(std::move(f));
692 align(std::shared_ptr<rs2_processing_block> block) :
filter(block, 1) {}
696 std::shared_ptr<rs2_processing_block> init(
rs2_stream align_to)
699 auto block = std::shared_ptr<rs2_processing_block>(
749 std::shared_ptr<rs2_processing_block> init()
752 auto block = std::shared_ptr<rs2_processing_block>(
795 std::shared_ptr<rs2_processing_block> init()
798 auto block = std::shared_ptr<rs2_processing_block>(
856 std::shared_ptr<rs2_processing_block> init()
859 auto block = std::shared_ptr<rs2_processing_block>(
912 std::shared_ptr<rs2_processing_block> init()
915 auto block = std::shared_ptr<rs2_processing_block>(
947 std::shared_ptr<rs2_processing_block> init(
bool transform_to_disparity)
950 auto block = std::shared_ptr<rs2_processing_block>(
985 std::shared_ptr<rs2_processing_block> init()
988 auto block = std::shared_ptr<rs2_processing_block>(
1019 std::shared_ptr<rs2_processing_block> init()
1022 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>(
1092 std::shared_ptr<rs2_processing_block> init()
1095 auto block = std::shared_ptr<rs2_processing_block>(
1104 #endif // LIBREALSENSE_RS2_PROCESSING_HPP
points calculate(frame depth)
Definition: rs_processing.hpp:431
T as() const
Definition: rs_processing.hpp:398
float step
Definition: rs_types.hpp:167
rs2_format format() const
Definition: rs_frame.hpp:44
@ RS2_OPTION_STREAM_FORMAT_FILTER
Definition: rs_option.h:68
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition: rs_processing.hpp:892
rs2_source * _source
Definition: rs_processing.hpp:107
Definition: rs_frame.hpp:336
Definition: rs_processing.hpp:18
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
zero_order_invalidation()
Definition: rs_processing.hpp:969
Definition: rs_frame.hpp:908
yuy_decoder()
Definition: rs_processing.hpp:493
@ RS2_EXTENSION_HOLE_FILLING_FILTER
Definition: rs_types.h:166
@ RS2_EXTENSION_MOTION_FRAME
Definition: rs_types.h:145
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:257
int rs2_try_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_frame **output_frame, rs2_error **error)
Definition: rs_frame.hpp:22
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:169
rs2_frame_queue * rs2_create_frame_queue(int capacity, rs2_error **error)
void register_simple_option(rs2_option option_id, option_range range)
Definition: rs_processing.hpp:331
Definition: rs_processing.hpp:708
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:134
void keep()
Definition: rs_frame.hpp:430
filter(S processing_function, int queue_size=1)
Definition: rs_processing.hpp:379
void start(S on_frame)
Definition: rs_processing.hpp:244
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:641
struct rs2_frame rs2_frame
Definition: rs_types.h:220
Definition: rs_processing.hpp:576
std::shared_ptr< rs2_processing_block > _block
Definition: rs_processing.hpp:337
Definition: rs_options.hpp:11
struct rs2_source rs2_source
Definition: rs_types.h:233
rs2_stream stream_type() const
Definition: rs_frame.hpp:39
colorizer()
Definition: rs_processing.hpp:715
frame_queue get_queue()
Definition: rs_processing.hpp:387
void invoke(frame f) const
Definition: rs_processing.hpp:267
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition: rs_processing.hpp:143
rates_printer()
Definition: rs_processing.hpp:1087
asynchronous_syncer()
Definition: rs_processing.hpp:582
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
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
frameset process(frameset frames)
Definition: rs_processing.hpp:686
@ RS2_OPTION_FILTER_SMOOTH_DELTA
Definition: rs_option.h:62
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:746
syncer(int queue_size=1)
Definition: rs_processing.hpp:603
Definition: rs_types.hpp:162
zero_order_invalidation(filter f)
Definition: rs_processing.hpp:972
rs2_processing_block * rs2_create_colorizer(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:122
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:99
pointcloud(rs2_stream stream, int index=0)
Definition: rs_processing.hpp:420
rs2_processing_block * rs2_create_threshold(rs2_error **error)
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:614
Definition: rs_processing.hpp:482
hole_filling_filter(int mode)
Definition: rs_processing.hpp:1048
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:183
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)
align(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:692
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)
Definition: rs_processing.hpp:764
void enqueue(frame f) const
Definition: rs_processing.hpp:158
rs2_processing_block * rs2_create_hole_filling_filter_block(rs2_error **error)
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition: rs_processing.hpp:366
rs2_processing_block * rs2_create_units_transform(rs2_error **error)
const char * rs2_get_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
decimation_filter()
Definition: rs_processing.hpp:771
void map_to(frame mapped)
Definition: rs_processing.hpp:452
hole_filling_filter(filter f)
Definition: rs_processing.hpp:1053
Definition: rs_types.hpp:32
frame_queue()
Definition: rs_processing.hpp:152
@ RS2_EXTENSION_DEPTH_HUFFMAN_DECODER
Definition: rs_types.h:181
void rs2_process_frame(rs2_processing_block *block, rs2_frame *frame, rs2_error **error)
Definition: rs_frame.hpp:712
Definition: rs_processing.hpp:233
pointcloud()
Definition: rs_processing.hpp:418
rs2_frame * get() const
Definition: rs_frame.hpp:583
float min
Definition: rs_types.hpp:164
struct rs2_options rs2_options
Definition: rs_types.h:242
void frame_ready(frame result) const
Definition: rs_processing.hpp:99
@ RS2_EXTENSION_SPATIAL_FILTER
Definition: rs_types.h:164
Definition: rs_processing.hpp:962
bool is() const
Definition: rs_processing.hpp:391
bool supports(rs2_option option) const
Definition: rs_options.hpp:19
Definition: rs_processing.hpp:597
Definition: rs_processing.hpp:511
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
rs2_processing_block * rs2_create_disparity_transform_block(unsigned char transform_to_disparity, rs2_error **error)
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
Definition: rs_context.hpp:11
bool supports(rs2_camera_info info) const
Definition: rs_processing.hpp:310
void rs2_delete_frame_queue(rs2_frame_queue *queue)
decimation_filter(float magnitude)
Definition: rs_processing.hpp:777
void rs2_delete_processing_block(rs2_processing_block *block)
rs2_frame * rs2_allocate_points(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, rs2_error **error)
int rs2_is_processing_block_extendable_to(const rs2_processing_block *block, rs2_extension extension_type, rs2_error **error)
depth_huffman_decoder(filter f)
Definition: rs_processing.hpp:1006
@ RS2_EXTENSION_VIDEO_FRAME
Definition: rs_types.h:144
colorizer(float color_scheme)
Definition: rs_processing.hpp:731
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls,...
Definition: rs_option.h:22
@ RS2_OPTION_FILTER_MAGNITUDE
Definition: rs_option.h:60
align(rs2_stream align_to)
Definition: rs_processing.hpp:676
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition: rs_processing.hpp:519
@ RS2_OPTION_MAX_DISTANCE
Definition: rs_option.h:58
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition: rs_processing.hpp:837
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
void operator()(frame f) const
Definition: rs_processing.hpp:208
@ RS2_EXTENSION_DECIMATION_FILTER
Definition: rs_types.h:161
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 * get() const
Definition: rs_processing.hpp:303
@ RS2_EXTENSION_ZERO_ORDER_FILTER
Definition: rs_types.h:167
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:496
@ RS2_OPTION_FILTER_SMOOTH_ALPHA
Definition: rs_option.h:61
options & operator=(const options &other)
Definition: rs_options.hpp:134
rs2_processing_block * rs2_create_align(rs2_stream align_to, rs2_error **error)
int rs2_supports_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
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
void operator()(frame f) const
Definition: rs_processing.hpp:652
rs2_frame * rs2_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_error **error)
float max
Definition: rs_types.hpp:165
@ RS2_OPTION_STREAM_FILTER
Definition: rs_option.h:67
Definition: rs_processing.hpp:871
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:740
Definition: rs_processing.hpp:997
Definition: rs_processing.hpp:664
Definition: rs_context.hpp:96
Definition: rs_frame.hpp:329
Definition: rs_processing.hpp:343
Definition: rs_processing.hpp:810
stream_profile get_profile() const
Definition: rs_frame.hpp:550
rs2_processing_block * rs2_create_zero_order_invalidation_block(rs2_error **error)
Definition: rs_processing.hpp:134
bool keep_frames() const
Definition: rs_processing.hpp:222
frame_queue _queue
Definition: rs_processing.hpp:406
Definition: rs_processing.hpp:118
Definition: rs_frame.hpp:629
static void handle(rs2_error *e)
Definition: rs_types.hpp:130
Definition: rs_processing.hpp:1080
spatial_filter(filter f)
Definition: rs_processing.hpp:900
@ RS2_EXTENSION_TEMPORAL_FILTER
Definition: rs_types.h:165
Definition: rs_frame.hpp:1123
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:124
spatial_filter()
Definition: rs_processing.hpp:881
@ RS2_OPTION_MIN_DISTANCE
Definition: rs_option.h:57
Definition: rs_processing.hpp:412
@ RS2_OPTION_HOLES_FILL
Definition: rs_option.h:63
hole_filling_filter()
Definition: rs_processing.hpp:1038
const char * get_info(rs2_camera_info info) const
Definition: rs_processing.hpp:323
@ RS2_OPTION_STREAM_INDEX_FILTER
Definition: rs_option.h:69
threshold_filter(filter f)
Definition: rs_processing.hpp:526
int stream_index() const
Definition: rs_frame.hpp:34
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:281
rs2_processing_block * get() const
Definition: rs_processing.hpp:388
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:624
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
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)
float def
Definition: rs_types.hpp:166
struct rs2_processing_block rs2_processing_block
Definition: rs_types.h:234
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:461
rs2_frame * rs2_allocate_composite_frame(rs2_source *source, rs2_frame **frames, int count, rs2_error **error)
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
Definition: rs_processing.hpp:1031
decimation_filter(filter f)
Definition: rs_processing.hpp:782
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:537
temporal_filter(filter f)
Definition: rs_processing.hpp:844
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:41
rs2_processing_block * rs2_create_sync_processing_block(rs2_error **error)
void release() override
Definition: rs_processing.hpp:131
size_t capacity() const
Definition: rs_processing.hpp:216
temporal_filter()
Definition: rs_processing.hpp:819
@ RS2_OPTION_COLOR_SCHEME
Definition: rs_option.h:55
frame allocate_points(const stream_profile &profile, const frame &original) const
Definition: rs_processing.hpp:67
depth_huffman_decoder()
Definition: rs_processing.hpp:1003
struct rs2_error rs2_error
Definition: rs_types.h:217
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:82
rs2_processing_block * rs2_create_huffman_depth_decompress_block(rs2_error **error)
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
@ RS2_EXTENSION_DISPARITY_FILTER
Definition: rs_types.h:163
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:352
processing_block(S processing_function)
Definition: rs_processing.hpp:292
@ RS2_EXTENSION_THRESHOLD_FILTER
Definition: rs_types.h:162