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  class video_stream_profile;
21 
23  {
24  public:
28  stream_profile() : _profile(nullptr) {}
29 
34  int stream_index() const { return _index; }
39  rs2_stream stream_type() const { return _type; }
44  rs2_format format() const { return _format; }
49  int fps() const { return _framerate; }
54  int unique_id() const { return _uid; }
55 
64  {
65  rs2_error* e = nullptr;
66  auto ref = rs2_clone_stream_profile(_profile, type, index, format, &e);
67  error::handle(e);
68  stream_profile res(ref);
69  res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
70 
71  return res;
72  }
73 
79  bool operator==(const stream_profile& rhs)
80  {
81  return stream_index() == rhs.stream_index() &&
82  stream_type() == rhs.stream_type() &&
83  format() == rhs.format() &&
84  fps() == rhs.fps();
85  }
86 
91  template<class T>
92  bool is() const
93  {
94  T extension(*this);
95  return extension;
96  }
97 
102  template<class T>
103  T as() const
104  {
105  T extension(*this);
106  return extension;
107  }
108 
113  std::string stream_name() const
114  {
115  std::stringstream ss;
117  if (stream_index() != 0) ss << " " << stream_index();
118  return ss.str();
119  }
120 
125  bool is_default() const { return _default; }
126 
131  operator bool() const { return _profile != nullptr; }
132 
137  const rs2_stream_profile* get() const { return _profile; }
138 
149  {
150  rs2_error* e = nullptr;
151  rs2_extrinsics res;
152  rs2_get_extrinsics(get(), to.get(), &res, &e);
153  error::handle(e);
154  return res;
155  }
163  {
164  rs2_error* e = nullptr;
165  rs2_register_extrinsics(get(), to.get(), extrinsics, &e);
166  error::handle(e);
167  }
168 
169  bool is_cloned() { return bool(_clone); }
170  explicit stream_profile(const rs2_stream_profile* profile) : _profile(profile)
171  {
172  rs2_error* e = nullptr;
174  error::handle(e);
175 
177  error::handle(e);
178 
179  }
180  operator const rs2_stream_profile*() { return _profile; }
181  explicit operator std::shared_ptr<rs2_stream_profile>() { return _clone; }
182 
183  protected:
184  friend class rs2::sensor;
185  friend class rs2::frame;
186  friend class rs2::pipeline_profile;
188 
190  std::shared_ptr<rs2_stream_profile> _clone;
191 
192  int _index = 0;
193  int _uid = 0;
194  int _framerate = 0;
197 
198  bool _default = false;
199  };
200 
202  {
203  public:
209  : stream_profile(sp)
210  {
211  rs2_error* e = nullptr;
212  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_VIDEO_PROFILE, &e) == 0 && !e))
213  {
214  _profile = nullptr;
215  }
216  error::handle(e);
217 
218  if (_profile)
219  {
220  rs2_get_video_stream_resolution(_profile, &_width, &_height, &e);
221  error::handle(e);
222  }
223  }
224 
225  int width() const
226  {
227  return _width;
228  }
229 
230  int height() const
231  {
232  return _height;
233  }
239  {
240  rs2_error* e = nullptr;
241  rs2_intrinsics intr;
243  error::handle(e);
244  return intr;
245  }
246 
247  using stream_profile::clone;
248 
259  stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics& intr) const
260  {
261  rs2_error* e = nullptr;
262  auto ref = rs2_clone_video_stream_profile(_profile, type, index, format, width, height, &intr, &e);
263  error::handle(e);
264  stream_profile res(ref);
265  res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
266 
267  return res;
268  }
269  private:
270  int _width = 0;
271  int _height = 0;
272  };
273 
274 
276  {
277  public:
283  : stream_profile(sp)
284  {
285  rs2_error* e = nullptr;
286  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_MOTION_PROFILE, &e) == 0 && !e))
287  {
288  _profile = nullptr;
289  }
290  error::handle(e);
291  }
292 
298  {
299  rs2_error* e = nullptr;
301  rs2_get_motion_intrinsics(_profile, &intrin, &e);
302  error::handle(e);
303  return intrin;
304  }
305  };
306 
308  {
309  public:
315  : stream_profile(sp)
316  {
317  rs2_error* e = nullptr;
318  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_POSE_PROFILE, &e) == 0 && !e))
319  {
320  _profile = nullptr;
321  }
322  error::handle(e);
323  }
324  };
325 
330  {
331  public:
332  virtual rs2::frame process(rs2::frame frame) const = 0;
333  virtual ~filter_interface() = default;
334  };
335 
336  class frame
337  {
338  public:
342  frame() : frame_ref(nullptr) {}
347  frame(rs2_frame* ref) : frame_ref(ref)
348  {
349 #ifdef _DEBUG
350  if (ref)
351  {
352  rs2_error* e = nullptr;
353  auto r = rs2_get_frame_number(ref, &e);
354  if (!e)
355  frame_number = r;
356  auto s = rs2_get_frame_stream_profile(ref, &e);
357  if (!e)
358  profile = stream_profile(s);
359  }
360  else
361  {
362  frame_number = 0;
363  profile = stream_profile();
364  }
365 #endif
366  }
371  frame(frame&& other) noexcept : frame_ref(other.frame_ref)
372  {
373  other.frame_ref = nullptr;
374 #ifdef _DEBUG
375  frame_number = other.frame_number;
376  profile = other.profile;
377 #endif
378  }
384  {
385  swap(other);
386  return *this;
387  }
388 
393  frame(const frame& other)
394  : frame_ref(other.frame_ref)
395  {
396  if (frame_ref) add_ref();
397 #ifdef _DEBUG
398  frame_number = other.frame_number;
399  profile = other.profile;
400 #endif
401  }
406  void swap(frame& other)
407  {
408  std::swap(frame_ref, other.frame_ref);
409 
410 #ifdef _DEBUG
411  std::swap(frame_number, other.frame_number);
412  std::swap(profile, other.profile);
413 #endif
414  }
415 
420  {
421  if (frame_ref)
422  {
423  rs2_release_frame(frame_ref);
424  }
425  }
426 
430  void keep() { rs2_keep_frame(frame_ref); }
431 
436  operator bool() const { return frame_ref != nullptr; }
437 
439  {
440  rs2_error* e = nullptr;
441  auto r = rs2_get_frame_sensor(frame_ref, &e);
442  error::handle(e);
443  return r;
444  }
445 
467  double get_timestamp() const
468  {
469  rs2_error* e = nullptr;
470  auto r = rs2_get_frame_timestamp(frame_ref, &e);
471  error::handle(e);
472  return r;
473  }
474 
479  {
480  rs2_error* e = nullptr;
481  auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
482  error::handle(e);
483  return r;
484  }
485 
491  {
492  rs2_error* e = nullptr;
493  auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
494  error::handle(e);
495  return r;
496  }
497 
503  {
504  rs2_error* e = nullptr;
505  auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
506  error::handle(e);
507  return r != 0;
508  }
509 
514  unsigned long long get_frame_number() const
515  {
516  rs2_error* e = nullptr;
517  auto r = rs2_get_frame_number(frame_ref, &e);
518  error::handle(e);
519  return r;
520  }
521 
526  const int get_data_size() const
527  {
528  rs2_error* e = nullptr;
529  auto r = rs2_get_frame_data_size(frame_ref, &e);
530  error::handle(e);
531  return r;
532  }
533 
538  const void* get_data() const
539  {
540  rs2_error* e = nullptr;
541  auto r = rs2_get_frame_data(frame_ref, &e);
542  error::handle(e);
543  return r;
544  }
545 
551  {
552  rs2_error* e = nullptr;
553  auto s = rs2_get_frame_stream_profile(frame_ref, &e);
554  error::handle(e);
555  return stream_profile(s);
556  }
557 
562  template<class T>
563  bool is() const
564  {
565  T extension(*this);
566  return extension;
567  }
572  template<class T>
573  T as() const
574  {
575  T extension(*this);
576  return extension;
577  }
578 
583  rs2_frame* get() const { return frame_ref; }
584  explicit operator rs2_frame*() { return frame_ref; }
585 
587  {
588  return filter.process(*this);
589  }
590 
591  protected:
597  void add_ref() const
598  {
599  rs2_error* e = nullptr;
600  rs2_frame_add_ref(frame_ref, &e);
601  error::handle(e);
602  }
603 
604  void reset()
605  {
606  if (frame_ref)
607  {
608  rs2_release_frame(frame_ref);
609  }
610  frame_ref = nullptr;
611  }
612 
613  private:
614  friend class rs2::frame_source;
615  friend class rs2::frame_queue;
616  friend class rs2::syncer;
617  friend class rs2::processing_block;
618  friend class rs2::pointcloud;
619  friend class rs2::points;
620 
621  rs2_frame* frame_ref;
622 
623 #ifdef _DEBUG
624  stream_profile profile;
625  unsigned long long frame_number = 0;
626 #endif
627  };
628 
629  class video_frame : public frame
630  {
631  public:
636  video_frame(const frame& f)
637  : frame(f)
638  {
639  rs2_error* e = nullptr;
640  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
641  {
642  reset();
643  }
644  error::handle(e);
645  }
646 
647 
652  int get_width() const
653  {
654  rs2_error* e = nullptr;
655  auto r = rs2_get_frame_width(get(), &e);
656  error::handle(e);
657  return r;
658  }
659 
664  int get_height() const
665  {
666  rs2_error* e = nullptr;
667  auto r = rs2_get_frame_height(get(), &e);
668  error::handle(e);
669  return r;
670  }
671 
677  {
678  rs2_error* e = nullptr;
679  auto r = rs2_get_frame_stride_in_bytes(get(), &e);
680  error::handle(e);
681  return r;
682  }
683 
688  int get_bits_per_pixel() const
689  {
690  rs2_error* e = nullptr;
691  auto r = rs2_get_frame_bits_per_pixel(get(), &e);
692  error::handle(e);
693  return r;
694  }
695 
700  int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
701  };
702 
703  struct vertex {
704  float x, y, z;
705  operator const float*() const { return &x; }
706  };
708  float u, v;
709  operator const float*() const { return &u; }
710  };
711 
712  class points : public frame
713  {
714  public:
718  points() : frame(), _size(0) {}
719 
724  points(const frame& f)
725  : frame(f), _size(0)
726  {
727  rs2_error* e = nullptr;
728  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
729  {
730  reset();
731  }
732  error::handle(e);
733 
734  if (get())
735  {
736  _size = rs2_get_frame_points_count(get(), &e);
737  error::handle(e);
738  }
739  }
744  const vertex* get_vertices() const
745  {
746  rs2_error* e = nullptr;
747  auto res = rs2_get_frame_vertices(get(), &e);
748  error::handle(e);
749  return (const vertex*)res;
750  }
751 
757  void export_to_ply(const std::string& fname, video_frame texture)
758  {
759  rs2_frame* ptr = nullptr;
760  std::swap(texture.frame_ref, ptr);
761  rs2_error* e = nullptr;
762  rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
763  error::handle(e);
764  }
770  {
771  rs2_error* e = nullptr;
772  auto res = rs2_get_frame_texture_coordinates(get(), &e);
773  error::handle(e);
774  return (const texture_coordinate*)res;
775  }
776 
777  size_t size() const
778  {
779  return _size;
780  }
781 
782  private:
783  size_t _size;
784  };
785 
786  class depth_frame : public video_frame
787  {
788  public:
793  depth_frame(const frame& f)
794  : video_frame(f)
795  {
796  rs2_error* e = nullptr;
797  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
798  {
799  reset();
800  }
801  error::handle(e);
802  }
803 
810  float get_distance(int x, int y) const
811  {
812  rs2_error * e = nullptr;
813  auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
814  error::handle(e);
815  return r;
816  }
817  };
818 
820  {
821  public:
827  : depth_frame(f)
828  {
829  rs2_error* e = nullptr;
830  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
831  {
832  reset();
833  }
834  error::handle(e);
835  }
840  float get_baseline(void) const
841  {
842  rs2_error * e = nullptr;
844  error::handle(e);
845  return r;
846  }
847  };
848 
849  class motion_frame : public frame
850  {
851  public:
856  motion_frame(const frame& f)
857  : frame(f)
858  {
859  rs2_error* e = nullptr;
860  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
861  {
862  reset();
863  }
864  error::handle(e);
865  }
871  {
872  auto data = reinterpret_cast<const float*>(get_data());
873  return rs2_vector{ data[0], data[1], data[2] };
874  }
875  };
876 
877  class pose_frame : public frame
878  {
879  public:
884  pose_frame(const frame& f)
885  : frame(f)
886  {
887  rs2_error* e = nullptr;
888  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
889  {
890  reset();
891  }
892  error::handle(e);
893  }
899  {
900  rs2_pose pose_data;
901  rs2_error* e = nullptr;
902  rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
903  error::handle(e);
904  return pose_data;
905  }
906  };
907 
908  class frameset : public frame
909  {
910  public:
914  frameset() :_size(0) {};
919  frameset(const frame& f)
920  : frame(f), _size(0)
921  {
922  rs2_error* e = nullptr;
923  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
924  {
925  reset();
926  // TODO - consider explicit constructor to move resultion to compile time
927  }
928  error::handle(e);
929 
930  if (get())
931  {
932  _size = rs2_embedded_frames_count(get(), &e);
933  error::handle(e);
934  }
935  }
936 
944  {
945  frame result;
946  foreach_rs([&result, s, f](frame frm) {
947  if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
948  {
949  result = std::move(frm);
950  }
951  });
952  return result;
953  }
961  {
962  auto frm = first_or_default(s, f);
963  if (!frm) throw error("Frame of requested stream type was not found!");
964  return frm;
965  }
966 
972  {
974  return f.as<depth_frame>();
975  }
981  {
983 
984  if (!f)
985  {
987  if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
988  f = ir;
989  }
990  return f;
991  }
997  video_frame get_infrared_frame(const size_t index = 0) const
998  {
999  frame f;
1000  if (!index)
1001  {
1003  }
1004  else
1005  {
1006  foreach_rs([&f, index](const frame& frm) {
1007  if (frm.get_profile().stream_type() == RS2_STREAM_INFRARED &&
1008  frm.get_profile().stream_index() == index) f = frm;
1009  });
1010  }
1011  return f;
1012  }
1013 
1019  video_frame get_fisheye_frame(const size_t index = 0) const
1020  {
1021  frame f;
1022  if (!index)
1023  {
1025  }
1026  else
1027  {
1028  foreach_rs([&f, index](const frame& frm) {
1029  if (frm.get_profile().stream_type() == RS2_STREAM_FISHEYE &&
1030  frm.get_profile().stream_index() == index) f = frm;
1031  });
1032  }
1033  return f;
1034  }
1035 
1041  pose_frame get_pose_frame(const size_t index = 0) const
1042  {
1043  frame f;
1044  if (!index)
1045  {
1047  }
1048  else
1049  {
1050  foreach_rs([&f, index](const frame& frm) {
1051  if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1052  frm.get_profile().stream_index() == index) f = frm;
1053  });
1054  }
1055  return f.as<pose_frame>();
1056  }
1057 
1062  size_t size() const
1063  {
1064  return _size;
1065  }
1066 
1071  template<class T>
1072  void foreach_rs(T action) const
1073  {
1074  rs2_error* e = nullptr;
1075  auto count = size();
1076  for (size_t i = 0; i < count; i++)
1077  {
1078  auto fref = rs2_extract_frame(get(), (int)i, &e);
1079  error::handle(e);
1080 
1081  action(frame(fref));
1082  }
1083  }
1089  frame operator[](size_t index) const
1090  {
1091  rs2_error* e = nullptr;
1092  if (index < size())
1093  {
1094  auto fref = rs2_extract_frame(get(), (int)index, &e);
1095  error::handle(e);
1096  return frame(fref);
1097  }
1098 
1099  throw error("Requested index is out of range!");
1100  }
1101 
1102  class iterator : public std::iterator<std::forward_iterator_tag, frame>
1103  {
1104  public:
1105  iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1106  iterator& operator++() { ++_index; return *this; }
1107  bool operator==(const iterator& other) const { return _index == other._index; }
1108  bool operator!=(const iterator& other) const { return !(*this == other); }
1109 
1110  frame operator*() { return (*_owner)[_index]; }
1111  private:
1112  size_t _index = 0;
1113  const frameset* _owner;
1114  };
1115 
1116  iterator begin() const { return iterator(this); }
1117  iterator end() const { return iterator(this, size()); }
1118  private:
1119  size_t _size;
1120  };
1121 
1122  template<class T>
1124  {
1125  T on_frame_function;
1126  public:
1127  explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1128 
1129  void on_frame(rs2_frame* fref) override
1130  {
1131  on_frame_function(frame{ fref });
1132  }
1133 
1134  void release() override { delete this; }
1135  };
1136 }
1137 #endif // LIBREALSENSE_RS2_FRAME_HPP
rs2::vertex
Definition: rs_frame.hpp:703
rs2::frameset::get_fisheye_frame
video_frame get_fisheye_frame(const size_t index=0) const
Definition: rs_frame.hpp:1019
rs2_vector
3D vector in Euclidean coordinate space
Definition: rs_types.h:97
rs2_get_video_stream_intrinsics
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
rs2::frameset::foreach_rs
void foreach_rs(T action) const
Definition: rs_frame.hpp:1072
rs2::motion_stream_profile::motion_stream_profile
motion_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:282
rs2::stream_profile::format
rs2_format format() const
Definition: rs_frame.hpp:44
rs2::stream_profile::operator==
bool operator==(const stream_profile &rhs)
Definition: rs_frame.hpp:79
rs2::video_frame::get_stride_in_bytes
int get_stride_in_bytes() const
Definition: rs_frame.hpp:676
rs2::frameset::get_depth_frame
depth_frame get_depth_frame() const
Definition: rs_frame.hpp:971
rs2_get_frame_timestamp
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
RS2_STREAM_POSE
@ RS2_STREAM_POSE
Definition: rs_sensor.h:51
rs2::frame
Definition: rs_frame.hpp:336
rs2::video_stream_profile::clone
stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics &intr) const
Definition: rs_frame.hpp:259
rs2::video_stream_profile::get_intrinsics
rs2_intrinsics get_intrinsics() const
Definition: rs_frame.hpp:238
rs2::frame_source
Definition: rs_processing.hpp:18
rs2::frameset
Definition: rs_frame.hpp:908
rs2_supports_frame_metadata
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
rs2::depth_frame::get_distance
float get_distance(int x, int y) const
Definition: rs_frame.hpp:810
RS2_EXTENSION_MOTION_FRAME
@ RS2_EXTENSION_MOTION_FRAME
Definition: rs_types.h:144
rs2_extrinsics
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition: rs_sensor.h:93
rs2::stream_profile
Definition: rs_frame.hpp:22
rs2::stream_profile::_profile
const rs2_stream_profile * _profile
Definition: rs_frame.hpp:189
rs2::frame::get_sensor
rs2_sensor * get_sensor()
Definition: rs_frame.hpp:438
rs2::stream_profile::fps
int fps() const
Definition: rs_frame.hpp:49
rs2::stream_profile::stream_profile
stream_profile(const rs2_stream_profile *profile)
Definition: rs_frame.hpp:170
rs2::frame::is
bool is() const
Definition: rs_frame.hpp:563
rs2::stream_profile::as
T as() const
Definition: rs_frame.hpp:103
rs2_register_extrinsics
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
rs2_delete_stream_profile
void rs2_delete_stream_profile(rs2_stream_profile *mode)
rs2::disparity_frame::get_baseline
float get_baseline(void) const
Definition: rs_frame.hpp:840
rs2::frameset::first
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:960
rs2::points::get_vertices
const vertex * get_vertices() const
Definition: rs_frame.hpp:744
rs2::frame::swap
void swap(frame &other)
Definition: rs_frame.hpp:406
RS2_EXTENSION_POSE_PROFILE
@ RS2_EXTENSION_POSE_PROFILE
Definition: rs_types.h:156
rs2::frame::keep
void keep()
Definition: rs_frame.hpp:430
rs2::frame::operator=
frame & operator=(frame other)
Definition: rs_frame.hpp:383
rs2_intrinsics
Video stream intrinsics.
Definition: rs_types.h:58
rs2::vertex::z
float z
Definition: rs_frame.hpp:704
rs2::frame::apply_filter
frame apply_filter(filter_interface &filter)
Definition: rs_frame.hpp:586
rs2_frame
struct rs2_frame rs2_frame
Definition: rs_types.h:213
rs2::frameset::first_or_default
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:943
rs2_stream_to_string
const char * rs2_stream_to_string(rs2_stream stream)
RS2_FORMAT_RGB8
@ RS2_FORMAT_RGB8
Definition: rs_sensor.h:65
rs2::stream_profile::_type
rs2_stream _type
Definition: rs_frame.hpp:196
rs2::frame::get_frame_number
unsigned long long get_frame_number() const
Definition: rs_frame.hpp:514
rs2::stream_profile::_clone
std::shared_ptr< rs2_stream_profile > _clone
Definition: rs_frame.hpp:190
rs2_release_frame
void rs2_release_frame(rs2_frame *frame)
rs2::texture_coordinate
Definition: rs_frame.hpp:707
rs2_depth_stereo_frame_get_baseline
float rs2_depth_stereo_frame_get_baseline(const rs2_frame *frame_ref, rs2_error **error)
rs2::stream_profile::stream_name
std::string stream_name() const
Definition: rs_frame.hpp:113
rs2::stream_profile::stream_type
rs2_stream stream_type() const
Definition: rs_frame.hpp:39
RS2_EXTENSION_COMPOSITE_FRAME
@ RS2_EXTENSION_COMPOSITE_FRAME
Definition: rs_types.h:145
rs2::stream_profile::clone
stream_profile clone(rs2_stream type, int index, rs2_format format) const
Definition: rs_frame.hpp:63
rs2::pose_stream_profile::pose_stream_profile
pose_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:314
rs2_get_frame_timestamp_domain
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
rs2::motion_stream_profile::get_motion_intrinsics
rs2_motion_device_intrinsic get_motion_intrinsics() const
Definition: rs_frame.hpp:297
rs2_get_frame_width
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
RS2_STREAM_FISHEYE
@ RS2_STREAM_FISHEYE
Definition: rs_sensor.h:47
rs2_depth_frame_get_distance
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
rs2_get_video_stream_resolution
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
rs2_is_stream_profile_default
int rs2_is_stream_profile_default(const rs2_stream_profile *mode, rs2_error **error)
rs2::frameset::iterator
Definition: rs_frame.hpp:1102
rs2::frame::get_data
const void * get_data() const
Definition: rs_frame.hpp:538
rs2::stream_profile::get_extrinsics_to
rs2_extrinsics get_extrinsics_to(const stream_profile &to) const
Definition: rs_frame.hpp:148
rs2::frameset::operator[]
frame operator[](size_t index) const
Definition: rs_frame.hpp:1089
RS2_STREAM_COLOR
@ RS2_STREAM_COLOR
Definition: rs_sensor.h:45
RS2_EXTENSION_MOTION_PROFILE
@ RS2_EXTENSION_MOTION_PROFILE
Definition: rs_types.h:154
rs2::frameset::begin
iterator begin() const
Definition: rs_frame.hpp:1116
rs2_get_frame_sensor
rs2_sensor * rs2_get_frame_sensor(const rs2_frame *frame, rs2_error **error)
rs2::video_frame::get_bits_per_pixel
int get_bits_per_pixel() const
Definition: rs_frame.hpp:688
RS2_FORMAT_Z16
@ RS2_FORMAT_Z16
Definition: rs_sensor.h:61
rs2::texture_coordinate::u
float u
Definition: rs_frame.hpp:708
rs2::frameset::get_pose_frame
pose_frame get_pose_frame(const size_t index=0) const
Definition: rs_frame.hpp:1041
rs2::stream_profile::_format
rs2_format _format
Definition: rs_frame.hpp:195
rs2_get_frame_texture_coordinates
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
rs2::frame::supports_frame_metadata
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:502
rs2_clone_video_stream_profile
rs2_stream_profile * rs2_clone_video_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, int width, int height, const rs2_intrinsics *intr, rs2_error **error)
rs2_format
rs2_format
A stream's format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:58
rs2_get_frame_height
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
rs2_motion_device_intrinsic
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:71
rs2::frame::get_timestamp
double get_timestamp() const
Definition: rs_frame.hpp:467
rs2::depth_frame::depth_frame
depth_frame(const frame &f)
Definition: rs_frame.hpp:793
rs2::stream_profile::stream_profile
stream_profile()
Definition: rs_frame.hpp:28
rs2::video_stream_profile
Definition: rs_frame.hpp:201
rs2::vertex::y
float y
Definition: rs_frame.hpp:704
rs2::frameset::frameset
frameset(const frame &f)
Definition: rs_frame.hpp:919
rs2::frame::frame
frame()
Definition: rs_frame.hpp:342
rs2::frame::frame
frame(frame &&other) noexcept
Definition: rs_frame.hpp:371
rs2_get_stream_profile_data
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)
rs2::points
Definition: rs_frame.hpp:712
rs2::processing_block
Definition: rs_processing.hpp:233
rs2::frame::get
rs2_frame * get() const
Definition: rs_frame.hpp:583
rs2::vertex::x
float x
Definition: rs_frame.hpp:704
rs2::stream_profile::is_cloned
bool is_cloned()
Definition: rs_frame.hpp:169
rs2_get_frame_metadata
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
rs2::frameset::size
size_t size() const
Definition: rs_frame.hpp:1062
rs2::frame_callback::on_frame
void on_frame(rs2_frame *fref) override
Definition: rs_frame.hpp:1129
rs2::video_stream_profile::video_stream_profile
video_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:208
rs2::syncer
Definition: rs_processing.hpp:597
rs2::stream_profile::_default
bool _default
Definition: rs_frame.hpp:198
RS2_EXTENSION_VIDEO_PROFILE
@ RS2_EXTENSION_VIDEO_PROFILE
Definition: rs_types.h:150
rs2
Definition: rs_context.hpp:11
rs2_clone_stream_profile
rs2_stream_profile * rs2_clone_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, rs2_error **error)
rs2_metadata_type
long long rs2_metadata_type
Definition: rs_types.h:247
rs2::sensor
Definition: rs_sensor.hpp:103
rs2_get_frame_vertices
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
rs2::frame::frame
frame(rs2_frame *ref)
Definition: rs_frame.hpp:347
rs2_get_extrinsics
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
rs2_sensor
struct rs2_sensor rs2_sensor
Definition: rs_types.h:234
RS2_STREAM_DEPTH
@ RS2_STREAM_DEPTH
Definition: rs_sensor.h:44
RS2_EXTENSION_VIDEO_FRAME
@ RS2_EXTENSION_VIDEO_FRAME
Definition: rs_types.h:143
rs2_extract_frame
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
rs2::video_frame::video_frame
video_frame(const frame &f)
Definition: rs_frame.hpp:636
rs2::video_frame::get_width
int get_width() const
Definition: rs_frame.hpp:652
rs2::frameset::iterator::operator==
bool operator==(const iterator &other) const
Definition: rs_frame.hpp:1107
rs2::frameset::end
iterator end() const
Definition: rs_frame.hpp:1117
rs2_frame_add_ref
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
rs2::stream_profile::_index
int _index
Definition: rs_frame.hpp:192
RS2_STREAM_ANY
@ RS2_STREAM_ANY
Definition: rs_sensor.h:43
rs2_pose
Definition: rs_types.h:108
rs2_stream_profile_is
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
rs2::stream_profile::get
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
rs2::frameset::iterator::operator*
frame operator*()
Definition: rs_frame.hpp:1110
rs2::stream_profile::is_default
bool is_default() const
Definition: rs_frame.hpp:125
rs2_embedded_frames_count
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
rs2_export_to_ply
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, rs2_error **error)
rs2::pose_frame
Definition: rs_frame.hpp:877
rs2::video_stream_profile::height
int height() const
Definition: rs_frame.hpp:230
rs2::frame::~frame
~frame()
Definition: rs_frame.hpp:419
rs2::points::size
size_t size() const
Definition: rs_frame.hpp:777
rs2::frameset::frameset
frameset()
Definition: rs_frame.hpp:914
rs2::pose_stream_profile
Definition: rs_frame.hpp:307
rs2::frameset::iterator::operator++
iterator & operator++()
Definition: rs_frame.hpp:1106
rs2::points::points
points(const frame &f)
Definition: rs_frame.hpp:724
rs2::frameset::get_color_frame
video_frame get_color_frame() const
Definition: rs_frame.hpp:980
rs2::stream_profile::is
bool is() const
Definition: rs_frame.hpp:92
RS2_EXTENSION_DEPTH_FRAME
@ RS2_EXTENSION_DEPTH_FRAME
Definition: rs_types.h:147
RS2_FORMAT_ANY
@ RS2_FORMAT_ANY
Definition: rs_sensor.h:60
rs2::frame::get_frame_metadata
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:490
rs2::frame_callback::frame_callback
frame_callback(T on_frame)
Definition: rs_frame.hpp:1127
rs2_get_frame_stride_in_bytes
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
rs2::filter_interface::~filter_interface
virtual ~filter_interface()=default
rs2::stream_profile::register_extrinsics_to
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Definition: rs_frame.hpp:162
rs2::points::points
points()
Definition: rs_frame.hpp:718
rs2::frame::get_frame_timestamp_domain
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition: rs_frame.hpp:478
rs2::disparity_frame
Definition: rs_frame.hpp:819
rs2::depth_frame
Definition: rs_frame.hpp:786
rs2::frame::as
T as() const
Definition: rs_frame.hpp:573
rs2_stream_profile
struct rs2_stream_profile rs2_stream_profile
Definition: rs_types.h:221
rs2::error
Definition: rs_types.hpp:76
rs2::filter_interface
Definition: rs_frame.hpp:329
rs2::frame::frame
frame(const frame &other)
Definition: rs_frame.hpp:393
rs2::filter
Definition: rs_processing.hpp:343
rs2::frame::get_data_size
const int get_data_size() const
Definition: rs_frame.hpp:526
rs2_get_frame_data
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
rs2::frame::get_profile
stream_profile get_profile() const
Definition: rs_frame.hpp:550
rs2::frame_queue
Definition: rs_processing.hpp:134
rs2::frame_callback::release
void release() override
Definition: rs_frame.hpp:1134
rs2_get_frame_number
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
rs2::stream_profile::unique_id
int unique_id() const
Definition: rs_frame.hpp:54
rs2::video_frame
Definition: rs_frame.hpp:629
rs2::filter_interface::process
virtual rs2::frame process(rs2::frame frame) const =0
rs2::error::handle
static void handle(rs2_error *e)
Definition: rs_types.hpp:128
rs2::frameset::get_infrared_frame
video_frame get_infrared_frame(const size_t index=0) const
Definition: rs_frame.hpp:997
RS2_STREAM_INFRARED
@ RS2_STREAM_INFRARED
Definition: rs_sensor.h:46
rs2::texture_coordinate::v
float v
Definition: rs_frame.hpp:708
rs2::points::export_to_ply
void export_to_ply(const std::string &fname, video_frame texture)
Definition: rs_frame.hpp:757
rs2::frame::reset
void reset()
Definition: rs_frame.hpp:604
rs2::frameset::iterator::iterator
iterator(const frameset *owner, size_t index=0)
Definition: rs_frame.hpp:1105
rs2_get_frame_data_size
int rs2_get_frame_data_size(const rs2_frame *frame, rs2_error **error)
rs2::points::get_texture_coordinates
const texture_coordinate * get_texture_coordinates() const
Definition: rs_frame.hpp:769
rs2::video_stream_profile::width
int width() const
Definition: rs_frame.hpp:225
rs2::frame_callback
Definition: rs_frame.hpp:1123
rs2::video_frame::get_bytes_per_pixel
int get_bytes_per_pixel() const
Definition: rs_frame.hpp:700
rs2_get_frame_stream_profile
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
rs2::motion_frame::motion_frame
motion_frame(const frame &f)
Definition: rs_frame.hpp:856
RS2_EXTENSION_POINTS
@ RS2_EXTENSION_POINTS
Definition: rs_types.h:146
rs2::stream_profile::_uid
int _uid
Definition: rs_frame.hpp:193
RS2_EXTENSION_POSE_FRAME
@ RS2_EXTENSION_POSE_FRAME
Definition: rs_types.h:155
rs2::pipeline_profile
Definition: rs_pipeline.hpp:18
rs2_timestamp_domain
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19
rs2::pointcloud
Definition: rs_processing.hpp:412
rs2::stream_profile::_framerate
int _framerate
Definition: rs_frame.hpp:194
RS2_EXTENSION_DISPARITY_FRAME
@ RS2_EXTENSION_DISPARITY_FRAME
Definition: rs_types.h:153
rs2::pose_frame::get_pose_data
rs2_pose get_pose_data() const
Definition: rs_frame.hpp:898
rs2::motion_frame::get_motion_data
rs2_vector get_motion_data() const
Definition: rs_frame.hpp:870
rs2::stream_profile::stream_index
int stream_index() const
Definition: rs_frame.hpp:34
rs2::motion_stream_profile
Definition: rs_frame.hpp:275
rs2_frame_metadata_value
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
rs2::frameset::iterator::operator!=
bool operator!=(const iterator &other) const
Definition: rs_frame.hpp:1108
rs2_is_frame_extendable_to
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
rs2::frame::add_ref
void add_ref() const
Definition: rs_frame.hpp:597
rs2_get_frame_bits_per_pixel
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
rs2_get_frame_points_count
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
rs2::pose_frame::pose_frame
pose_frame(const frame &f)
Definition: rs_frame.hpp:884
rs2_pose_frame_get_pose_data
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
rs2::motion_frame
Definition: rs_frame.hpp:849
rs2_keep_frame
void rs2_keep_frame(rs2_frame *frame)
rs2::disparity_frame::disparity_frame
disparity_frame(const frame &f)
Definition: rs_frame.hpp:826
rs2_stream
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:41
rs2_error
struct rs2_error rs2_error
Definition: rs_types.h:211
rs2::video_frame::get_height
int get_height() const
Definition: rs_frame.hpp:664
rs2::filter::process
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:352
rs2_get_motion_intrinsics
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
rs2_frame_callback
Definition: rs_types.hpp:25
rs_types.hpp