RealSense Cross Platform API
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 RealSense, Inc. All Rights Reserved.
3
4#ifndef LIBREALSENSE_RS2_PROCESSING_HPP
5#define LIBREALSENSE_RS2_PROCESSING_HPP
6
7#include "rs_frame.hpp"
8#include "rs_options.hpp"
9
10namespace rs2
11{
17 class frame_source
18 {
19 public:
33 const frame& original,
34 int new_bpp = 0,
35 int new_width = 0,
36 int new_height = 0,
37 int new_stride = 0,
39 {
40 rs2_error* e = nullptr;
41 auto result = rs2_allocate_synthetic_video_frame(_source, profile.get(),
42 original.get(), new_bpp, new_width, new_height, new_stride, frame_type, &e);
44 return result;
45 }
46
56 const frame& original,
58 {
59 rs2_error* e = nullptr;
60 auto result = rs2_allocate_synthetic_motion_frame(_source, profile.get(),
61 original.get(), frame_type, &e);
63 return result;
64 }
65
67 const frame& original) const
68 {
69 rs2_error* e = nullptr;
70 auto result = rs2_allocate_points(_source, profile.get(), original.get(), &e);
72 return result;
73 }
74
81 frame allocate_composite_frame(std::vector<frame> frames) const
82 {
83 rs2_error* e = nullptr;
84
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);
88
89 auto result = rs2_allocate_composite_frame(_source, refs.data(), (int)refs.size(), &e);
91 return result;
92 }
93
98 void frame_ready(frame result) const
99 {
100 rs2_error* e = nullptr;
102 error::handle(e);
103 result.frame_ref = nullptr;
104 }
105
107 private:
108 template<class T>
110
111 frame_source(rs2_source* source) : _source(source) {}
112 frame_source(const frame_source&) = delete;
113
114 };
115
116 template<class T>
118 {
119 T on_frame_function;
120 public:
121 explicit frame_processor_callback(T on_frame) : on_frame_function(on_frame) {}
122
123 void on_frame(rs2_frame* f, rs2_source * source) override
124 {
125 frame_source src(source);
126 frame frm(f);
127 on_frame_function(std::move(frm), src);
128 }
129
130 void release() override { delete this; }
131 };
132
134 {
135 public:
142 explicit frame_queue(unsigned int capacity, bool keep_frames = false) : _capacity(capacity), _keep(keep_frames)
143 {
144 rs2_error* e = nullptr;
145 _queue = std::shared_ptr<rs2_frame_queue>(
148 error::handle(e);
149 }
150
152
157 void enqueue(frame f) const
158 {
159 if (_keep) f.keep();
160 rs2_enqueue_frame(f.frame_ref, _queue.get()); // noexcept
161 f.frame_ref = nullptr; // frame has been essentially moved from
162 }
163
168 frame wait_for_frame(unsigned int timeout_ms = 5000) const
169 {
170 rs2_error* e = nullptr;
171 auto frame_ref = rs2_wait_for_frame(_queue.get(), timeout_ms, &e);
172 error::handle(e);
173 return{ frame_ref };
174 }
175
181 template<typename T>
182 typename std::enable_if<std::is_base_of<rs2::frame, T>::value, bool>::type poll_for_frame(T* output) const
183 {
184 rs2_error* e = nullptr;
185 rs2_frame* frame_ref = nullptr;
186 auto res = rs2_poll_for_frame(_queue.get(), &frame_ref, &e);
187 error::handle(e);
188 frame f{ frame_ref };
189 if (res) *output = f;
190 return res > 0;
191 }
192
193 template<typename T>
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
195 {
196 rs2_error* e = nullptr;
197 rs2_frame* frame_ref = nullptr;
198 auto res = rs2_try_wait_for_frame(_queue.get(), timeout_ms, &frame_ref, &e);
199 error::handle(e);
200 frame f{ frame_ref };
201 if (res) *output = f;
202 return res > 0;
203 }
204
207 void operator()(frame f) const
208 {
209 enqueue(std::move(f));
210 }
211
216 size_t size() const
217 {
218 rs2_error* e = nullptr;
219 auto res = rs2_frame_queue_size(_queue.get(), &e);
220 error::handle(e);
221 return static_cast<size_t>(res);
222 }
223
228 size_t capacity() const { return _capacity; }
233 bool keep_frames() const { return _keep; }
234
239 std::shared_ptr<rs2_frame_queue> get() { return _queue; }
240
241 private:
242 std::shared_ptr<rs2_frame_queue> _queue;
243 size_t _capacity;
244 bool _keep;
245 };
246
251 {
252 public:
253 using options::supports;
254
260 template<class S>
261 void start(S on_frame)
262 {
263 rs2_error* e = nullptr;
264 rs2_start_processing(get(), new frame_callback<S>(on_frame), &e);
265 error::handle(e);
266 }
267
273 template<class S>
274 S& operator>>(S& on_frame)
275 {
276 start(on_frame);
277 return on_frame;
278 }
279
284 void invoke(frame f) const
285 {
286 rs2_frame* ptr = nullptr;
287 std::swap(f.frame_ref, ptr);
288
289 rs2_error* e = nullptr;
290 rs2_process_frame(get(), ptr, &e);
291 error::handle(e);
292 }
293
298 processing_block(std::shared_ptr<rs2_processing_block> block)
299 : options((rs2_options*)block.get()), _block(block)
300 {
301 }
302
308 template<class S>
309 processing_block(S processing_function)
310 {
311 rs2_error* e = nullptr;
312 _block = std::shared_ptr<rs2_processing_block>(
313 rs2_create_processing_block(new frame_processor_callback<S>(processing_function), &e),
316 error::handle(e);
317 }
318
319 operator rs2_options*() const { return (rs2_options*)get(); }
320 rs2_processing_block* get() const { return _block.get(); }
321
327 bool supports(rs2_camera_info info) const
328 {
329 rs2_error* e = nullptr;
330 auto is_supported = rs2_supports_processing_block_info(_block.get(), info, &e);
331 error::handle(e);
332 return is_supported > 0;
333 }
334
340 const char* get_info(rs2_camera_info info) const
341 {
342 rs2_error* e = nullptr;
343 auto result = rs2_get_processing_block_info(_block.get(), info, &e);
344 error::handle(e);
345 return result;
346 }
347 protected:
349 rs2_error * e = nullptr;
351 range.min, range.max, range.step, range.def, &e);
352 error::handle(e);
353 }
354 std::shared_ptr<rs2_processing_block> _block;
355 };
356
361 {
362 public:
370 {
371 invoke(frame);
372 rs2::frame f;
373 if (!_queue.poll_for_frame(&f))
374 throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
375 return f;
376 }
377
383 filter(std::shared_ptr<rs2_processing_block> block, int queue_size = 1)
384 : processing_block(block),
385 _queue(queue_size)
386 {
387 start(_queue);
388 }
389
395 template<class S>
396 filter(S processing_function, int queue_size = 1) :
397 processing_block(processing_function),
398 _queue(queue_size)
399 {
400 start(_queue);
401 }
402
403
405 rs2_processing_block* get() const { return _block.get(); }
406
407 template<class T>
408 bool is() const
409 {
410 T extension(*this);
411 return extension;
412 }
413
414 template<class T>
415 T as() const
416 {
417 T extension(*this);
418 return extension;
419 }
420
421 operator bool() const { return _block.get() != nullptr; }
422 protected:
424 };
425
429 class pointcloud : public filter
430 {
431 public:
435 pointcloud() : filter(init(), 1) {}
436
437 pointcloud(rs2_stream stream, int index = 0) : filter(init(), 1)
438 {
439 set_option(RS2_OPTION_STREAM_FILTER, float(stream));
441 }
442
448 points calculate(frame depth) const
449 {
450 auto res = process(depth);
451 if (res.as<points>())
452 return res;
453
454 if (auto set = res.as <frameset>())
455 {
456 for (auto f : set)
457 {
458 if(f.as<points>())
459 return f;
460 }
461 }
462 throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
463 }
464
476
477 protected:
478 pointcloud(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
479
480 private:
481 friend class context;
482
483 std::shared_ptr<rs2_processing_block> init()
484 {
485 rs2_error* e = nullptr;
486
487 auto block = std::shared_ptr<rs2_processing_block>(
490
491 error::handle(e);
492
493 // Redirect options API to the processing block
494 //options::operator=(pb);
495 return block;
496 }
497 };
498
499 class yuy_decoder : public filter
500 {
501 public:
510 yuy_decoder() : filter(init(), 1) { }
511
512 protected:
513 yuy_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
514
515 private:
516 std::shared_ptr<rs2_processing_block> init()
517 {
518 rs2_error* e = nullptr;
519 auto block = std::shared_ptr<rs2_processing_block>(
522 error::handle(e);
523
524 return block;
525 }
526 };
527
528 class m420_decoder : public filter
529 {
530 public:
542 m420_decoder() : filter(init(), 1) { }
543
544 protected:
545 m420_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
546
547 private:
548 std::shared_ptr<rs2_processing_block> init()
549 {
550 rs2_error* e = nullptr;
551 auto block = std::shared_ptr<rs2_processing_block>(
554 error::handle(e);
555
556 return block;
557 }
558 };
559
560 class nv12_decoder : public filter
561 {
562 public:
569 nv12_decoder() : filter(init(), 1) { }
570
571 protected:
572 nv12_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
573
574 private:
575 std::shared_ptr<rs2_processing_block> init()
576 {
577 rs2_error* e = nullptr;
578 auto block = std::shared_ptr<rs2_processing_block>(
581 error::handle(e);
582
583 return block;
584 }
585 };
586
587 class y411_decoder : public filter
588 {
589 public:
596 y411_decoder() : filter(init()) { }
597
598 protected:
599 y411_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block) {}
600
601 private:
602 static std::shared_ptr<rs2_processing_block> init()
603 {
604 rs2_error* e = nullptr;
605 auto block = std::shared_ptr<rs2_processing_block>(
608 error::handle(e);
609
610 return block;
611 }
612 };
614 {
615 public:
621 threshold_filter(float min_dist = 0.15f, float max_dist = 4.f)
622 : filter(init(), 1)
623 {
626 }
627
629 {
630 rs2_error* e = nullptr;
632 {
633 _block.reset();
634 }
635 error::handle(e);
636 }
637
638 protected:
639 threshold_filter(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
640
641 private:
642 std::shared_ptr<rs2_processing_block> init()
643 {
644 rs2_error* e = nullptr;
645 auto block = std::shared_ptr<rs2_processing_block>(
648 error::handle(e);
649
650 return block;
651 }
652 };
653
654 class units_transform : public filter
655 {
656 public:
660 units_transform() : filter(init(), 1) {}
661
662 protected:
663 units_transform(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
664
665 private:
666 std::shared_ptr<rs2_processing_block> init()
667 {
668 rs2_error* e = nullptr;
669 auto block = std::shared_ptr<rs2_processing_block>(
672 error::handle(e);
673
674 return block;
675 }
676 };
677
679 {
680 public:
685
686 private:
687 std::shared_ptr<rs2_processing_block> init()
688 {
689 rs2_error* e = nullptr;
690 auto block = std::shared_ptr<rs2_processing_block>(
693
694 error::handle(e);
695 return block;
696 }
697 };
698
699 class syncer
700 {
701 public:
705 syncer(int queue_size = 1)
706 :_results(queue_size)
707 {
708 _sync.start(_results);
709 }
710
716 frameset wait_for_frames(unsigned int timeout_ms = 5000) const
717 {
718 return frameset(_results.wait_for_frame(timeout_ms));
719 }
720
726 bool poll_for_frames(frameset* fs) const
727 {
728 frame result;
729 if (_results.poll_for_frame(&result))
730 {
731 *fs = frameset(result);
732 return true;
733 }
734 return false;
735 }
736
743 bool try_wait_for_frames(frameset* fs, unsigned int timeout_ms = 5000) const
744 {
745 frame result;
746 if (_results.try_wait_for_frame(&result, timeout_ms))
747 {
748 *fs = frameset(result);
749 return true;
750 }
751 return false;
752 }
753
754 void operator()(frame f) const
755 {
756 _sync.invoke(std::move(f));
757 }
758 private:
760 frame_queue _results;
761 };
762
766 class align : public filter
767 {
768 public:
778 align(rs2_stream align_to) : filter(init(align_to), 1) {}
779
780 using filter::process;
781
789 {
790 return filter::process(frames);
791 }
792
793 protected:
794 align(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
795
796 private:
797 friend class context;
798 std::shared_ptr<rs2_processing_block> init(rs2_stream align_to)
799 {
800 rs2_error* e = nullptr;
801 auto block = std::shared_ptr<rs2_processing_block>(
802 rs2_create_align(align_to, &e),
804 error::handle(e);
805
806 return block;
807 }
808 };
809
810 class colorizer : public filter
811 {
812 public:
817 colorizer() : filter(init(), 1) { }
833 colorizer(float color_scheme) : filter(init(), 1)
834 {
835 set_option(RS2_OPTION_COLOR_SCHEME, float(color_scheme));
836 }
837
843 {
844 return process(depth);
845 }
846
847 protected:
848 colorizer(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
849
850 private:
851 std::shared_ptr<rs2_processing_block> init()
852 {
853 rs2_error* e = nullptr;
854 auto block = std::shared_ptr<rs2_processing_block>(
857 error::handle(e);
858
859 // Redirect options API to the processing block
860 //options::operator=(pb);
861
862 return block;
863 }
864 };
865
867 {
868 public:
873 decimation_filter() : filter(init(), 1) {}
879 decimation_filter(float magnitude) : filter(init(), 1)
880 {
882 }
883
885 {
886 rs2_error* e = nullptr;
888 {
889 _block.reset();
890 }
891 error::handle(e);
892 }
893
894 private:
895 friend class context;
896
897 std::shared_ptr<rs2_processing_block> init()
898 {
899 rs2_error* e = nullptr;
900 auto block = std::shared_ptr<rs2_processing_block>(
903 error::handle(e);
904
905 // Redirect options API to the processing block
906 //options::operator=(this);
907
908 return block;
909 }
910 };
911
912 class rotation_filter : public filter
913 {
914 public:
920 : filter( init( std::vector< rs2_stream >{ RS2_STREAM_DEPTH } ), 1 )
921 {
922 }
923
924 rotation_filter( std::vector< rs2_stream > streams_to_rotate )
925 : filter( init( streams_to_rotate ), 1 )
926 {
927 }
928
929 rotation_filter( std::vector< rs2_stream > streams_to_rotate, float value )
930 : filter( init( streams_to_rotate ), 1 )
931 {
933 }
934
936 : filter( f )
937 {
938 rs2_error * e = nullptr;
940 {
941 _block.reset();
942 }
943 error::handle( e );
944 }
945
946 private:
947 friend class context;
948
949 std::shared_ptr< rs2_processing_block > init( std::vector< rs2_stream > streams_to_rotate )
950 {
951 rs2_error * e = nullptr;
952
953 rs2_streams_list streams_list;
954 streams_list.list = std::move( streams_to_rotate );
955
956 auto block = std::shared_ptr< rs2_processing_block >( rs2_create_rotation_filter_block( streams_list, &e ),
958 error::handle( e );
959 return block;
960 }
961 };
962
963 class temporal_filter : public filter
964 {
965 public:
972 temporal_filter() : filter(init(), 1) {}
990 temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control) : filter(init(), 1)
991 {
992 set_option(RS2_OPTION_HOLES_FILL, float(persistence_control));
993 set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
994 set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
995 }
996
998 {
999 rs2_error* e = nullptr;
1001 {
1002 _block.reset();
1003 }
1004 error::handle(e);
1005 }
1006 private:
1007 friend class context;
1008
1009 std::shared_ptr<rs2_processing_block> init()
1010 {
1011 rs2_error* e = nullptr;
1012 auto block = std::shared_ptr<rs2_processing_block>(
1015 error::handle(e);
1016
1017 // Redirect options API to the processing block
1018 //options::operator=(pb);
1019
1020 return block;
1021 }
1022 };
1023
1024 class spatial_filter : public filter
1025 {
1026 public:
1034 spatial_filter() : filter(init(), 1) { }
1035
1045 spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill) : filter(init(), 1)
1046 {
1047 set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
1048 set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
1051 }
1052
1054 {
1055 rs2_error* e = nullptr;
1057 {
1058 _block.reset();
1059 }
1060 error::handle(e);
1061 }
1062 private:
1063 friend class context;
1064
1065 std::shared_ptr<rs2_processing_block> init()
1066 {
1067 rs2_error* e = nullptr;
1068 auto block = std::shared_ptr<rs2_processing_block>(
1071 error::handle(e);
1072
1073 // Redirect options API to the processing block
1074 //options::operator=(pb);
1075
1076 return block;
1077 }
1078 };
1079
1081 {
1082 public:
1087 disparity_transform(bool transform_to_disparity = true) : filter(init(transform_to_disparity), 1) { }
1088
1090 {
1091 rs2_error* e = nullptr;
1093 {
1094 _block.reset();
1095 }
1096 error::handle(e);
1097 }
1098 private:
1099 friend class context;
1100 std::shared_ptr<rs2_processing_block> init(bool transform_to_disparity)
1101 {
1102 rs2_error* e = nullptr;
1103 auto block = std::shared_ptr<rs2_processing_block>(
1104 rs2_create_disparity_transform_block(uint8_t(transform_to_disparity), &e),
1106 error::handle(e);
1107
1108 // Redirect options API to the processing block
1109 //options::operator=(pb);
1110
1111 return block;
1112 }
1113 };
1114
1116 {
1117 public:
1122 {}
1123
1125 {
1126 rs2_error* e = nullptr;
1128 {
1129 _block.reset();
1130 }
1131 error::handle(e);
1132 }
1133
1134 private:
1135 friend class context;
1136
1137 std::shared_ptr<rs2_processing_block> init()
1138 {
1139 rs2_error* e = nullptr;
1140 auto block = std::shared_ptr<rs2_processing_block>(
1143 error::handle(e);
1144
1145 return block;
1146 }
1147 };
1148
1150 {
1151 public:
1156 hole_filling_filter() : filter(init(), 1) {}
1157
1166 hole_filling_filter(int mode) : filter(init(), 1)
1167 {
1168 set_option(RS2_OPTION_HOLES_FILL, float(mode));
1169 }
1170
1172 {
1173 rs2_error* e = nullptr;
1175 {
1176 _block.reset();
1177 }
1178 error::handle(e);
1179 }
1180 private:
1181 friend class context;
1182
1183 std::shared_ptr<rs2_processing_block> init()
1184 {
1185 rs2_error* e = nullptr;
1186 auto block = std::shared_ptr<rs2_processing_block>(
1189 error::handle(e);
1190
1191 // Redirect options API to the processing block
1192 //options::operator=(_block);
1193
1194 return block;
1195 }
1196 };
1197
1198 class rates_printer : public filter
1199 {
1200 public:
1205 rates_printer() : filter(init(), 1) {}
1206
1207 private:
1208 friend class context;
1209
1210 std::shared_ptr<rs2_processing_block> init()
1211 {
1212 rs2_error* e = nullptr;
1213 auto block = std::shared_ptr<rs2_processing_block>(
1216 error::handle(e);
1217
1218 return block;
1219 }
1220 };
1221
1222 class hdr_merge : public filter
1223 {
1224 public:
1230 hdr_merge() : filter(init()) {}
1231
1233 {
1234 rs2_error* e = nullptr;
1236 {
1237 _block.reset();
1238 }
1239 error::handle(e);
1240 }
1241
1242 private:
1243 friend class context;
1244
1245 std::shared_ptr<rs2_processing_block> init()
1246 {
1247 rs2_error* e = nullptr;
1248 auto block = std::shared_ptr<rs2_processing_block>(
1251 error::handle(e);
1252
1253 return block;
1254 }
1255 };
1256
1258 {
1259 public:
1265
1271 sequence_id_filter(float sequence_id) : filter(init(), 1)
1272 {
1273 set_option(RS2_OPTION_SEQUENCE_ID, sequence_id);
1274 }
1275
1277 {
1278 rs2_error* e = nullptr;
1280 {
1281 _block.reset();
1282 }
1283 error::handle(e);
1284 }
1285
1286 private:
1287 friend class context;
1288
1289 std::shared_ptr<rs2_processing_block> init()
1290 {
1291 rs2_error* e = nullptr;
1292 auto block = std::shared_ptr<rs2_processing_block>(
1295 error::handle(e);
1296
1297 return block;
1298 }
1299 };
1300
1301
1303 {
1304 public:
1305 embedded_filter(std::shared_ptr<rs2_embedded_filter> filter)
1308 {
1309 }
1310
1312 {
1313 rs2_error* e = nullptr;
1314 auto filter_type = rs2_get_embedded_filter_type(_embedded_filter.get(), &e);
1315 error::handle(e);
1316 return filter_type;
1317 }
1318
1319 operator bool() const
1320 {
1321 return _embedded_filter != nullptr;
1322 }
1323
1324 const std::shared_ptr<rs2_embedded_filter>& get() const
1325 {
1326 return _embedded_filter;
1327 }
1328
1329 template<class T>
1330 bool is() const
1331 {
1332 T extension(*this);
1333 return extension;
1334 }
1335
1336 template<class T>
1337 T as() const
1338 {
1339 T extension(*this);
1340 return extension;
1341 }
1342
1343 protected:
1344 std::shared_ptr<rs2_embedded_filter> _embedded_filter;
1345 };
1346
1348 {
1349 public:
1352 {
1353 rs2_error* e = nullptr;
1356 {
1357 _embedded_filter.reset();
1358 }
1359 error::handle(e);
1360 }
1361 operator bool() const { return _embedded_filter.get() != nullptr; }
1362 };
1363
1365 {
1366 public:
1369 {
1370 rs2_error* e = nullptr;
1373 {
1374 _embedded_filter.reset();
1375 }
1376 error::handle(e);
1377 }
1378 operator bool() const { return _embedded_filter.get() != nullptr; }
1379 };
1380}
1381#endif // LIBREALSENSE_RS2_PROCESSING_HPP
align(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:794
frameset process(frameset frames)
Definition rs_processing.hpp:788
friend class context
Definition rs_processing.hpp:797
align(rs2_stream align_to)
Definition rs_processing.hpp:778
Definition rs_processing.hpp:679
asynchronous_syncer()
Definition rs_processing.hpp:684
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:848
video_frame colorize(frame depth) const
Definition rs_processing.hpp:842
colorizer()
Definition rs_processing.hpp:817
colorizer(float color_scheme)
Definition rs_processing.hpp:833
decimation_filter(float magnitude)
Definition rs_processing.hpp:879
decimation_filter()
Definition rs_processing.hpp:873
friend class context
Definition rs_processing.hpp:895
decimation_filter(filter f)
Definition rs_processing.hpp:884
depth_huffman_decoder(filter f)
Definition rs_processing.hpp:1124
depth_huffman_decoder()
Definition rs_processing.hpp:1121
friend class context
Definition rs_processing.hpp:1135
disparity_transform(filter f)
Definition rs_processing.hpp:1089
disparity_transform(bool transform_to_disparity=true)
Definition rs_processing.hpp:1087
friend class context
Definition rs_processing.hpp:1099
embedded_decimation_filter(embedded_filter filter)
Definition rs_processing.hpp:1350
rs2_embedded_filter_type get_type() const
Definition rs_processing.hpp:1311
T as() const
Definition rs_processing.hpp:1337
bool is() const
Definition rs_processing.hpp:1330
const std::shared_ptr< rs2_embedded_filter > & get() const
Definition rs_processing.hpp:1324
embedded_filter(std::shared_ptr< rs2_embedded_filter > filter)
Definition rs_processing.hpp:1305
std::shared_ptr< rs2_embedded_filter > _embedded_filter
Definition rs_processing.hpp:1344
embedded_temporal_filter(embedded_filter filter)
Definition rs_processing.hpp:1367
static void handle(rs2_error *e)
Definition rs_types.hpp:167
Definition rs_frame.hpp:363
Definition rs_processing.hpp:361
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition rs_processing.hpp:383
filter(S processing_function, int queue_size=1)
Definition rs_processing.hpp:396
rs2_processing_block * get() const
Definition rs_processing.hpp:405
rs2::frame process(rs2::frame frame) const override
Definition rs_processing.hpp:369
bool is() const
Definition rs_processing.hpp:408
T as() const
Definition rs_processing.hpp:415
frame_queue get_queue()
Definition rs_processing.hpp:404
frame_queue _queue
Definition rs_processing.hpp:423
Definition rs_frame.hpp:1421
Definition rs_processing.hpp:118
void on_frame(rs2_frame *f, rs2_source *source) override
Definition rs_processing.hpp:123
frame_processor_callback(T on_frame)
Definition rs_processing.hpp:121
void release() override
Definition rs_processing.hpp:130
Definition rs_processing.hpp:134
void enqueue(frame f) const
Definition rs_processing.hpp:157
size_t capacity() const
Definition rs_processing.hpp:228
void operator()(frame f) const
Definition rs_processing.hpp:207
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition rs_processing.hpp:168
size_t size() const
Definition rs_processing.hpp:216
frame_queue()
Definition rs_processing.hpp:151
bool keep_frames() const
Definition rs_processing.hpp:233
std::shared_ptr< rs2_frame_queue > get()
Definition rs_processing.hpp:239
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition rs_processing.hpp:182
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
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition rs_processing.hpp:142
Definition rs_processing.hpp:18
frame allocate_composite_frame(std::vector< frame > frames) const
Definition rs_processing.hpp:81
void frame_ready(frame result) const
Definition rs_processing.hpp:98
friend class frame_processor_callback
Definition rs_processing.hpp:109
rs2_source * _source
Definition rs_processing.hpp:106
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
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
frame allocate_points(const stream_profile &profile, const frame &original) const
Definition rs_processing.hpp:66
Definition rs_frame.hpp:370
void keep()
Definition rs_frame.hpp:463
stream_profile get_profile() const
Definition rs_frame.hpp:583
rs2_frame * get() const
Definition rs_frame.hpp:616
Definition rs_frame.hpp:1157
friend class context
Definition rs_processing.hpp:1243
hdr_merge(filter f)
Definition rs_processing.hpp:1232
hdr_merge()
Definition rs_processing.hpp:1230
hole_filling_filter(int mode)
Definition rs_processing.hpp:1166
hole_filling_filter(filter f)
Definition rs_processing.hpp:1171
hole_filling_filter()
Definition rs_processing.hpp:1156
friend class context
Definition rs_processing.hpp:1181
m420_decoder()
Definition rs_processing.hpp:542
m420_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:545
nv12_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:572
nv12_decoder()
Definition rs_processing.hpp:569
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:435
pointcloud(rs2_stream stream, int index=0)
Definition rs_processing.hpp:437
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:478
points calculate(frame depth) const
Definition rs_processing.hpp:448
friend class context
Definition rs_processing.hpp:481
void map_to(frame mapped)
Definition rs_processing.hpp:469
Definition rs_frame.hpp:764
const char * get_info(rs2_camera_info info) const
Definition rs_processing.hpp:340
processing_block(S processing_function)
Definition rs_processing.hpp:309
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:298
void invoke(frame f) const
Definition rs_processing.hpp:284
bool supports(rs2_camera_info info) const
Definition rs_processing.hpp:327
void register_simple_option(rs2_option option_id, option_range range)
Definition rs_processing.hpp:348
std::shared_ptr< rs2_processing_block > _block
Definition rs_processing.hpp:354
void start(S on_frame)
Definition rs_processing.hpp:261
rs2_processing_block * get() const
Definition rs_processing.hpp:320
S & operator>>(S &on_frame)
Definition rs_processing.hpp:274
rates_printer()
Definition rs_processing.hpp:1205
friend class context
Definition rs_processing.hpp:1208
rotation_filter(std::vector< rs2_stream > streams_to_rotate, float value)
Definition rs_processing.hpp:929
rotation_filter(std::vector< rs2_stream > streams_to_rotate)
Definition rs_processing.hpp:924
rotation_filter()
Definition rs_processing.hpp:919
rotation_filter(filter f)
Definition rs_processing.hpp:935
friend class context
Definition rs_processing.hpp:947
sequence_id_filter()
Definition rs_processing.hpp:1264
sequence_id_filter(filter f)
Definition rs_processing.hpp:1276
sequence_id_filter(float sequence_id)
Definition rs_processing.hpp:1271
friend class context
Definition rs_processing.hpp:1287
spatial_filter(filter f)
Definition rs_processing.hpp:1053
spatial_filter()
Definition rs_processing.hpp:1034
friend class context
Definition rs_processing.hpp:1063
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition rs_processing.hpp:1045
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:743
bool poll_for_frames(frameset *fs) const
Definition rs_processing.hpp:726
void operator()(frame f) const
Definition rs_processing.hpp:754
syncer(int queue_size=1)
Definition rs_processing.hpp:705
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition rs_processing.hpp:716
friend class context
Definition rs_processing.hpp:1007
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition rs_processing.hpp:990
temporal_filter()
Definition rs_processing.hpp:972
temporal_filter(filter f)
Definition rs_processing.hpp:997
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:639
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition rs_processing.hpp:621
threshold_filter(filter f)
Definition rs_processing.hpp:628
units_transform()
Definition rs_processing.hpp:660
units_transform(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:663
Definition rs_frame.hpp:663
y411_decoder()
Definition rs_processing.hpp:596
y411_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:599
yuy_decoder()
Definition rs_processing.hpp:510
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition rs_processing.hpp:513
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)
rs2_processing_block * rs2_create_m420_decoder(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)
rs2_processing_block * rs2_create_nv12_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_embedded_filter_type rs2_get_embedded_filter_type(const rs2_embedded_filter *embedded_filter, 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)
int rs2_is_embedded_filter_extendable_to(const rs2_embedded_filter *embedded_filter, rs2_extension extension_type, 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:48
@ RS2_STREAM_DEPTH
Definition rs_sensor.h:50
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:309
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition rs_types.h:150
@ RS2_EXTENSION_MOTION_FRAME
Definition rs_types.h:160
@ RS2_EXTENSION_HDR_MERGE
Definition rs_types.h:202
@ RS2_EXTENSION_HOLE_FILLING_FILTER
Definition rs_types.h:181
@ RS2_EXTENSION_DISPARITY_FILTER
Definition rs_types.h:178
@ RS2_EXTENSION_TEMPORAL_FILTER
Definition rs_types.h:180
@ RS2_EXTENSION_ROTATION_FILTER
Definition rs_types.h:207
@ RS2_EXTENSION_DEPTH_HUFFMAN_DECODER
Definition rs_types.h:196
@ RS2_EXTENSION_VIDEO_FRAME
Definition rs_types.h:159
@ RS2_EXTENSION_TEMPORAL_EMBEDDED_FILTER
Definition rs_types.h:214
@ RS2_EXTENSION_SPATIAL_FILTER
Definition rs_types.h:179
@ RS2_EXTENSION_DECIMATION_FILTER
Definition rs_types.h:176
@ RS2_EXTENSION_SEQUENCE_ID_FILTER
Definition rs_types.h:203
@ RS2_EXTENSION_THRESHOLD_FILTER
Definition rs_types.h:177
@ RS2_EXTENSION_DECIMATION_EMBEDDED_FILTER
Definition rs_types.h:213
struct rs2_error rs2_error
Definition rs_types.h:293
rs2_embedded_filter_type
Definition rs_types.h:283
struct rs2_options rs2_options
Definition rs_types.h:320
struct rs2_frame rs2_frame
Definition rs_types.h:296
struct rs2_processing_block rs2_processing_block
Definition rs_types.h:310
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