Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
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 
11 namespace rs2
12 {
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,
39  rs2_extension frame_type = RS2_EXTENSION_VIDEO_FRAME) const
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);
44  error::handle(e);
45  return result;
46  }
47 
57  const frame& original,
58  rs2_extension frame_type = RS2_EXTENSION_MOTION_FRAME) const
59  {
60  rs2_error* e = nullptr;
61  auto result = rs2_allocate_synthetic_motion_frame(_source, profile.get(),
62  original.get(), frame_type, &e);
63  error::handle(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);
72  error::handle(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);
91  error::handle(e);
92  return result;
93  }
99  void frame_ready(frame result) const
100  {
101  rs2_error* e = nullptr;
102  rs2_synthetic_frame_ready(_source, result.get(), &e);
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  }
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 
251  class processing_block : public options
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  }
274  template<class S>
275  S& operator>>(S& on_frame)
276  {
277  start(on_frame);
278  return on_frame;
279  }
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  }
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 
361  class filter : public processing_block, public filter_interface
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  }
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  }
470  void map_to(frame mapped)
471  {
475  process(mapped);
476  }
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  };
555  class threshold_filter : public filter
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:
701  asynchronous_syncer _sync;
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  }
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 
808  class decimation_filter : public filter
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 temporal_filter : public filter
855  {
856  public:
863  temporal_filter() : filter(init(), 1) {}
881  temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control) : filter(init(), 1)
882  {
883  set_option(RS2_OPTION_HOLES_FILL, float(persistence_control));
884  set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
885  set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
886  }
887 
889  {
890  rs2_error* e = nullptr;
892  {
893  _block.reset();
894  }
895  error::handle(e);
896  }
897  private:
898  friend class context;
899 
900  std::shared_ptr<rs2_processing_block> init()
901  {
902  rs2_error* e = nullptr;
903  auto block = std::shared_ptr<rs2_processing_block>(
906  error::handle(e);
907 
908  // Redirect options API to the processing block
909  //options::operator=(pb);
910 
911  return block;
912  }
913  };
914 
915  class spatial_filter : public filter
916  {
917  public:
925  spatial_filter() : filter(init(), 1) { }
926 
936  spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill) : filter(init(), 1)
937  {
938  set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
939  set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
941  set_option(RS2_OPTION_HOLES_FILL, hole_fill);
942  }
943 
945  {
946  rs2_error* e = nullptr;
948  {
949  _block.reset();
950  }
951  error::handle(e);
952  }
953  private:
954  friend class context;
955 
956  std::shared_ptr<rs2_processing_block> init()
957  {
958  rs2_error* e = nullptr;
959  auto block = std::shared_ptr<rs2_processing_block>(
962  error::handle(e);
963 
964  // Redirect options API to the processing block
965  //options::operator=(pb);
966 
967  return block;
968  }
969  };
970 
972  {
973  public:
978  disparity_transform(bool transform_to_disparity = true) : filter(init(transform_to_disparity), 1) { }
979 
981  {
982  rs2_error* e = nullptr;
984  {
985  _block.reset();
986  }
987  error::handle(e);
988  }
989  private:
990  friend class context;
991  std::shared_ptr<rs2_processing_block> init(bool transform_to_disparity)
992  {
993  rs2_error* e = nullptr;
994  auto block = std::shared_ptr<rs2_processing_block>(
995  rs2_create_disparity_transform_block(uint8_t(transform_to_disparity), &e),
997  error::handle(e);
998 
999  // Redirect options API to the processing block
1000  //options::operator=(pb);
1001 
1002  return block;
1003  }
1004  };
1005 
1007  {
1008  public:
1013  {}
1014 
1016  {
1017  rs2_error* e = nullptr;
1019  {
1020  _block.reset();
1021  }
1022  error::handle(e);
1023  }
1024 
1025  private:
1026  friend class context;
1027 
1028  std::shared_ptr<rs2_processing_block> init()
1029  {
1030  rs2_error* e = nullptr;
1031  auto block = std::shared_ptr<rs2_processing_block>(
1034  error::handle(e);
1035 
1036  return block;
1037  }
1038  };
1039 
1041  {
1042  public:
1047  hole_filling_filter() : filter(init(), 1) {}
1048 
1057  hole_filling_filter(int mode) : filter(init(), 1)
1058  {
1059  set_option(RS2_OPTION_HOLES_FILL, float(mode));
1060  }
1061 
1063  {
1064  rs2_error* e = nullptr;
1066  {
1067  _block.reset();
1068  }
1069  error::handle(e);
1070  }
1071  private:
1072  friend class context;
1073 
1074  std::shared_ptr<rs2_processing_block> init()
1075  {
1076  rs2_error* e = nullptr;
1077  auto block = std::shared_ptr<rs2_processing_block>(
1080  error::handle(e);
1081 
1082  // Redirect options API to the processing block
1083  //options::operator=(_block);
1084 
1085  return block;
1086  }
1087  };
1088 
1089  class rates_printer : public filter
1090  {
1091  public:
1096  rates_printer() : filter(init(), 1) {}
1097 
1098  private:
1099  friend class context;
1100 
1101  std::shared_ptr<rs2_processing_block> init()
1102  {
1103  rs2_error* e = nullptr;
1104  auto block = std::shared_ptr<rs2_processing_block>(
1107  error::handle(e);
1108 
1109  return block;
1110  }
1111  };
1112 
1113  class hdr_merge : public filter
1114  {
1115  public:
1121  hdr_merge() : filter(init()) {}
1122 
1124  {
1125  rs2_error* e = nullptr;
1127  {
1128  _block.reset();
1129  }
1130  error::handle(e);
1131  }
1132 
1133  private:
1134  friend class context;
1135 
1136  std::shared_ptr<rs2_processing_block> init()
1137  {
1138  rs2_error* e = nullptr;
1139  auto block = std::shared_ptr<rs2_processing_block>(
1142  error::handle(e);
1143 
1144  return block;
1145  }
1146  };
1147 
1149  {
1150  public:
1156 
1162  sequence_id_filter(float sequence_id) : filter(init(), 1)
1163  {
1164  set_option(RS2_OPTION_SEQUENCE_ID, sequence_id);
1165  }
1166 
1168  {
1169  rs2_error* e = nullptr;
1171  {
1172  _block.reset();
1173  }
1174  error::handle(e);
1175  }
1176 
1177  private:
1178  friend class context;
1179 
1180  std::shared_ptr<rs2_processing_block> init()
1181  {
1182  rs2_error* e = nullptr;
1183  auto block = std::shared_ptr<rs2_processing_block>(
1186  error::handle(e);
1187 
1188  return block;
1189  }
1190  };
1191 }
1192 #endif // LIBREALSENSE_RS2_PROCESSING_HPP
decimation_filter()
Definition: rs_processing.hpp:815
rs2_processing_block * rs2_create_decimation_filter_block(rs2_error **error)
Definition: rs_frame.hpp:22
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
Definition: rs_frame.hpp:638
Definition: rs_frame.hpp:345
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:581
rs2_processing_block * rs2_create_threshold(rs2_error **error)
bool supports(rs2_option option) const
Definition: rs_options.hpp:163
Definition: rs_processing.hpp:620
size_t size() const
Definition: rs_processing.hpp:217
std::shared_ptr< rs2_processing_block > _block
Definition: rs_processing.hpp:355
y411_decoder()
Definition: rs_processing.hpp:538
rs2_frame * rs2_allocate_composite_frame(rs2_source *source, rs2_frame **frames, int count, rs2_error **error)
hole_filling_filter(filter f)
Definition: rs_processing.hpp:1062
bool supports(rs2_camera_info info) const
Definition: rs_processing.hpp:328
Definition: rs_types.h:167
Definition: rs_processing.hpp:915
Definition: rs_processing.hpp:1040
Definition: rs_option.h:61
threshold_filter(filter f)
Definition: rs_processing.hpp:570
hdr_merge(filter f)
Definition: rs_processing.hpp:1123
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:26
Definition: rs_types.h:165
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:183
Definition: rs_types.h:166
depth_huffman_decoder()
Definition: rs_processing.hpp:1012
rs2_frame * rs2_allocate_points(rs2_source *source, const rs2_stream_profile *new_stream, rs2_frame *original, rs2_error **error)
rs2_processing_block * rs2_create_units_transform(rs2_error **error)
bool keep_frames() const
Definition: rs_processing.hpp:234
void rs2_start_processing(rs2_processing_block *block, rs2_frame_callback *on_frame, rs2_error **error)
rs2_format format() const
Definition: rs_frame.hpp:44
Definition: rs_types.h:168
Definition: rs_types.h:147
Definition: rs_option.h:59
Definition: rs_processing.hpp:500
Definition: rs_frame.hpp:739
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:229
hdr_merge()
Definition: rs_processing.hpp:1121
Definition: rs_option.h:108
align(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:736
void on_frame(rs2_frame *f, rs2_source *source) override
Definition: rs_processing.hpp:124
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:696
void register_simple_option(rs2_option option_id, option_range range)
Definition: rs_processing.hpp:349
pointcloud(rs2_stream stream, int index=0)
Definition: rs_processing.hpp:438
rs2_processing_block * rs2_create_y411_decoder(rs2_error **error)
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
float min
Definition: rs_types.hpp:196
units_transform(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:605
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:668
Definition: rs_frame.hpp:957
T as() const
Definition: rs_processing.hpp:416
void rs2_delete_frame_queue(rs2_frame_queue *queue)
Definition: rs_processing.hpp:1113
void map_to(frame mapped)
Definition: rs_processing.hpp:470
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)
Definition: rs_processing.hpp:251
frame_queue _queue
Definition: rs_processing.hpp:424
colorizer(float color_scheme)
Definition: rs_processing.hpp:775
rs2_processing_block * rs2_create_huffman_depth_decompress_block(rs2_error **error)
Definition: rs_context.hpp:96
int rs2_frame_queue_size(rs2_frame_queue *queue, rs2_error **error)
void frame_ready(frame result) const
Definition: rs_processing.hpp:99
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)
processing_block(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:299
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition: rs_processing.hpp:563
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
float max
Definition: rs_types.hpp:197
float step
Definition: rs_types.hpp:199
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
void invoke(frame f) const
Definition: rs_processing.hpp:285
align(rs2_stream align_to)
Definition: rs_processing.hpp:720
Definition: rs_frame.hpp:1180
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)
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:370
depth_huffman_decoder(filter f)
Definition: rs_processing.hpp:1015
Definition: rs_option.h:64
frame_queue()
Definition: rs_processing.hpp:152
yuy_decoder()
Definition: rs_processing.hpp:511
Definition: rs_processing.hpp:18
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
bool is() const
Definition: rs_processing.hpp:409
hole_filling_filter()
Definition: rs_processing.hpp:1047
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition: rs_processing.hpp:881
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
frameset process(frameset frames)
Definition: rs_processing.hpp:730
frame_queue get_queue()
Definition: rs_processing.hpp:405
Definition: rs_processing.hpp:596
Definition: rs_types.hpp:34
Definition: rs_processing.hpp:1148
processing_block(S processing_function)
Definition: rs_processing.hpp:310
Definition: rs_processing.hpp:854
Definition: rs_types.hpp:194
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:784
int rs2_supports_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
decimation_filter(float magnitude)
Definition: rs_processing.hpp:821
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
Definition: rs_types.h:190
rs2_processing_block * get() const
Definition: rs_processing.hpp:321
spatial_filter()
Definition: rs_processing.hpp:925
sequence_id_filter(filter f)
Definition: rs_processing.hpp:1167
decimation_filter(filter f)
Definition: rs_processing.hpp:826
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:275
pointcloud()
Definition: rs_processing.hpp:436
Definition: rs_options.hpp:155
sequence_id_filter()
Definition: rs_processing.hpp:1155
spatial_filter(filter f)
Definition: rs_processing.hpp:944
void rs2_delete_processing_block(rs2_processing_block *block)
filter(S processing_function, int queue_size=1)
Definition: rs_processing.hpp:397
Definition: rs_types.h:183
Definition: rs_processing.hpp:430
rs2_processing_block * rs2_create_temporal_filter_block(rs2_error **error)
void enqueue(frame f) const
Definition: rs_processing.hpp:158
Definition: rs_processing.hpp:555
Definition: rs_option.h:66
void keep()
Definition: rs_frame.hpp:439
void start(S on_frame)
Definition: rs_processing.hpp:262
struct rs2_options rs2_options
Definition: rs_types.h:254
void operator()(frame f) const
Definition: rs_processing.hpp:208
Definition: rs_option.h:67
int stream_index() const
Definition: rs_frame.hpp:34
syncer(int queue_size=1)
Definition: rs_processing.hpp:647
static void handle(rs2_error *e)
Definition: rs_types.hpp:162
struct rs2_source rs2_source
Definition: rs_types.h:245
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:43
Definition: rs_processing.hpp:361
points calculate(frame depth) const
Definition: rs_processing.hpp:449
Definition: rs_types.h:163
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:685
Definition: rs_processing.hpp:1006
Definition: rs_option.h:73
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
rs2_processing_block * rs2_create_sequence_id_filter(rs2_error **error)
Definition: rs_processing.hpp:752
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:169
Definition: rs_types.h:146
void release() override
Definition: rs_processing.hpp:131
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:514
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition: rs_processing.hpp:384
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)
frame allocate_points(const stream_profile &profile, const frame &original) const
Definition: rs_processing.hpp:67
Definition: rs_option.h:62
Definition: rs_processing.hpp:708
struct rs2_processing_block rs2_processing_block
Definition: rs_types.h:246
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:136
asynchronous_syncer()
Definition: rs_processing.hpp:626
Definition: rs_frame.hpp:338
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:256
sequence_id_filter(float sequence_id)
Definition: rs_processing.hpp:1162
const char * get_info(rs2_camera_info info) const
Definition: rs_processing.hpp:341
float def
Definition: rs_types.hpp:198
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition: rs_processing.hpp:936
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 * rs2_create_spatial_filter_block(rs2_error **error)
frame_processor_callback(T on_frame)
Definition: rs_processing.hpp:122
rs2_source * _source
Definition: rs_processing.hpp:107
options & operator=(const options &other)
Definition: rs_options.hpp:323
Definition: rs_processing.hpp:641
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition: rs_processing.hpp:143
rs2_processing_block * get() const
Definition: rs_processing.hpp:406
Definition: rs_processing.hpp:134
Definition: rs_processing.hpp:118
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:658
Definition: rs_option.h:72
Definition: rs_processing.hpp:529
int rs2_try_wait_for_frame(rs2_frame_queue *queue, unsigned int timeout_ms, rs2_frame **output_frame, rs2_error **error)
Definition: rs_types.h:164
Definition: rs_processing.hpp:808
int rs2_is_processing_block_extendable_to(const rs2_processing_block *block, rs2_extension extension_type, rs2_error **error)
hole_filling_filter(int mode)
Definition: rs_processing.hpp:1057
temporal_filter()
Definition: rs_processing.hpp:863
struct rs2_error rs2_error
Definition: rs_types.h:229
rs2_stream stream_type() const
Definition: rs_frame.hpp:39
const char * rs2_get_processing_block_info(const rs2_processing_block *block, rs2_camera_info info, rs2_error **error)
Definition: rs_option.h:65
rs2_frame * get() const
Definition: rs_frame.hpp:592
rates_printer()
Definition: rs_processing.hpp:1096
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
colorizer(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:790
colorizer()
Definition: rs_processing.hpp:759
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:479
rs2_processing_block * rs2_create_hdr_merge_processing_block(rs2_error **error)
struct rs2_frame rs2_frame
Definition: rs_types.h:232
Definition: rs_processing.hpp:971
disparity_transform(filter f)
Definition: rs_processing.hpp:980
Definition: rs_option.h:71
Definition: rs_processing.hpp:1089
stream_profile get_profile() const
Definition: rs_frame.hpp:559
y411_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:541
frame allocate_composite_frame(std::vector< frame > frames) const
Definition: rs_processing.hpp:82
disparity_transform(bool transform_to_disparity=true)
Definition: rs_processing.hpp:978
Definition: rs_types.h:189
temporal_filter(filter f)
Definition: rs_processing.hpp:888
units_transform()
Definition: rs_processing.hpp:602