Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Loading...
Searching...
No Matches
rs_processing.hpp
Go to the documentation of this file.
1// License: Apache 2.0. See LICENSE file in root directory.
2// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
3
4#ifndef LIBREALSENSE_RS2_PROCESSING_HPP
5#define LIBREALSENSE_RS2_PROCESSING_HPP
6
7#include "rs_types.hpp"
8#include "rs_frame.hpp"
9#include "rs_options.hpp"
10
11namespace rs2
12{
18 class frame_source
19 {
20 public:
34 const frame& original,
35 int new_bpp = 0,
36 int new_width = 0,
37 int new_height = 0,
38 int new_stride = 0,
40 {
41 rs2_error* e = nullptr;
42 auto result = rs2_allocate_synthetic_video_frame(_source, profile.get(),
43 original.get(), new_bpp, new_width, new_height, new_stride, frame_type, &e);
45 return result;
46 }
47
57 const frame& original,
59 {
60 rs2_error* e = nullptr;
61 auto result = rs2_allocate_synthetic_motion_frame(_source, profile.get(),
62 original.get(), frame_type, &e);
64 return result;
65 }
66
68 const frame& original) const
69 {
70 rs2_error* e = nullptr;
71 auto result = rs2_allocate_points(_source, profile.get(), original.get(), &e);
73 return result;
74 }
75
82 frame allocate_composite_frame(std::vector<frame> frames) const
83 {
84 rs2_error* e = nullptr;
85
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);
89
90 auto result = rs2_allocate_composite_frame(_source, refs.data(), (int)refs.size(), &e);
92 return result;
93 }
94
99 void frame_ready(frame result) const
100 {
101 rs2_error* e = nullptr;
103 error::handle(e);
104 result.frame_ref = nullptr;
105 }
106
108 private:
109 template<class T>
111
112 frame_source(rs2_source* source) : _source(source) {}
113 frame_source(const frame_source&) = delete;
114
115 };
116
117 template<class T>
119 {
120 T on_frame_function;
121 public:
122 explicit frame_processor_callback(T on_frame) : on_frame_function(on_frame) {}
123
124 void on_frame(rs2_frame* f, rs2_source * source) override
125 {
126 frame_source src(source);
127 frame frm(f);
128 on_frame_function(std::move(frm), src);
129 }
130
131 void release() override { delete this; }
132 };
133
135 {
136 public:
143 explicit frame_queue(unsigned int capacity, bool keep_frames = false) : _capacity(capacity), _keep(keep_frames)
144 {
145 rs2_error* e = nullptr;
146 _queue = std::shared_ptr<rs2_frame_queue>(
149 error::handle(e);
150 }
151
153
158 void enqueue(frame f) const
159 {
160 if (_keep) f.keep();
161 rs2_enqueue_frame(f.frame_ref, _queue.get()); // noexcept
162 f.frame_ref = nullptr; // frame has been essentially moved from
163 }
164
169 frame wait_for_frame(unsigned int timeout_ms = 5000) const
170 {
171 rs2_error* e = nullptr;
172 auto frame_ref = rs2_wait_for_frame(_queue.get(), timeout_ms, &e);
173 error::handle(e);
174 return{ frame_ref };
175 }
176
182 template<typename T>
183 typename std::enable_if<std::is_base_of<rs2::frame, T>::value, bool>::type poll_for_frame(T* output) const
184 {
185 rs2_error* e = nullptr;
186 rs2_frame* frame_ref = nullptr;
187 auto res = rs2_poll_for_frame(_queue.get(), &frame_ref, &e);
188 error::handle(e);
189 frame f{ frame_ref };
190 if (res) *output = f;
191 return res > 0;
192 }
193
194 template<typename T>
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
196 {
197 rs2_error* e = nullptr;
198 rs2_frame* frame_ref = nullptr;
199 auto res = rs2_try_wait_for_frame(_queue.get(), timeout_ms, &frame_ref, &e);
200 error::handle(e);
201 frame f{ frame_ref };
202 if (res) *output = f;
203 return res > 0;
204 }
205
208 void operator()(frame f) const
209 {
210 enqueue(std::move(f));
211 }
212
217 size_t size() const
218 {
219 rs2_error* e = nullptr;
220 auto res = rs2_frame_queue_size(_queue.get(), &e);
221 error::handle(e);
222 return static_cast<size_t>(res);
223 }
224
229 size_t capacity() const { return _capacity; }
234 bool keep_frames() const { return _keep; }
235
240 std::shared_ptr<rs2_frame_queue> get() { return _queue; }
241
242 private:
243 std::shared_ptr<rs2_frame_queue> _queue;
244 size_t _capacity;
245 bool _keep;
246 };
247
252 {
253 public:
254 using options::supports;
255
261 template<class S>
262 void start(S on_frame)
263 {
264 rs2_error* e = nullptr;
265 rs2_start_processing(get(), new frame_callback<S>(on_frame), &e);
266 error::handle(e);
267 }
268
274 template<class S>
275 S& operator>>(S& on_frame)
276 {
277 start(on_frame);
278 return on_frame;
279 }
280
285 void invoke(frame f) const
286 {
287 rs2_frame* ptr = nullptr;
288 std::swap(f.frame_ref, ptr);
289
290 rs2_error* e = nullptr;
291 rs2_process_frame(get(), ptr, &e);
292 error::handle(e);
293 }
294
299 processing_block(std::shared_ptr<rs2_processing_block> block)
300 : options((rs2_options*)block.get()), _block(block)
301 {
302 }
303
309 template<class S>
310 processing_block(S processing_function)
311 {
312 rs2_error* e = nullptr;
313 _block = std::shared_ptr<rs2_processing_block>(
314 rs2_create_processing_block(new frame_processor_callback<S>(processing_function), &e),
317 error::handle(e);
318 }
319
320 operator rs2_options*() const { return (rs2_options*)get(); }
321 rs2_processing_block* get() const { return _block.get(); }
322
328 bool supports(rs2_camera_info info) const
329 {
330 rs2_error* e = nullptr;
331 auto is_supported = rs2_supports_processing_block_info(_block.get(), info, &e);
332 error::handle(e);
333 return is_supported > 0;
334 }
335
341 const char* get_info(rs2_camera_info info) const
342 {
343 rs2_error* e = nullptr;
344 auto result = rs2_get_processing_block_info(_block.get(), info, &e);
345 error::handle(e);
346 return result;
347 }
348 protected:
350 rs2_error * e = nullptr;
352 range.min, range.max, range.step, range.def, &e);
353 error::handle(e);
354 }
355 std::shared_ptr<rs2_processing_block> _block;
356 };
357
362 {
363 public:
371 {
372 invoke(frame);
373 rs2::frame f;
374 if (!_queue.poll_for_frame(&f))
375 throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
376 return f;
377 }
378
384 filter(std::shared_ptr<rs2_processing_block> block, int queue_size = 1)
385 : processing_block(block),
386 _queue(queue_size)
387 {
388 start(_queue);
389 }
390
396 template<class S>
397 filter(S processing_function, int queue_size = 1) :
398 processing_block(processing_function),
399 _queue(queue_size)
400 {
401 start(_queue);
402 }
403
404
406 rs2_processing_block* get() const { return _block.get(); }
407
408 template<class T>
409 bool is() const
410 {
411 T extension(*this);
412 return extension;
413 }
414
415 template<class T>
416 T as() const
417 {
418 T extension(*this);
419 return extension;
420 }
421
422 operator bool() const { return _block.get() != nullptr; }
423 protected:
425 };
426
430 class pointcloud : public filter
431 {
432 public:
436 pointcloud() : filter(init(), 1) {}
437
438 pointcloud(rs2_stream stream, int index = 0) : filter(init(), 1)
439 {
440 set_option(RS2_OPTION_STREAM_FILTER, float(stream));
442 }
443
449 points calculate(frame depth) const
450 {
451 auto res = process(depth);
452 if (res.as<points>())
453 return res;
454
455 if (auto set = res.as <frameset>())
456 {
457 for (auto f : set)
458 {
459 if(f.as<points>())
460 return f;
461 }
462 }
463 throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
464 }
465
477
478 protected:
479 pointcloud(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
480
481 private:
482 friend class context;
483
484 std::shared_ptr<rs2_processing_block> init()
485 {
486 rs2_error* e = nullptr;
487
488 auto block = std::shared_ptr<rs2_processing_block>(
491
492 error::handle(e);
493
494 // Redirect options API to the processing block
495 //options::operator=(pb);
496 return block;
497 }
498 };
499
500 class yuy_decoder : public filter
501 {
502 public:
511 yuy_decoder() : filter(init(), 1) { }
512
513 protected:
514 yuy_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
515
516 private:
517 std::shared_ptr<rs2_processing_block> init()
518 {
519 rs2_error* e = nullptr;
520 auto block = std::shared_ptr<rs2_processing_block>(
523 error::handle(e);
524
525 return block;
526 }
527 };
528
529 class y411_decoder : public filter
530 {
531 public:
538 y411_decoder() : filter(init()) { }
539
540 protected:
541 y411_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block) {}
542
543 private:
544 static std::shared_ptr<rs2_processing_block> init()
545 {
546 rs2_error* e = nullptr;
547 auto block = std::shared_ptr<rs2_processing_block>(
550 error::handle(e);
551
552 return block;
553 }
554 };
556 {
557 public:
563 threshold_filter(float min_dist = 0.15f, float max_dist = 4.f)
564 : filter(init(), 1)
565 {
568 }
569
571 {
572 rs2_error* e = nullptr;
574 {
575 _block.reset();
576 }
577 error::handle(e);
578 }
579
580 protected:
581 threshold_filter(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
582
583 private:
584 std::shared_ptr<rs2_processing_block> init()
585 {
586 rs2_error* e = nullptr;
587 auto block = std::shared_ptr<rs2_processing_block>(
590 error::handle(e);
591
592 return block;
593 }
594 };
595
596 class units_transform : public filter
597 {
598 public:
602 units_transform() : filter(init(), 1) {}
603
604 protected:
605 units_transform(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
606
607 private:
608 std::shared_ptr<rs2_processing_block> init()
609 {
610 rs2_error* e = nullptr;
611 auto block = std::shared_ptr<rs2_processing_block>(
614 error::handle(e);
615
616 return block;
617 }
618 };
619
621 {
622 public:
627
628 private:
629 std::shared_ptr<rs2_processing_block> init()
630 {
631 rs2_error* e = nullptr;
632 auto block = std::shared_ptr<rs2_processing_block>(
635
636 error::handle(e);
637 return block;
638 }
639 };
640
641 class syncer
642 {
643 public:
647 syncer(int queue_size = 1)
648 :_results(queue_size)
649 {
650 _sync.start(_results);
651 }
652
658 frameset wait_for_frames(unsigned int timeout_ms = 5000) const
659 {
660 return frameset(_results.wait_for_frame(timeout_ms));
661 }
662
668 bool poll_for_frames(frameset* fs) const
669 {
670 frame result;
671 if (_results.poll_for_frame(&result))
672 {
673 *fs = frameset(result);
674 return true;
675 }
676 return false;
677 }
678
685 bool try_wait_for_frames(frameset* fs, unsigned int timeout_ms = 5000) const
686 {
687 frame result;
688 if (_results.try_wait_for_frame(&result, timeout_ms))
689 {
690 *fs = frameset(result);
691 return true;
692 }
693 return false;
694 }
695
696 void operator()(frame f) const
697 {
698 _sync.invoke(std::move(f));
699 }
700 private:
702 frame_queue _results;
703 };
704
708 class align : public filter
709 {
710 public:
720 align(rs2_stream align_to) : filter(init(align_to), 1) {}
721
722 using filter::process;
723
731 {
732 return filter::process(frames);
733 }
734
735 protected:
736 align(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
737
738 private:
739 friend class context;
740 std::shared_ptr<rs2_processing_block> init(rs2_stream align_to)
741 {
742 rs2_error* e = nullptr;
743 auto block = std::shared_ptr<rs2_processing_block>(
744 rs2_create_align(align_to, &e),
746 error::handle(e);
747
748 return block;
749 }
750 };
751
752 class colorizer : public filter
753 {
754 public:
759 colorizer() : filter(init(), 1) { }
775 colorizer(float color_scheme) : filter(init(), 1)
776 {
777 set_option(RS2_OPTION_COLOR_SCHEME, float(color_scheme));
778 }
779
785 {
786 return process(depth);
787 }
788
789 protected:
790 colorizer(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
791
792 private:
793 std::shared_ptr<rs2_processing_block> init()
794 {
795 rs2_error* e = nullptr;
796 auto block = std::shared_ptr<rs2_processing_block>(
799 error::handle(e);
800
801 // Redirect options API to the processing block
802 //options::operator=(pb);
803
804 return block;
805 }
806 };
807
809 {
810 public:
815 decimation_filter() : filter(init(), 1) {}
821 decimation_filter(float magnitude) : filter(init(), 1)
822 {
824 }
825
827 {
828 rs2_error* e = nullptr;
830 {
831 _block.reset();
832 }
833 error::handle(e);
834 }
835
836 private:
837 friend class context;
838
839 std::shared_ptr<rs2_processing_block> init()
840 {
841 rs2_error* e = nullptr;
842 auto block = std::shared_ptr<rs2_processing_block>(
845 error::handle(e);
846
847 // Redirect options API to the processing block
848 //options::operator=(this);
849
850 return block;
851 }
852 };
853
854 class rotation_filter : public filter
855 {
856 public:
862 : filter( init( std::vector< rs2_stream >{ RS2_STREAM_DEPTH } ), 1 )
863 {
864 }
865
866 rotation_filter( std::vector< rs2_stream > streams_to_rotate )
867 : filter( init( streams_to_rotate ), 1 )
868 {
869 }
870
871 rotation_filter( std::vector< rs2_stream > streams_to_rotate, float value )
872 : filter( init( streams_to_rotate ), 1 )
873 {
875 }
876
878 : filter( f )
879 {
880 rs2_error * e = nullptr;
882 {
883 _block.reset();
884 }
885 error::handle( e );
886 }
887
888 private:
889 friend class context;
890
891 std::shared_ptr< rs2_processing_block > init( std::vector< rs2_stream > streams_to_rotate )
892 {
893 rs2_error * e = nullptr;
894
895 rs2_streams_list streams_list;
896 streams_list.list = std::move( streams_to_rotate );
897
898 auto block = std::shared_ptr< rs2_processing_block >( rs2_create_rotation_filter_block( streams_list, &e ),
900 error::handle( e );
901 return block;
902 }
903 };
904
905 class temporal_filter : public filter
906 {
907 public:
914 temporal_filter() : filter(init(), 1) {}
932 temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control) : filter(init(), 1)
933 {
934 set_option(RS2_OPTION_HOLES_FILL, float(persistence_control));
935 set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
936 set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
937 }
938
940 {
941 rs2_error* e = nullptr;
943 {
944 _block.reset();
945 }
946 error::handle(e);
947 }
948 private:
949 friend class context;
950
951 std::shared_ptr<rs2_processing_block> init()
952 {
953 rs2_error* e = nullptr;
954 auto block = std::shared_ptr<rs2_processing_block>(
957 error::handle(e);
958
959 // Redirect options API to the processing block
960 //options::operator=(pb);
961
962 return block;
963 }
964 };
965
966 class spatial_filter : public filter
967 {
968 public:
976 spatial_filter() : filter(init(), 1) { }
977
987 spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill) : filter(init(), 1)
988 {
989 set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
990 set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
993 }
994
996 {
997 rs2_error* e = nullptr;
999 {
1000 _block.reset();
1001 }
1002 error::handle(e);
1003 }
1004 private:
1005 friend class context;
1006
1007 std::shared_ptr<rs2_processing_block> init()
1008 {
1009 rs2_error* e = nullptr;
1010 auto block = std::shared_ptr<rs2_processing_block>(
1013 error::handle(e);
1014
1015 // Redirect options API to the processing block
1016 //options::operator=(pb);
1017
1018 return block;
1019 }
1020 };
1021
1023 {
1024 public:
1029 disparity_transform(bool transform_to_disparity = true) : filter(init(transform_to_disparity), 1) { }
1030
1032 {
1033 rs2_error* e = nullptr;
1035 {
1036 _block.reset();
1037 }
1038 error::handle(e);
1039 }
1040 private:
1041 friend class context;
1042 std::shared_ptr<rs2_processing_block> init(bool transform_to_disparity)
1043 {
1044 rs2_error* e = nullptr;
1045 auto block = std::shared_ptr<rs2_processing_block>(
1046 rs2_create_disparity_transform_block(uint8_t(transform_to_disparity), &e),
1048 error::handle(e);
1049
1050 // Redirect options API to the processing block
1051 //options::operator=(pb);
1052
1053 return block;
1054 }
1055 };
1056
1058 {
1059 public:
1064 {}
1065
1067 {
1068 rs2_error* e = nullptr;
1070 {
1071 _block.reset();
1072 }
1073 error::handle(e);
1074 }
1075
1076 private:
1077 friend class context;
1078
1079 std::shared_ptr<rs2_processing_block> init()
1080 {
1081 rs2_error* e = nullptr;
1082 auto block = std::shared_ptr<rs2_processing_block>(
1085 error::handle(e);
1086
1087 return block;
1088 }
1089 };
1090
1092 {
1093 public:
1098 hole_filling_filter() : filter(init(), 1) {}
1099
1108 hole_filling_filter(int mode) : filter(init(), 1)
1109 {
1110 set_option(RS2_OPTION_HOLES_FILL, float(mode));
1111 }
1112
1114 {
1115 rs2_error* e = nullptr;
1117 {
1118 _block.reset();
1119 }
1120 error::handle(e);
1121 }
1122 private:
1123 friend class context;
1124
1125 std::shared_ptr<rs2_processing_block> init()
1126 {
1127 rs2_error* e = nullptr;
1128 auto block = std::shared_ptr<rs2_processing_block>(
1131 error::handle(e);
1132
1133 // Redirect options API to the processing block
1134 //options::operator=(_block);
1135
1136 return block;
1137 }
1138 };
1139
1140 class rates_printer : public filter
1141 {
1142 public:
1147 rates_printer() : filter(init(), 1) {}
1148
1149 private:
1150 friend class context;
1151
1152 std::shared_ptr<rs2_processing_block> init()
1153 {
1154 rs2_error* e = nullptr;
1155 auto block = std::shared_ptr<rs2_processing_block>(
1158 error::handle(e);
1159
1160 return block;
1161 }
1162 };
1163
1164 class hdr_merge : public filter
1165 {
1166 public:
1172 hdr_merge() : filter(init()) {}
1173
1175 {
1176 rs2_error* e = nullptr;
1178 {
1179 _block.reset();
1180 }
1181 error::handle(e);
1182 }
1183
1184 private:
1185 friend class context;
1186
1187 std::shared_ptr<rs2_processing_block> init()
1188 {
1189 rs2_error* e = nullptr;
1190 auto block = std::shared_ptr<rs2_processing_block>(
1193 error::handle(e);
1194
1195 return block;
1196 }
1197 };
1198
1200 {
1201 public:
1207
1213 sequence_id_filter(float sequence_id) : filter(init(), 1)
1214 {
1215 set_option(RS2_OPTION_SEQUENCE_ID, sequence_id);
1216 }
1217
1219 {
1220 rs2_error* e = nullptr;
1222 {
1223 _block.reset();
1224 }
1225 error::handle(e);
1226 }
1227
1228 private:
1229 friend class context;
1230
1231 std::shared_ptr<rs2_processing_block> init()
1232 {
1233 rs2_error* e = nullptr;
1234 auto block = std::shared_ptr<rs2_processing_block>(
1237 error::handle(e);
1238
1239 return block;
1240 }
1241 };
1242}
1243#endif // LIBREALSENSE_RS2_PROCESSING_HPP
align(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:736
frameset process(frameset frames)
Definition rs_processing.hpp:730
friend class context
Definition rs_processing.hpp:739
align(rs2_stream align_to)
Definition rs_processing.hpp:720
Definition rs_processing.hpp:621
asynchronous_syncer()
Definition rs_processing.hpp:626
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:790
video_frame colorize(frame depth) const
Definition rs_processing.hpp:784
colorizer()
Definition rs_processing.hpp:759
colorizer(float color_scheme)
Definition rs_processing.hpp:775
decimation_filter(float magnitude)
Definition rs_processing.hpp:821
decimation_filter()
Definition rs_processing.hpp:815
friend class context
Definition rs_processing.hpp:837
decimation_filter(filter f)
Definition rs_processing.hpp:826
depth_huffman_decoder(filter f)
Definition rs_processing.hpp:1066
depth_huffman_decoder()
Definition rs_processing.hpp:1063
friend class context
Definition rs_processing.hpp:1077
disparity_transform(filter f)
Definition rs_processing.hpp:1031
disparity_transform(bool transform_to_disparity=true)
Definition rs_processing.hpp:1029
friend class context
Definition rs_processing.hpp:1041
static void handle(rs2_error *e)
Definition rs_types.hpp:167
Definition rs_frame.hpp:348
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition rs_processing.hpp:384
filter(S processing_function, int queue_size=1)
Definition rs_processing.hpp:397
rs2_processing_block * get() const
Definition rs_processing.hpp:406
rs2::frame process(rs2::frame frame) const override
Definition rs_processing.hpp:370
bool is() const
Definition rs_processing.hpp:409
T as() const
Definition rs_processing.hpp:416
frame_queue get_queue()
Definition rs_processing.hpp:405
frame_queue _queue
Definition rs_processing.hpp:424
Definition rs_frame.hpp:1190
Definition rs_processing.hpp:119
void on_frame(rs2_frame *f, rs2_source *source) override
Definition rs_processing.hpp:124
frame_processor_callback(T on_frame)
Definition rs_processing.hpp:122
void release() override
Definition rs_processing.hpp:131
Definition rs_processing.hpp:135
void enqueue(frame f) const
Definition rs_processing.hpp:158
size_t capacity() const
Definition rs_processing.hpp:229
void operator()(frame f) const
Definition rs_processing.hpp:208
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition rs_processing.hpp:169
size_t size() const
Definition rs_processing.hpp:217
frame_queue()
Definition rs_processing.hpp:152
bool keep_frames() const
Definition rs_processing.hpp:234
std::shared_ptr< rs2_frame_queue > get()
Definition rs_processing.hpp:240
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition rs_processing.hpp:183
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
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition rs_processing.hpp:143
Definition rs_processing.hpp:19
frame allocate_composite_frame(std::vector< frame > frames) const
Definition rs_processing.hpp:82
void frame_ready(frame result) const
Definition rs_processing.hpp:99
friend class frame_processor_callback
Definition rs_processing.hpp:110
rs2_source * _source
Definition rs_processing.hpp:107
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
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
frame allocate_points(const stream_profile &profile, const frame &original) const
Definition rs_processing.hpp:67
Definition rs_frame.hpp:355
void keep()
Definition rs_frame.hpp:448
stream_profile get_profile() const
Definition rs_frame.hpp:568
rs2_frame * get() const
Definition rs_frame.hpp:601
Definition rs_frame.hpp:967
friend class context
Definition rs_processing.hpp:1185
hdr_merge(filter f)
Definition rs_processing.hpp:1174
hdr_merge()
Definition rs_processing.hpp:1172
hole_filling_filter(int mode)
Definition rs_processing.hpp:1108
hole_filling_filter(filter f)
Definition rs_processing.hpp:1113
hole_filling_filter()
Definition rs_processing.hpp:1098
friend class context
Definition rs_processing.hpp:1123
options & operator=(const options &other)
Definition rs_options.hpp:323
options(const options &other)
Definition rs_options.hpp:329
void set_option(rs2_option option, float value) const
Definition rs_options.hpp:256
bool supports(rs2_option option) const
Definition rs_options.hpp:163
pointcloud()
Definition rs_processing.hpp:436
pointcloud(rs2_stream stream, int index=0)
Definition rs_processing.hpp:438
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:479
points calculate(frame depth) const
Definition rs_processing.hpp:449
friend class context
Definition rs_processing.hpp:482
void map_to(frame mapped)
Definition rs_processing.hpp:470
Definition rs_frame.hpp:749
const char * get_info(rs2_camera_info info) const
Definition rs_processing.hpp:341
processing_block(S processing_function)
Definition rs_processing.hpp:310
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:299
void invoke(frame f) const
Definition rs_processing.hpp:285
bool supports(rs2_camera_info info) const
Definition rs_processing.hpp:328
void register_simple_option(rs2_option option_id, option_range range)
Definition rs_processing.hpp:349
std::shared_ptr< rs2_processing_block > _block
Definition rs_processing.hpp:355
void start(S on_frame)
Definition rs_processing.hpp:262
rs2_processing_block * get() const
Definition rs_processing.hpp:321
S & operator>>(S &on_frame)
Definition rs_processing.hpp:275
rates_printer()
Definition rs_processing.hpp:1147
friend class context
Definition rs_processing.hpp:1150
rotation_filter(std::vector< rs2_stream > streams_to_rotate, float value)
Definition rs_processing.hpp:871
rotation_filter(std::vector< rs2_stream > streams_to_rotate)
Definition rs_processing.hpp:866
rotation_filter()
Definition rs_processing.hpp:861
rotation_filter(filter f)
Definition rs_processing.hpp:877
friend class context
Definition rs_processing.hpp:889
sequence_id_filter()
Definition rs_processing.hpp:1206
sequence_id_filter(filter f)
Definition rs_processing.hpp:1218
sequence_id_filter(float sequence_id)
Definition rs_processing.hpp:1213
friend class context
Definition rs_processing.hpp:1229
spatial_filter(filter f)
Definition rs_processing.hpp:995
spatial_filter()
Definition rs_processing.hpp:976
friend class context
Definition rs_processing.hpp:1005
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition rs_processing.hpp:987
Definition rs_frame.hpp:23
rs2_format format() const
Definition rs_frame.hpp:44
int stream_index() const
Definition rs_frame.hpp:34
rs2_stream stream_type() const
Definition rs_frame.hpp:39
const rs2_stream_profile * get() const
Definition rs_frame.hpp:146
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition rs_processing.hpp:685
bool poll_for_frames(frameset *fs) const
Definition rs_processing.hpp:668
void operator()(frame f) const
Definition rs_processing.hpp:696
syncer(int queue_size=1)
Definition rs_processing.hpp:647
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition rs_processing.hpp:658
friend class context
Definition rs_processing.hpp:949
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition rs_processing.hpp:932
temporal_filter()
Definition rs_processing.hpp:914
temporal_filter(filter f)
Definition rs_processing.hpp:939
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:581
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition rs_processing.hpp:563
threshold_filter(filter f)
Definition rs_processing.hpp:570
units_transform()
Definition rs_processing.hpp:602
units_transform(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:605
Definition rs_frame.hpp:648
y411_decoder()
Definition rs_processing.hpp:538
y411_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:541
yuy_decoder()
Definition rs_processing.hpp:511
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:514
Definition rs_processing_gl.hpp:13
rs2_frame * rs2_allocate_points(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, 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)
rs2_frame * rs2_allocate_composite_frame(rs2_source *source, rs2_frame **frames, int count, rs2_error **error)
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
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_option
Defines general configuration controls. These can generally be mapped to camera UVC controls,...
Definition rs_option.h:27
@ RS2_OPTION_FILTER_SMOOTH_ALPHA
Definition rs_option.h:65
@ RS2_OPTION_STREAM_FILTER
Definition rs_option.h:71
@ RS2_OPTION_ROTATION
Definition rs_option.h:128
@ RS2_OPTION_HOLES_FILL
Definition rs_option.h:67
@ RS2_OPTION_SEQUENCE_ID
Definition rs_option.h:108
@ RS2_OPTION_MAX_DISTANCE
Definition rs_option.h:62
@ RS2_OPTION_COLOR_SCHEME
Definition rs_option.h:59
@ RS2_OPTION_STREAM_INDEX_FILTER
Definition rs_option.h:73
@ RS2_OPTION_MIN_DISTANCE
Definition rs_option.h:61
@ RS2_OPTION_FILTER_SMOOTH_DELTA
Definition rs_option.h:66
@ RS2_OPTION_FILTER_MAGNITUDE
Definition rs_option.h:64
@ RS2_OPTION_STREAM_FORMAT_FILTER
Definition rs_option.h:72
rs2_processing_block * rs2_create_rotation_filter_block(rs2_streams_list streams_to_rotate, rs2_error **error)
void rs2_delete_processing_block(rs2_processing_block *block)
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
void rs2_delete_frame_queue(rs2_frame_queue *queue)
rs2_processing_block * rs2_create_sequence_id_filter(rs2_error **error)
rs2_processing_block * rs2_create_threshold(rs2_error **error)
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
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)
void rs2_process_frame(rs2_processing_block *block, rs2_frame *frame, rs2_error **error)
const char * rs2_get_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
rs2_processing_block * rs2_create_units_transform(rs2_error **error)
int rs2_is_processing_block_extendable_to(const rs2_processing_block *block, rs2_extension extension_type, rs2_error **error)
rs2_frame_queue * rs2_create_frame_queue(int capacity, rs2_error **error)
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
rs2_frame * rs2_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_error **error)
rs2_processing_block * rs2_create_hdr_merge_processing_block(rs2_error **error)
rs2_processing_block * rs2_create_colorizer(rs2_error **error)
int rs2_try_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_frame **output_frame, rs2_error **error)
rs2_processing_block * rs2_create_align(rs2_stream align_to, rs2_error **error)
rs2_processing_block * rs2_create_y411_decoder(rs2_error **error)
int rs2_supports_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
rs2_processing_block * rs2_create_hole_filling_filter_block(rs2_error **error)
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
int rs2_frame_queue_size(rs2_frame_queue *queue, rs2_error **error)
rs2_processing_block * rs2_create_spatial_filter_block(rs2_error **error)
rs2_processing_block * rs2_create_sync_processing_block(rs2_error **error)
rs2_processing_block * rs2_create_disparity_transform_block(unsigned char transform_to_disparity, rs2_error **error)
rs2_processing_block * rs2_create_huffman_depth_decompress_block(rs2_error **error)
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition rs_sensor.h:45
@ RS2_STREAM_DEPTH
Definition rs_sensor.h:47
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
struct rs2_source rs2_source
Definition rs_types.h:247
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition rs_types.h:138
@ RS2_EXTENSION_MOTION_FRAME
Definition rs_types.h:148
@ RS2_EXTENSION_HDR_MERGE
Definition rs_types.h:190
@ RS2_EXTENSION_HOLE_FILLING_FILTER
Definition rs_types.h:169
@ RS2_EXTENSION_DISPARITY_FILTER
Definition rs_types.h:166
@ RS2_EXTENSION_TEMPORAL_FILTER
Definition rs_types.h:168
@ RS2_EXTENSION_ROTATION_FILTER
Definition rs_types.h:195
@ RS2_EXTENSION_DEPTH_HUFFMAN_DECODER
Definition rs_types.h:184
@ RS2_EXTENSION_VIDEO_FRAME
Definition rs_types.h:147
@ RS2_EXTENSION_SPATIAL_FILTER
Definition rs_types.h:167
@ RS2_EXTENSION_DECIMATION_FILTER
Definition rs_types.h:164
@ RS2_EXTENSION_SEQUENCE_ID_FILTER
Definition rs_types.h:191
@ RS2_EXTENSION_THRESHOLD_FILTER
Definition rs_types.h:165
struct rs2_error rs2_error
Definition rs_types.h:231
struct rs2_options rs2_options
Definition rs_types.h:256
struct rs2_frame rs2_frame
Definition rs_types.h:234
struct rs2_processing_block rs2_processing_block
Definition rs_types.h:248
Definition rs_types.hpp:200
float def
Definition rs_types.hpp:203
float step
Definition rs_types.hpp:204
float max
Definition rs_types.hpp:202
float min
Definition rs_types.hpp:201
Definition rs_types.hpp:40
Definition rs_types.hpp:35
std::vector< rs2_stream > list
Definition rs_types.hpp:36