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  }
216  size_t capacity() const { return _capacity; }
217 
222  bool keep_frames() const { return _keep; }
223 
224  private:
225  std::shared_ptr<rs2_frame_queue> _queue;
226  size_t _capacity;
227  bool _keep;
228  };
229 
233  class processing_block : public options
234  {
235  public:
236  using options::supports;
237 
243  template<class S>
244  void start(S on_frame)
245  {
246  rs2_error* e = nullptr;
247  rs2_start_processing(get(), new frame_callback<S>(on_frame), &e);
248  error::handle(e);
249  }
256  template<class S>
257  S& operator>>(S& on_frame)
258  {
259  start(on_frame);
260  return on_frame;
261  }
267  void invoke(frame f) const
268  {
269  rs2_frame* ptr = nullptr;
270  std::swap(f.frame_ref, ptr);
271 
272  rs2_error* e = nullptr;
273  rs2_process_frame(get(), ptr, &e);
274  error::handle(e);
275  }
281  processing_block(std::shared_ptr<rs2_processing_block> block)
282  : options((rs2_options*)block.get()), _block(block)
283  {
284  }
285 
291  template<class S>
292  processing_block(S processing_function)
293  {
294  rs2_error* e = nullptr;
295  _block = std::shared_ptr<rs2_processing_block>(
296  rs2_create_processing_block(new frame_processor_callback<S>(processing_function), &e),
299  error::handle(e);
300  }
301 
302  operator rs2_options*() const { return (rs2_options*)get(); }
303  rs2_processing_block* get() const { return _block.get(); }
304 
310  bool supports(rs2_camera_info info) const
311  {
312  rs2_error* e = nullptr;
313  auto is_supported = rs2_supports_processing_block_info(_block.get(), info, &e);
314  error::handle(e);
315  return is_supported > 0;
316  }
317 
323  const char* get_info(rs2_camera_info info) const
324  {
325  rs2_error* e = nullptr;
326  auto result = rs2_get_processing_block_info(_block.get(), info, &e);
327  error::handle(e);
328  return result;
329  }
330  protected:
332  rs2_error * e = nullptr;
334  range.min, range.max, range.step, range.def, &e);
335  error::handle(e);
336  }
337  std::shared_ptr<rs2_processing_block> _block;
338  };
339 
343  class filter : public processing_block, public filter_interface
344  {
345  public:
353  {
354  invoke(frame);
355  rs2::frame f;
356  if (!_queue.poll_for_frame(&f))
357  throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
358  return f;
359  }
360 
366  filter(std::shared_ptr<rs2_processing_block> block, int queue_size = 1)
367  : processing_block(block),
368  _queue(queue_size)
369  {
370  start(_queue);
371  }
372 
378  template<class S>
379  filter(S processing_function, int queue_size = 1) :
380  processing_block(processing_function),
381  _queue(queue_size)
382  {
383  start(_queue);
384  }
385 
386 
388  rs2_processing_block* get() const { return _block.get(); }
389 
390  template<class T>
391  bool is() const
392  {
393  T extension(*this);
394  return extension;
395  }
396 
397  template<class T>
398  T as() const
399  {
400  T extension(*this);
401  return extension;
402  }
403 
404  operator bool() const { return _block.get() != nullptr; }
405  protected:
407  };
408 
412  class pointcloud : public filter
413  {
414  public:
418  pointcloud() : filter(init(), 1) {}
419 
420  pointcloud(rs2_stream stream, int index = 0) : filter(init(), 1)
421  {
422  set_option(RS2_OPTION_STREAM_FILTER, float(stream));
424  }
432  {
433  auto res = process(depth);
434  if (res.as<points>())
435  return res;
436 
437  if (auto set = res.as <frameset>())
438  {
439  for (auto f : set)
440  {
441  if(f.as<points>())
442  return f;
443  }
444  }
445  throw std::runtime_error("Error occured during execution of the processing block! See the log for more info");
446  }
452  void map_to(frame mapped)
453  {
457  process(mapped);
458  }
459 
460  protected:
461  pointcloud(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
462 
463  private:
464  friend class context;
465 
466  std::shared_ptr<rs2_processing_block> init()
467  {
468  rs2_error* e = nullptr;
469 
470  auto block = std::shared_ptr<rs2_processing_block>(
473 
474  error::handle(e);
475 
476  // Redirect options API to the processing block
477  //options::operator=(pb);
478  return block;
479  }
480  };
481 
482  class yuy_decoder : public filter
483  {
484  public:
493  yuy_decoder() : filter(init(), 1) { }
494 
495  protected:
496  yuy_decoder(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
497 
498  private:
499  std::shared_ptr<rs2_processing_block> init()
500  {
501  rs2_error* e = nullptr;
502  auto block = std::shared_ptr<rs2_processing_block>(
505  error::handle(e);
506 
507  return block;
508  }
509  };
510 
511  class threshold_filter : public filter
512  {
513  public:
519  threshold_filter(float min_dist = 0.15f, float max_dist = 4.f)
520  : filter(init(), 1)
521  {
524  }
525 
527  {
528  rs2_error* e = nullptr;
530  {
531  _block.reset();
532  }
533  error::handle(e);
534  }
535 
536  protected:
537  threshold_filter(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
538 
539  private:
540  std::shared_ptr<rs2_processing_block> init()
541  {
542  rs2_error* e = nullptr;
543  auto block = std::shared_ptr<rs2_processing_block>(
546  error::handle(e);
547 
548  return block;
549  }
550  };
551 
552  class units_transform : public filter
553  {
554  public:
558  units_transform() : filter(init(), 1) {}
559 
560  protected:
561  units_transform(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
562 
563  private:
564  std::shared_ptr<rs2_processing_block> init()
565  {
566  rs2_error* e = nullptr;
567  auto block = std::shared_ptr<rs2_processing_block>(
570  error::handle(e);
571 
572  return block;
573  }
574  };
575 
577  {
578  public:
583 
584  private:
585  std::shared_ptr<rs2_processing_block> init()
586  {
587  rs2_error* e = nullptr;
588  auto block = std::shared_ptr<rs2_processing_block>(
591 
592  error::handle(e);
593  return block;
594  }
595  };
596 
597  class syncer
598  {
599  public:
603  syncer(int queue_size = 1)
604  :_results(queue_size)
605  {
606  _sync.start(_results);
607  }
608 
614  frameset wait_for_frames(unsigned int timeout_ms = 5000) const
615  {
616  return frameset(_results.wait_for_frame(timeout_ms));
617  }
618 
624  bool poll_for_frames(frameset* fs) const
625  {
626  frame result;
627  if (_results.poll_for_frame(&result))
628  {
629  *fs = frameset(result);
630  return true;
631  }
632  return false;
633  }
634 
641  bool try_wait_for_frames(frameset* fs, unsigned int timeout_ms = 5000) const
642  {
643  frame result;
644  if (_results.try_wait_for_frame(&result, timeout_ms))
645  {
646  *fs = frameset(result);
647  return true;
648  }
649  return false;
650  }
651 
652  void operator()(frame f) const
653  {
654  _sync.invoke(std::move(f));
655  }
656  private:
657  asynchronous_syncer _sync;
658  frame_queue _results;
659  };
660 
664  class align : public filter
665  {
666  public:
676  align(rs2_stream align_to) : filter(init(align_to), 1) {}
677 
678  using filter::process;
679 
687  {
688  return filter::process(frames);
689  }
690 
691  protected:
692  align(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
693 
694  private:
695  friend class context;
696  std::shared_ptr<rs2_processing_block> init(rs2_stream align_to)
697  {
698  rs2_error* e = nullptr;
699  auto block = std::shared_ptr<rs2_processing_block>(
700  rs2_create_align(align_to, &e),
702  error::handle(e);
703 
704  return block;
705  }
706  };
707 
708  class colorizer : public filter
709  {
710  public:
715  colorizer() : filter(init(), 1) { }
731  colorizer(float color_scheme) : filter(init(), 1)
732  {
733  set_option(RS2_OPTION_COLOR_SCHEME, float(color_scheme));
734  }
741  {
742  return process(depth);
743  }
744 
745  protected:
746  colorizer(std::shared_ptr<rs2_processing_block> block) : filter(block, 1) {}
747 
748  private:
749  std::shared_ptr<rs2_processing_block> init()
750  {
751  rs2_error* e = nullptr;
752  auto block = std::shared_ptr<rs2_processing_block>(
755  error::handle(e);
756 
757  // Redirect options API to the processing block
758  //options::operator=(pb);
759 
760  return block;
761  }
762  };
763 
764  class decimation_filter : public filter
765  {
766  public:
771  decimation_filter() : filter(init(), 1) {}
777  decimation_filter(float magnitude) : filter(init(), 1)
778  {
780  }
781 
783  {
784  rs2_error* e = nullptr;
786  {
787  _block.reset();
788  }
789  error::handle(e);
790  }
791 
792  private:
793  friend class context;
794 
795  std::shared_ptr<rs2_processing_block> init()
796  {
797  rs2_error* e = nullptr;
798  auto block = std::shared_ptr<rs2_processing_block>(
801  error::handle(e);
802 
803  // Redirect options API to the processing block
804  //options::operator=(this);
805 
806  return block;
807  }
808  };
809 
810  class temporal_filter : public filter
811  {
812  public:
819  temporal_filter() : filter(init(), 1) {}
837  temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control) : filter(init(), 1)
838  {
839  set_option(RS2_OPTION_HOLES_FILL, float(persistence_control));
840  set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
841  set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
842  }
843 
845  {
846  rs2_error* e = nullptr;
848  {
849  _block.reset();
850  }
851  error::handle(e);
852  }
853  private:
854  friend class context;
855 
856  std::shared_ptr<rs2_processing_block> init()
857  {
858  rs2_error* e = nullptr;
859  auto block = std::shared_ptr<rs2_processing_block>(
862  error::handle(e);
863 
864  // Redirect options API to the processing block
865  //options::operator=(pb);
866 
867  return block;
868  }
869  };
870 
871  class spatial_filter : public filter
872  {
873  public:
881  spatial_filter() : filter(init(), 1) { }
882 
892  spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill) : filter(init(), 1)
893  {
894  set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, float(smooth_alpha));
895  set_option(RS2_OPTION_FILTER_SMOOTH_DELTA, float(smooth_delta));
897  set_option(RS2_OPTION_HOLES_FILL, hole_fill);
898  }
899 
901  {
902  rs2_error* e = nullptr;
904  {
905  _block.reset();
906  }
907  error::handle(e);
908  }
909  private:
910  friend class context;
911 
912  std::shared_ptr<rs2_processing_block> init()
913  {
914  rs2_error* e = nullptr;
915  auto block = std::shared_ptr<rs2_processing_block>(
918  error::handle(e);
919 
920  // Redirect options API to the processing block
921  //options::operator=(pb);
922 
923  return block;
924  }
925  };
926 
928  {
929  public:
934  disparity_transform(bool transform_to_disparity = true) : filter(init(transform_to_disparity), 1) { }
935 
937  {
938  rs2_error* e = nullptr;
940  {
941  _block.reset();
942  }
943  error::handle(e);
944  }
945  private:
946  friend class context;
947  std::shared_ptr<rs2_processing_block> init(bool transform_to_disparity)
948  {
949  rs2_error* e = nullptr;
950  auto block = std::shared_ptr<rs2_processing_block>(
951  rs2_create_disparity_transform_block(uint8_t(transform_to_disparity), &e),
953  error::handle(e);
954 
955  // Redirect options API to the processing block
956  //options::operator=(pb);
957 
958  return block;
959  }
960  };
961 
963  {
964  public:
970  {}
971 
973  {
974  rs2_error* e = nullptr;
976  {
977  _block.reset();
978  }
979  error::handle(e);
980  }
981 
982  private:
983  friend class context;
984 
985  std::shared_ptr<rs2_processing_block> init()
986  {
987  rs2_error* e = nullptr;
988  auto block = std::shared_ptr<rs2_processing_block>(
991  error::handle(e);
992 
993  return block;
994  }
995  };
996 
998  {
999  public:
1004  {}
1005 
1007  {
1008  rs2_error* e = nullptr;
1010  {
1011  _block.reset();
1012  }
1013  error::handle(e);
1014  }
1015 
1016  private:
1017  friend class context;
1018 
1019  std::shared_ptr<rs2_processing_block> init()
1020  {
1021  rs2_error* e = nullptr;
1022  auto block = std::shared_ptr<rs2_processing_block>(
1025  error::handle(e);
1026 
1027  return block;
1028  }
1029  };
1030 
1032  {
1033  public:
1038  hole_filling_filter() : filter(init(), 1) {}
1039 
1048  hole_filling_filter(int mode) : filter(init(), 1)
1049  {
1050  set_option(RS2_OPTION_HOLES_FILL, float(mode));
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=(_block);
1075 
1076  return block;
1077  }
1078  };
1079 
1080  class rates_printer : public filter
1081  {
1082  public:
1087  rates_printer() : filter(init(), 1) {}
1088 
1089  private:
1090  friend class context;
1091 
1092  std::shared_ptr<rs2_processing_block> init()
1093  {
1094  rs2_error* e = nullptr;
1095  auto block = std::shared_ptr<rs2_processing_block>(
1098  error::handle(e);
1099 
1100  return block;
1101  }
1102  };
1103 }
1104 #endif // LIBREALSENSE_RS2_PROCESSING_HPP
decimation_filter()
Definition: rs_processing.hpp:771
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:629
Definition: rs_frame.hpp:336
threshold_filter(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:537
rs2_processing_block * rs2_create_threshold(rs2_error **error)
bool supports(rs2_option option) const
Definition: rs_options.hpp:19
Definition: rs_processing.hpp:576
std::shared_ptr< rs2_processing_block > _block
Definition: rs_processing.hpp:337
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:1053
bool supports(rs2_camera_info info) const
Definition: rs_processing.hpp:310
Definition: rs_types.h:165
points calculate(frame depth)
Definition: rs_processing.hpp:431
Definition: rs_processing.hpp:871
Definition: rs_processing.hpp:1031
Definition: rs_option.h:57
threshold_filter(filter f)
Definition: rs_processing.hpp:526
rs2_option
Defines general configuration controls. These can generally be mapped to camera UVC controls...
Definition: rs_option.h:22
Definition: rs_types.h:163
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
Definition: rs_processing.hpp:183
rs2_processing_block * rs2_create_zero_order_invalidation_block(rs2_error **error)
Definition: rs_types.h:164
depth_huffman_decoder()
Definition: rs_processing.hpp:1003
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:222
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:166
Definition: rs_types.h:145
Definition: rs_option.h:55
Definition: rs_processing.hpp:482
Definition: rs_frame.hpp:712
int rs2_poll_for_frame(rs2_frame_queue *queue, rs2_frame **output_frame, rs2_error **error)
size_t capacity() const
Definition: rs_processing.hpp:216
align(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:692
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:652
void register_simple_option(rs2_option option_id, option_range range)
Definition: rs_processing.hpp:331
pointcloud(rs2_stream stream, int index=0)
Definition: rs_processing.hpp:420
rs2_processing_block * rs2_create_processing_block(rs2_frame_processor_callback *proc, rs2_error **error)
float min
Definition: rs_types.hpp:171
units_transform(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:561
bool poll_for_frames(frameset *fs) const
Definition: rs_processing.hpp:624
Definition: rs_frame.hpp:920
T as() const
Definition: rs_processing.hpp:398
void rs2_delete_frame_queue(rs2_frame_queue *queue)
void map_to(frame mapped)
Definition: rs_processing.hpp:452
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:233
frame_queue _queue
Definition: rs_processing.hpp:406
colorizer(float color_scheme)
Definition: rs_processing.hpp:731
rs2_processing_block * rs2_create_huffman_depth_decompress_block(rs2_error **error)
Definition: rs_context.hpp:96
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:281
threshold_filter(float min_dist=0.15f, float max_dist=4.f)
Definition: rs_processing.hpp:519
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:172
float step
Definition: rs_types.hpp:174
rs2_processing_block * rs2_create_rates_printer_block(rs2_error **error)
void invoke(frame f) const
Definition: rs_processing.hpp:267
align(rs2_stream align_to)
Definition: rs_processing.hpp:676
Definition: rs_frame.hpp:1135
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:352
depth_huffman_decoder(filter f)
Definition: rs_processing.hpp:1006
Definition: rs_option.h:60
frame_queue()
Definition: rs_processing.hpp:152
yuy_decoder()
Definition: rs_processing.hpp:493
Definition: rs_processing.hpp:18
rs2_processing_block * rs2_create_pointcloud(rs2_error **error)
bool is() const
Definition: rs_processing.hpp:391
hole_filling_filter()
Definition: rs_processing.hpp:1038
temporal_filter(float smooth_alpha, float smooth_delta, int persistence_control)
Definition: rs_processing.hpp:837
void rs2_enqueue_frame(rs2_frame *frame, void *queue)
frameset process(frameset frames)
Definition: rs_processing.hpp:686
frame_queue get_queue()
Definition: rs_processing.hpp:387
Definition: rs_processing.hpp:552
Definition: rs_types.hpp:32
zero_order_invalidation(filter f)
Definition: rs_processing.hpp:972
processing_block(S processing_function)
Definition: rs_processing.hpp:292
Definition: rs_processing.hpp:810
Definition: rs_types.hpp:169
video_frame colorize(frame depth) const
Definition: rs_processing.hpp:740
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:777
void rs2_synthetic_frame_ready(rs2_source *source, rs2_frame *frame, rs2_error **error)
rs2_processing_block * get() const
Definition: rs_processing.hpp:303
spatial_filter()
Definition: rs_processing.hpp:881
decimation_filter(filter f)
Definition: rs_processing.hpp:782
S & operator>>(S &on_frame)
Definition: rs_processing.hpp:257
pointcloud()
Definition: rs_processing.hpp:418
Definition: rs_options.hpp:11
spatial_filter(filter f)
Definition: rs_processing.hpp:900
void rs2_delete_processing_block(rs2_processing_block *block)
filter(S processing_function, int queue_size=1)
Definition: rs_processing.hpp:379
Definition: rs_types.h:181
Definition: rs_processing.hpp:412
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:511
Definition: rs_option.h:62
void keep()
Definition: rs_frame.hpp:430
void start(S on_frame)
Definition: rs_processing.hpp:244
struct rs2_options rs2_options
Definition: rs_types.h:242
Definition: rs_processing.hpp:962
void operator()(frame f) const
Definition: rs_processing.hpp:208
Definition: rs_option.h:63
int stream_index() const
Definition: rs_frame.hpp:34
syncer(int queue_size=1)
Definition: rs_processing.hpp:603
static void handle(rs2_error *e)
Definition: rs_types.hpp:137
struct rs2_source rs2_source
Definition: rs_types.h:233
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:42
Definition: rs_processing.hpp:343
Definition: rs_types.h:161
bool try_wait_for_frames(frameset *fs, unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:641
Definition: rs_processing.hpp:997
Definition: rs_option.h:69
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
Definition: rs_processing.hpp:708
frame wait_for_frame(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:169
Definition: rs_types.h:144
zero_order_invalidation()
Definition: rs_processing.hpp:969
void release() override
Definition: rs_processing.hpp:131
yuy_decoder(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:496
filter(std::shared_ptr< rs2_processing_block > block, int queue_size=1)
Definition: rs_processing.hpp:366
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:58
Definition: rs_processing.hpp:664
struct rs2_processing_block rs2_processing_block
Definition: rs_types.h:234
rs2_processing_block * rs2_create_yuy_decoder(rs2_error **error)
rs2_extension
Specifies advanced interfaces (capabilities) objects may implement.
Definition: rs_types.h:134
asynchronous_syncer()
Definition: rs_processing.hpp:582
Definition: rs_frame.hpp:329
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:99
const char * get_info(rs2_camera_info info) const
Definition: rs_processing.hpp:323
float def
Definition: rs_types.hpp:173
spatial_filter(float smooth_alpha, float smooth_delta, float magnitude, float hole_fill)
Definition: rs_processing.hpp:892
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:134
Definition: rs_processing.hpp:597
frame_queue(unsigned int capacity, bool keep_frames=false)
Definition: rs_processing.hpp:143
rs2_processing_block * get() const
Definition: rs_processing.hpp:388
Definition: rs_processing.hpp:134
Definition: rs_processing.hpp:118
frameset wait_for_frames(unsigned int timeout_ms=5000) const
Definition: rs_processing.hpp:614
Definition: rs_option.h:68
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:162
Definition: rs_processing.hpp:764
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:1048
temporal_filter()
Definition: rs_processing.hpp:819
struct rs2_error rs2_error
Definition: rs_types.h:217
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:61
rs2_frame * get() const
Definition: rs_frame.hpp:583
rates_printer()
Definition: rs_processing.hpp:1087
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:746
colorizer()
Definition: rs_processing.hpp:715
pointcloud(std::shared_ptr< rs2_processing_block > block)
Definition: rs_processing.hpp:461
struct rs2_frame rs2_frame
Definition: rs_types.h:220
Definition: rs_processing.hpp:927
disparity_transform(filter f)
Definition: rs_processing.hpp:936
Definition: rs_option.h:67
Definition: rs_processing.hpp:1080
stream_profile get_profile() const
Definition: rs_frame.hpp:550
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:934
temporal_filter(filter f)
Definition: rs_processing.hpp:844
Definition: rs_types.h:167
units_transform()
Definition: rs_processing.hpp:558