Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
rs_frame.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_FRAME_HPP
5 #define LIBREALSENSE_RS2_FRAME_HPP
6 
7 #include "rs_types.hpp"
8 
9 namespace rs2
10 {
11  class frame_source;
12  class frame_queue;
13  class syncer;
14  class processing_block;
15  class pointcloud;
16  class sensor;
17  class frame;
18  class pipeline_profile;
19  class points;
20 
22  {
23  public:
27  stream_profile() : _profile(nullptr) {}
28 
33  int stream_index() const { return _index; }
38  rs2_stream stream_type() const { return _type; }
43  rs2_format format() const { return _format; }
48  int fps() const { return _framerate; }
53  int unique_id() const { return _uid; }
54 
63  {
64  rs2_error* e = nullptr;
65  auto ref = rs2_clone_stream_profile(_profile, type, index, format, &e);
66  error::handle(e);
67  stream_profile res(ref);
68  res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
69 
70  return res;
71  }
72 
78  bool operator==(const stream_profile& rhs)
79  {
80  return stream_index() == rhs.stream_index() &&
81  stream_type() == rhs.stream_type() &&
82  format() == rhs.format() &&
83  fps() == rhs.fps();
84  }
85 
90  template<class T>
91  bool is() const
92  {
93  T extension(*this);
94  return extension;
95  }
96 
101  template<class T>
102  T as() const
103  {
104  T extension(*this);
105  return extension;
106  }
107 
112  std::string stream_name() const
113  {
114  std::stringstream ss;
116  if (stream_index() != 0) ss << " " << stream_index();
117  return ss.str();
118  }
119 
124  bool is_default() const { return _default; }
125 
130  operator bool() const { return _profile != nullptr; }
131 
136  const rs2_stream_profile* get() const { return _profile; }
137 
148  {
149  rs2_error* e = nullptr;
150  rs2_extrinsics res;
151  rs2_get_extrinsics(get(), to.get(), &res, &e);
152  error::handle(e);
153  return res;
154  }
162  {
163  rs2_error* e = nullptr;
164  rs2_register_extrinsics(get(), to.get(), extrinsics, &e);
165  error::handle(e);
166  }
167 
168  bool is_cloned() { return bool(_clone); }
169  explicit stream_profile(const rs2_stream_profile* profile) : _profile(profile)
170  {
171  rs2_error* e = nullptr;
173  error::handle(e);
174 
176  error::handle(e);
177 
178  }
179  operator const rs2_stream_profile*() { return _profile; }
180  explicit operator std::shared_ptr<rs2_stream_profile>() { return _clone; }
181 
182  protected:
183  friend class rs2::sensor;
184  friend class rs2::frame;
185  friend class rs2::pipeline_profile;
186  friend class software_sensor;
187 
189  std::shared_ptr<rs2_stream_profile> _clone;
190 
191  int _index = 0;
192  int _uid = 0;
193  int _framerate = 0;
196 
197  bool _default = false;
198  };
199 
201  {
202  public:
208  : stream_profile(sp)
209  {
210  rs2_error* e = nullptr;
211  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_VIDEO_PROFILE, &e) == 0 && !e))
212  {
213  _profile = nullptr;
214  }
215  error::handle(e);
216 
217  if (_profile)
218  {
219  rs2_get_video_stream_resolution(_profile, &_width, &_height, &e);
220  error::handle(e);
221  }
222  }
223 
224  int width() const
225  {
226  return _width;
227  }
228 
229  int height() const
230  {
231  return _height;
232  }
238  {
239  rs2_error* e = nullptr;
240  rs2_intrinsics intr;
242  error::handle(e);
243  return intr;
244  }
245 
246  private:
247  int _width = 0;
248  int _height = 0;
249  };
250 
251 
253  {
254  public:
260  : stream_profile(sp)
261  {
262  rs2_error* e = nullptr;
263  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_MOTION_PROFILE, &e) == 0 && !e))
264  {
265  _profile = nullptr;
266  }
267  error::handle(e);
268  }
269 
275  {
276  rs2_error* e = nullptr;
278  rs2_get_motion_intrinsics(_profile, &intrin, &e);
279  error::handle(e);
280  return intrin;
281  }
282  };
283 
284 
289  {
290  public:
291  virtual rs2::frame process(rs2::frame frame) const = 0;
292  virtual ~filter_interface() = default;
293  };
294 
295  class frame
296  {
297  public:
301  frame() : frame_ref(nullptr) {}
306  frame(rs2_frame* ref) : frame_ref(ref)
307  {
308 #ifdef _DEBUG
309  if (ref)
310  {
311  rs2_error* e = nullptr;
312  auto r = rs2_get_frame_number(ref, &e);
313  if (!e)
314  frame_number = r;
315  auto s = rs2_get_frame_stream_profile(ref, &e);
316  if (!e)
317  profile = stream_profile(s);
318  }
319  else
320  {
321  frame_number = 0;
322  profile = stream_profile();
323  }
324 #endif
325  }
330  frame(frame&& other) noexcept : frame_ref(other.frame_ref)
331  {
332  other.frame_ref = nullptr;
333 #ifdef _DEBUG
334  frame_number = other.frame_number;
335  profile = other.profile;
336 #endif
337  }
343  {
344  swap(other);
345  return *this;
346  }
347 
352  frame(const frame& other)
353  : frame_ref(other.frame_ref)
354  {
355  if (frame_ref) add_ref();
356 #ifdef _DEBUG
357  frame_number = other.frame_number;
358  profile = other.profile;
359 #endif
360  }
365  void swap(frame& other)
366  {
367  std::swap(frame_ref, other.frame_ref);
368 
369 #ifdef _DEBUG
370  std::swap(frame_number, other.frame_number);
371  std::swap(profile, other.profile);
372 #endif
373  }
374 
379  {
380  if (frame_ref)
381  {
382  rs2_release_frame(frame_ref);
383  }
384  }
385 
389  void keep() { rs2_keep_frame(frame_ref); }
390 
395  operator bool() const { return frame_ref != nullptr; }
396 
401  double get_timestamp() const
402  {
403  rs2_error* e = nullptr;
404  auto r = rs2_get_frame_timestamp(frame_ref, &e);
405  error::handle(e);
406  return r;
407  }
408 
413  {
414  rs2_error* e = nullptr;
415  auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
416  error::handle(e);
417  return r;
418  }
419 
425  {
426  rs2_error* e = nullptr;
427  auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
428  error::handle(e);
429  return r;
430  }
431 
437  {
438  rs2_error* e = nullptr;
439  auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
440  error::handle(e);
441  return r != 0;
442  }
443 
448  unsigned long long get_frame_number() const
449  {
450  rs2_error* e = nullptr;
451  auto r = rs2_get_frame_number(frame_ref, &e);
452  error::handle(e);
453  return r;
454  }
455 
460  const void* get_data() const
461  {
462  rs2_error* e = nullptr;
463  auto r = rs2_get_frame_data(frame_ref, &e);
464  error::handle(e);
465  return r;
466  }
467 
473  {
474  rs2_error* e = nullptr;
475  auto s = rs2_get_frame_stream_profile(frame_ref, &e);
476  error::handle(e);
477  return stream_profile(s);
478  }
479 
484  template<class T>
485  bool is() const
486  {
487  T extension(*this);
488  return extension;
489  }
494  template<class T>
495  T as() const
496  {
497  T extension(*this);
498  return extension;
499  }
500 
505  rs2_frame* get() const { return frame_ref; }
506  explicit operator rs2_frame*() { return frame_ref; }
507 
509  {
510  return filter.process(*this);
511  }
512 
513  protected:
519  void add_ref() const
520  {
521  rs2_error* e = nullptr;
522  rs2_frame_add_ref(frame_ref, &e);
523  error::handle(e);
524  }
525 
526  void reset()
527  {
528  if (frame_ref)
529  {
530  rs2_release_frame(frame_ref);
531  }
532  frame_ref = nullptr;
533  }
534 
535  private:
536  friend class rs2::frame_source;
537  friend class rs2::frame_queue;
538  friend class rs2::syncer;
539  friend class rs2::processing_block;
540  friend class rs2::pointcloud;
541  friend class rs2::points;
542 
543  rs2_frame* frame_ref;
544 
545 #ifdef _DEBUG
546  stream_profile profile;
547  unsigned long long frame_number = 0;
548 #endif
549  };
550 
551  class video_frame : public frame
552  {
553  public:
558  video_frame(const frame& f)
559  : frame(f)
560  {
561  rs2_error* e = nullptr;
562  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
563  {
564  reset();
565  }
566  error::handle(e);
567  }
568 
569 
574  int get_width() const
575  {
576  rs2_error* e = nullptr;
577  auto r = rs2_get_frame_width(get(), &e);
578  error::handle(e);
579  return r;
580  }
581 
586  int get_height() const
587  {
588  rs2_error* e = nullptr;
589  auto r = rs2_get_frame_height(get(), &e);
590  error::handle(e);
591  return r;
592  }
593 
599  {
600  rs2_error* e = nullptr;
601  auto r = rs2_get_frame_stride_in_bytes(get(), &e);
602  error::handle(e);
603  return r;
604  }
605 
610  int get_bits_per_pixel() const
611  {
612  rs2_error* e = nullptr;
613  auto r = rs2_get_frame_bits_per_pixel(get(), &e);
614  error::handle(e);
615  return r;
616  }
617 
622  int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
623  };
624 
625  struct vertex {
626  float x, y, z;
627  operator const float*() const { return &x; }
628  };
630  float u, v;
631  operator const float*() const { return &u; }
632  };
633 
634  class points : public frame
635  {
636  public:
640  points() : frame(), _size(0) {}
641 
646  points(const frame& f)
647  : frame(f), _size(0)
648  {
649  rs2_error* e = nullptr;
650  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
651  {
652  reset();
653  }
654  error::handle(e);
655 
656  if (get())
657  {
658  _size = rs2_get_frame_points_count(get(), &e);
659  error::handle(e);
660  }
661  }
666  const vertex* get_vertices() const
667  {
668  rs2_error* e = nullptr;
669  auto res = rs2_get_frame_vertices(get(), &e);
670  error::handle(e);
671  return (const vertex*)res;
672  }
673 
679  void export_to_ply(const std::string& fname, video_frame texture)
680  {
681  rs2_frame* ptr = nullptr;
682  std::swap(texture.frame_ref, ptr);
683  rs2_error* e = nullptr;
684  rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
685  error::handle(e);
686  }
692  {
693  rs2_error* e = nullptr;
694  auto res = rs2_get_frame_texture_coordinates(get(), &e);
695  error::handle(e);
696  return (const texture_coordinate*)res;
697  }
698 
699  size_t size() const
700  {
701  return _size;
702  }
703 
704  private:
705  size_t _size;
706  };
707 
708  class depth_frame : public video_frame
709  {
710  public:
715  depth_frame(const frame& f)
716  : video_frame(f)
717  {
718  rs2_error* e = nullptr;
719  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
720  {
721  reset();
722  }
723  error::handle(e);
724  }
725 
732  float get_distance(int x, int y) const
733  {
734  rs2_error * e = nullptr;
735  auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
736  error::handle(e);
737  return r;
738  }
739  };
740 
742  {
743  public:
749  : depth_frame(f)
750  {
751  rs2_error* e = nullptr;
752  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
753  {
754  reset();
755  }
756  error::handle(e);
757  }
762  float get_baseline(void) const
763  {
764  rs2_error * e = nullptr;
766  error::handle(e);
767  return r;
768  }
769  };
770 
771  class motion_frame : public frame
772  {
773  public:
778  motion_frame(const frame& f)
779  : frame(f)
780  {
781  rs2_error* e = nullptr;
782  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
783  {
784  reset();
785  }
786  error::handle(e);
787  }
793  {
794  auto data = reinterpret_cast<const float*>(get_data());
795  return rs2_vector{ data[0], data[1], data[2] };
796  }
797  };
798 
799  class pose_frame : public frame
800  {
801  public:
806  pose_frame(const frame& f)
807  : frame(f)
808  {
809  rs2_error* e = nullptr;
810  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
811  {
812  reset();
813  }
814  error::handle(e);
815  }
821  {
822  rs2_pose pose_data;
823  rs2_error* e = nullptr;
824  rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
825  error::handle(e);
826  return pose_data;
827  }
828  };
829 
830  class frameset : public frame
831  {
832  public:
836  frameset() :_size(0) {};
841  frameset(const frame& f)
842  : frame(f), _size(0)
843  {
844  rs2_error* e = nullptr;
845  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
846  {
847  reset();
848  // TODO - consider explicit constructor to move resultion to compile time
849  }
850  error::handle(e);
851 
852  if (get())
853  {
854  _size = rs2_embedded_frames_count(get(), &e);
855  error::handle(e);
856  }
857  }
858 
866  {
867  frame result;
868  foreach([&result, s, f](frame frm) {
869  if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
870  {
871  result = std::move(frm);
872  }
873  });
874  return result;
875  }
883  {
884  auto frm = first_or_default(s, f);
885  if (!frm) throw error("Frame of requested stream type was not found!");
886  return frm;
887  }
888 
894  {
896  return f.as<depth_frame>();
897  }
903  {
905 
906  if (!f)
907  {
909  if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
910  f = ir;
911  }
912  return f;
913  }
919  video_frame get_infrared_frame(const size_t index = 0) const
920  {
921  frame f;
922  if (!index)
923  {
925  }
926  else
927  {
928  foreach([&f, index](const frame& frm) {
930  frm.get_profile().stream_index() == index) f = frm;
931  });
932  }
933  return f;
934  }
935 
941  video_frame get_fisheye_frame(const size_t index = 0) const
942  {
943  frame f;
944  if (!index)
945  {
947  }
948  else
949  {
950  foreach([&f, index](const frame& frm) {
951  if (frm.get_profile().stream_type() == RS2_STREAM_FISHEYE &&
952  frm.get_profile().stream_index() == index) f = frm;
953  });
954  }
955  return f;
956  }
957 
963  pose_frame get_pose_frame(const size_t index = 0) const
964  {
965  frame f;
966  if (!index)
967  {
969  }
970  else
971  {
972  foreach([&f, index](const frame& frm) {
973  if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
974  frm.get_profile().stream_index() == index) f = frm;
975  });
976  }
977  return f.as<pose_frame>();
978  }
979 
984  size_t size() const
985  {
986  return _size;
987  }
988 
993  template<class T>
994  void foreach(T action) const
995  {
996  rs2_error* e = nullptr;
997  auto count = size();
998  for (size_t i = 0; i < count; i++)
999  {
1000  auto fref = rs2_extract_frame(get(), (int)i, &e);
1001  error::handle(e);
1002 
1003  action(frame(fref));
1004  }
1005  }
1011  frame operator[](size_t index) const
1012  {
1013  rs2_error* e = nullptr;
1014  if (index < size())
1015  {
1016  auto fref = rs2_extract_frame(get(), (int)index, &e);
1017  error::handle(e);
1018  return frame(fref);
1019  }
1020 
1021  throw error("Requested index is out of range!");
1022  }
1023 
1024  class iterator : public std::iterator<std::forward_iterator_tag, frame>
1025  {
1026  public:
1027  iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1028  iterator& operator++() { ++_index; return *this; }
1029  bool operator==(const iterator& other) const { return _index == other._index; }
1030  bool operator!=(const iterator& other) const { return !(*this == other); }
1031 
1032  frame operator*() { return (*_owner)[_index]; }
1033  private:
1034  size_t _index = 0;
1035  const frameset* _owner;
1036  };
1037 
1038  iterator begin() const { return iterator(this); }
1039  iterator end() const { return iterator(this, size()); }
1040  private:
1041  size_t _size;
1042  };
1043 
1044  template<class T>
1046  {
1047  T on_frame_function;
1048  public:
1049  explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1050 
1051  void on_frame(rs2_frame* fref) override
1052  {
1053  on_frame_function(frame{ fref });
1054  }
1055 
1056  void release() override { delete this; }
1057  };
1058 }
1059 #endif // LIBREALSENSE_RS2_FRAME_HPP
Definition: rs_types.hpp:69
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
Definition: rs_frame.hpp:252
iterator begin() const
Definition: rs_frame.hpp:1038
frame apply_filter(filter_interface &filter)
Definition: rs_frame.hpp:508
Definition: rs_frame.hpp:21
int get_bytes_per_pixel() const
Definition: rs_frame.hpp:622
depth_frame(const frame &f)
Definition: rs_frame.hpp:715
Definition: rs_frame.hpp:551
Definition: rs_types.hpp:25
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, rs2_error **error)
Definition: rs_sensor.hpp:103
Definition: rs_frame.hpp:295
void release() override
Definition: rs_frame.hpp:1056
void add_ref() const
Definition: rs_frame.hpp:519
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:882
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
rs2_pose get_pose_data()
Definition: rs_frame.hpp:820
rs2_motion_device_intrinsic get_motion_intrinsics() const
Definition: rs_frame.hpp:274
int _uid
Definition: rs_frame.hpp:192
stream_profile()
Definition: rs_frame.hpp:27
Definition: rs_pipeline.hpp:18
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
rs2_format format() const
Definition: rs_frame.hpp:43
Definition: rs_types.h:142
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
Definition: rs_frame.hpp:634
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Definition: rs_frame.hpp:161
frame operator*()
Definition: rs_frame.hpp:1032
void rs2_keep_frame(rs2_frame *frame)
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
std::string stream_name() const
Definition: rs_frame.hpp:112
frameset()
Definition: rs_frame.hpp:836
float y
Definition: rs_frame.hpp:626
int _index
Definition: rs_frame.hpp:191
Definition: rs_sensor.h:44
Definition: rs_sensor.h:58
pose_frame get_pose_frame(const size_t index=0) const
Definition: rs_frame.hpp:963
Definition: rs_sensor.h:48
Definition: rs_types.h:144
frame(frame &&other) noexcept
Definition: rs_frame.hpp:330
Definition: rs_frame.hpp:830
bool is() const
Definition: rs_frame.hpp:91
void export_to_ply(const std::string &fname, video_frame texture)
Definition: rs_frame.hpp:679
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
Definition: rs_context.hpp:11
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
double get_timestamp() const
Definition: rs_frame.hpp:401
bool is() const
Definition: rs_frame.hpp:485
size_t size() const
Definition: rs_frame.hpp:699
float u
Definition: rs_frame.hpp:630
video_frame get_color_frame() const
Definition: rs_frame.hpp:902
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs_processing.hpp:204
rs2_stream_profile * rs2_clone_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, rs2_error **error)
float z
Definition: rs_frame.hpp:626
int fps() const
Definition: rs_frame.hpp:48
void reset()
Definition: rs_frame.hpp:526
iterator & operator++()
Definition: rs_frame.hpp:1028
Definition: rs_sensor.h:42
rs2_extrinsics get_extrinsics_to(const stream_profile &to) const
Definition: rs_frame.hpp:147
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
std::shared_ptr< rs2_stream_profile > _clone
Definition: rs_frame.hpp:189
pose_frame(const frame &f)
Definition: rs_frame.hpp:806
void swap(frame &other)
Definition: rs_frame.hpp:365
Definition: rs_types.h:152
Definition: rs_frame.hpp:1024
frame & operator=(frame other)
Definition: rs_frame.hpp:342
Definition: rs_sensor.h:62
Definition: rs_frame.hpp:771
frame_callback(T on_frame)
Definition: rs_frame.hpp:1049
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
Definition: rs_frame.hpp:1045
rs2_vector get_motion_data() const
Definition: rs_frame.hpp:792
frame(rs2_frame *ref)
Definition: rs_frame.hpp:306
const rs2_stream_profile * _profile
Definition: rs_frame.hpp:188
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:865
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:323
video_frame(const frame &f)
Definition: rs_frame.hpp:558
void rs2_get_stream_profile_data(const rs2_stream_profile *mode, rs2_stream *stream, rs2_format *format, int *index, int *unique_id, int *framerate, rs2_error **error)
points()
Definition: rs_frame.hpp:640
float get_distance(int x, int y) const
Definition: rs_frame.hpp:732
Definition: rs_processing.hpp:17
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
int rs2_is_stream_profile_default(const rs2_stream_profile *mode, rs2_error **error)
int _framerate
Definition: rs_frame.hpp:193
Definition: rs_types.h:145
motion_frame(const frame &f)
Definition: rs_frame.hpp:778
~frame()
Definition: rs_frame.hpp:378
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
Definition: rs_internal.hpp:73
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
frame operator[](size_t index) const
Definition: rs_frame.hpp:1011
Definition: rs_types.h:143
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
Definition: rs_types.h:106
rs2_format _format
Definition: rs_frame.hpp:194
void rs2_delete_stream_profile(rs2_stream_profile *mode)
motion_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:259
Definition: rs_types.h:151
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition: rs_frame.hpp:412
T as() const
Definition: rs_frame.hpp:102
T as() const
Definition: rs_frame.hpp:495
video_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:207
struct rs2_stream_profile rs2_stream_profile
Definition: rs_types.h:207
Definition: rs_sensor.h:57
virtual ~filter_interface()=default
rs2_format
Format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:55
Definition: rs_processing.hpp:383
bool is_default() const
Definition: rs_frame.hpp:124
void keep()
Definition: rs_frame.hpp:389
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
int stream_index() const
Definition: rs_frame.hpp:33
video_frame get_infrared_frame(const size_t index=0) const
Definition: rs_frame.hpp:919
const texture_coordinate * get_texture_coordinates() const
Definition: rs_frame.hpp:691
int get_bits_per_pixel() const
Definition: rs_frame.hpp:610
bool operator==(const iterator &other) const
Definition: rs_frame.hpp:1029
static void handle(rs2_error *e)
Definition: rs_types.hpp:121
Definition: rs_sensor.h:41
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:38
Definition: rs_processing.hpp:314
int get_height() const
Definition: rs_frame.hpp:586
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:136
bool _default
Definition: rs_frame.hpp:197
Definition: rs_frame.hpp:741
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
Definition: rs_sensor.h:43
unsigned long long get_frame_number() const
Definition: rs_frame.hpp:448
Cross-stream extrinsics: encode the topology describing how the different devices are connected.
Definition: rs_sensor.h:82
Definition: rs_types.h:141
iterator end() const
Definition: rs_frame.hpp:1039
iterator(const frameset *owner, size_t index=0)
Definition: rs_frame.hpp:1027
bool is_cloned()
Definition: rs_frame.hpp:168
3D vector in Euclidean coordinate space
Definition: rs_types.h:95
virtual rs2::frame process(rs2::frame frame) const =0
int get_width() const
Definition: rs_frame.hpp:574
const void * get_data() const
Definition: rs_frame.hpp:460
const char * rs2_stream_to_string(rs2_stream stream)
void on_frame(rs2_frame *fref) override
Definition: rs_frame.hpp:1051
Definition: rs_sensor.h:40
long long rs2_metadata_type
Definition: rs_types.h:231
points(const frame &f)
Definition: rs_frame.hpp:646
Definition: rs_frame.hpp:288
Definition: rs_types.h:148
int get_stride_in_bytes() const
Definition: rs_frame.hpp:598
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
disparity_frame(const frame &f)
Definition: rs_frame.hpp:748
int width() const
Definition: rs_frame.hpp:224
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
Video stream intrinsics.
Definition: rs_types.h:56
Definition: rs_processing.hpp:545
int height() const
Definition: rs_frame.hpp:229
bool operator!=(const iterator &other) const
Definition: rs_frame.hpp:1030
bool operator==(const stream_profile &rhs)
Definition: rs_frame.hpp:78
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:69
depth_frame get_depth_frame() const
Definition: rs_frame.hpp:893
Definition: rs_processing.hpp:114
float rs2_depth_stereo_frame_get_baseline(const rs2_frame *frame_ref, rs2_error **error)
stream_profile(const rs2_stream_profile *profile)
Definition: rs_frame.hpp:169
void rs2_release_frame(rs2_frame *frame)
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:424
frameset(const frame &f)
Definition: rs_frame.hpp:841
Definition: rs_frame.hpp:629
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
size_t size() const
Definition: rs_frame.hpp:984
Definition: rs_types.h:153
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
struct rs2_error rs2_error
Definition: rs_types.h:197
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:436
rs2_stream stream_type() const
Definition: rs_frame.hpp:38
float x
Definition: rs_frame.hpp:626
Definition: rs_frame.hpp:200
Definition: rs_frame.hpp:799
frame(const frame &other)
Definition: rs_frame.hpp:352
rs2_intrinsics get_intrinsics() const
Definition: rs_frame.hpp:237
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
video_frame get_fisheye_frame(const size_t index=0) const
Definition: rs_frame.hpp:941
rs2_frame * get() const
Definition: rs_frame.hpp:505
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
frame()
Definition: rs_frame.hpp:301
float v
Definition: rs_frame.hpp:630
stream_profile clone(rs2_stream type, int index, rs2_format format) const
Definition: rs_frame.hpp:62
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
rs2_frame_metadata_value
Per-Frame-Metadata are set of read-only properties that might be exposed for each individual frame.
Definition: rs_frame.h:28
struct rs2_frame rs2_frame
Definition: rs_types.h:199
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
float get_baseline(void) const
Definition: rs_frame.hpp:762
rs2_stream _type
Definition: rs_frame.hpp:195
Definition: rs_frame.hpp:625
stream_profile get_profile() const
Definition: rs_frame.hpp:472
const vertex * get_vertices() const
Definition: rs_frame.hpp:666
Definition: rs_frame.hpp:708
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19
int unique_id() const
Definition: rs_frame.hpp:53