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 
285  {
286  public:
292  : stream_profile(sp)
293  {
294  rs2_error* e = nullptr;
295  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_POSE_PROFILE, &e) == 0 && !e))
296  {
297  _profile = nullptr;
298  }
299  error::handle(e);
300  }
301  };
302 
307  {
308  public:
309  virtual rs2::frame process(rs2::frame frame) const = 0;
310  virtual ~filter_interface() = default;
311  };
312 
313  class frame
314  {
315  public:
319  frame() : frame_ref(nullptr) {}
324  frame(rs2_frame* ref) : frame_ref(ref)
325  {
326 #ifdef _DEBUG
327  if (ref)
328  {
329  rs2_error* e = nullptr;
330  auto r = rs2_get_frame_number(ref, &e);
331  if (!e)
332  frame_number = r;
333  auto s = rs2_get_frame_stream_profile(ref, &e);
334  if (!e)
335  profile = stream_profile(s);
336  }
337  else
338  {
339  frame_number = 0;
340  profile = stream_profile();
341  }
342 #endif
343  }
348  frame(frame&& other) noexcept : frame_ref(other.frame_ref)
349  {
350  other.frame_ref = nullptr;
351 #ifdef _DEBUG
352  frame_number = other.frame_number;
353  profile = other.profile;
354 #endif
355  }
361  {
362  swap(other);
363  return *this;
364  }
365 
370  frame(const frame& other)
371  : frame_ref(other.frame_ref)
372  {
373  if (frame_ref) add_ref();
374 #ifdef _DEBUG
375  frame_number = other.frame_number;
376  profile = other.profile;
377 #endif
378  }
383  void swap(frame& other)
384  {
385  std::swap(frame_ref, other.frame_ref);
386 
387 #ifdef _DEBUG
388  std::swap(frame_number, other.frame_number);
389  std::swap(profile, other.profile);
390 #endif
391  }
392 
397  {
398  if (frame_ref)
399  {
400  rs2_release_frame(frame_ref);
401  }
402  }
403 
407  void keep() { rs2_keep_frame(frame_ref); }
408 
413  operator bool() const { return frame_ref != nullptr; }
414 
421  {
422  rs2_error* e = nullptr;
423  auto r = rs2_get_frame_sensor(frame_ref, &e);
424  error::handle(e);
425  return r;
426  }
427 
428  double get_timestamp() const
429  {
430  rs2_error* e = nullptr;
431  auto r = rs2_get_frame_timestamp(frame_ref, &e);
432  error::handle(e);
433  return r;
434  }
435 
440  {
441  rs2_error* e = nullptr;
442  auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
443  error::handle(e);
444  return r;
445  }
446 
452  {
453  rs2_error* e = nullptr;
454  auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
455  error::handle(e);
456  return r;
457  }
458 
464  {
465  rs2_error* e = nullptr;
466  auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
467  error::handle(e);
468  return r != 0;
469  }
470 
475  unsigned long long get_frame_number() const
476  {
477  rs2_error* e = nullptr;
478  auto r = rs2_get_frame_number(frame_ref, &e);
479  error::handle(e);
480  return r;
481  }
482 
487  const void* get_data() const
488  {
489  rs2_error* e = nullptr;
490  auto r = rs2_get_frame_data(frame_ref, &e);
491  error::handle(e);
492  return r;
493  }
494 
500  {
501  rs2_error* e = nullptr;
502  auto s = rs2_get_frame_stream_profile(frame_ref, &e);
503  error::handle(e);
504  return stream_profile(s);
505  }
506 
511  template<class T>
512  bool is() const
513  {
514  T extension(*this);
515  return extension;
516  }
521  template<class T>
522  T as() const
523  {
524  T extension(*this);
525  return extension;
526  }
527 
532  rs2_frame* get() const { return frame_ref; }
533  explicit operator rs2_frame*() { return frame_ref; }
534 
536  {
537  return filter.process(*this);
538  }
539 
540  protected:
546  void add_ref() const
547  {
548  rs2_error* e = nullptr;
549  rs2_frame_add_ref(frame_ref, &e);
550  error::handle(e);
551  }
552 
553  void reset()
554  {
555  if (frame_ref)
556  {
557  rs2_release_frame(frame_ref);
558  }
559  frame_ref = nullptr;
560  }
561 
562  private:
563  friend class rs2::frame_source;
564  friend class rs2::frame_queue;
565  friend class rs2::syncer;
566  friend class rs2::processing_block;
567  friend class rs2::pointcloud;
568  friend class rs2::points;
569 
570  rs2_frame* frame_ref;
571 
572 #ifdef _DEBUG
573  stream_profile profile;
574  unsigned long long frame_number = 0;
575 #endif
576  };
577 
578  class video_frame : public frame
579  {
580  public:
585  video_frame(const frame& f)
586  : frame(f)
587  {
588  rs2_error* e = nullptr;
589  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
590  {
591  reset();
592  }
593  error::handle(e);
594  }
595 
596 
601  int get_width() const
602  {
603  rs2_error* e = nullptr;
604  auto r = rs2_get_frame_width(get(), &e);
605  error::handle(e);
606  return r;
607  }
608 
613  int get_height() const
614  {
615  rs2_error* e = nullptr;
616  auto r = rs2_get_frame_height(get(), &e);
617  error::handle(e);
618  return r;
619  }
620 
626  {
627  rs2_error* e = nullptr;
628  auto r = rs2_get_frame_stride_in_bytes(get(), &e);
629  error::handle(e);
630  return r;
631  }
632 
637  int get_bits_per_pixel() const
638  {
639  rs2_error* e = nullptr;
640  auto r = rs2_get_frame_bits_per_pixel(get(), &e);
641  error::handle(e);
642  return r;
643  }
644 
649  int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
650  };
651 
652  struct vertex {
653  float x, y, z;
654  operator const float*() const { return &x; }
655  };
657  float u, v;
658  operator const float*() const { return &u; }
659  };
660 
661  class points : public frame
662  {
663  public:
667  points() : frame(), _size(0) {}
668 
673  points(const frame& f)
674  : frame(f), _size(0)
675  {
676  rs2_error* e = nullptr;
677  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
678  {
679  reset();
680  }
681  error::handle(e);
682 
683  if (get())
684  {
685  _size = rs2_get_frame_points_count(get(), &e);
686  error::handle(e);
687  }
688  }
693  const vertex* get_vertices() const
694  {
695  rs2_error* e = nullptr;
696  auto res = rs2_get_frame_vertices(get(), &e);
697  error::handle(e);
698  return (const vertex*)res;
699  }
700 
706  void export_to_ply(const std::string& fname, video_frame texture)
707  {
708  rs2_frame* ptr = nullptr;
709  std::swap(texture.frame_ref, ptr);
710  rs2_error* e = nullptr;
711  rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
712  error::handle(e);
713  }
719  {
720  rs2_error* e = nullptr;
721  auto res = rs2_get_frame_texture_coordinates(get(), &e);
722  error::handle(e);
723  return (const texture_coordinate*)res;
724  }
725 
726  size_t size() const
727  {
728  return _size;
729  }
730 
731  private:
732  size_t _size;
733  };
734 
735  class depth_frame : public video_frame
736  {
737  public:
742  depth_frame(const frame& f)
743  : video_frame(f)
744  {
745  rs2_error* e = nullptr;
746  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
747  {
748  reset();
749  }
750  error::handle(e);
751  }
752 
759  float get_distance(int x, int y) const
760  {
761  rs2_error * e = nullptr;
762  auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
763  error::handle(e);
764  return r;
765  }
766  };
767 
769  {
770  public:
776  : depth_frame(f)
777  {
778  rs2_error* e = nullptr;
779  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
780  {
781  reset();
782  }
783  error::handle(e);
784  }
789  float get_baseline(void) const
790  {
791  rs2_error * e = nullptr;
792  auto r = rs2_depth_stereo_frame_get_baseline(get(), &e);
793  error::handle(e);
794  return r;
795  }
796  };
797 
798  class motion_frame : public frame
799  {
800  public:
805  motion_frame(const frame& f)
806  : frame(f)
807  {
808  rs2_error* e = nullptr;
809  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
810  {
811  reset();
812  }
813  error::handle(e);
814  }
820  {
821  auto data = reinterpret_cast<const float*>(get_data());
822  return rs2_vector{ data[0], data[1], data[2] };
823  }
824  };
825 
826  class pose_frame : public frame
827  {
828  public:
833  pose_frame(const frame& f)
834  : frame(f)
835  {
836  rs2_error* e = nullptr;
837  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
838  {
839  reset();
840  }
841  error::handle(e);
842  }
848  {
849  rs2_pose pose_data;
850  rs2_error* e = nullptr;
851  rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
852  error::handle(e);
853  return pose_data;
854  }
855  };
856 
857  class frameset : public frame
858  {
859  public:
863  frameset() :_size(0) {};
868  frameset(const frame& f)
869  : frame(f), _size(0)
870  {
871  rs2_error* e = nullptr;
872  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
873  {
874  reset();
875  // TODO - consider explicit constructor to move resultion to compile time
876  }
877  error::handle(e);
878 
879  if (get())
880  {
881  _size = rs2_embedded_frames_count(get(), &e);
882  error::handle(e);
883  }
884  }
885 
893  {
894  frame result;
895  foreach([&result, s, f](frame frm) {
896  if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
897  {
898  result = std::move(frm);
899  }
900  });
901  return result;
902  }
910  {
911  auto frm = first_or_default(s, f);
912  if (!frm) throw error("Frame of requested stream type was not found!");
913  return frm;
914  }
915 
921  {
923  return f.as<depth_frame>();
924  }
930  {
932 
933  if (!f)
934  {
936  if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
937  f = ir;
938  }
939  return f;
940  }
946  video_frame get_infrared_frame(const size_t index = 0) const
947  {
948  frame f;
949  if (!index)
950  {
952  }
953  else
954  {
955  foreach([&f, index](const frame& frm) {
957  frm.get_profile().stream_index() == index) f = frm;
958  });
959  }
960  return f;
961  }
962 
968  video_frame get_fisheye_frame(const size_t index = 0) const
969  {
970  frame f;
971  if (!index)
972  {
974  }
975  else
976  {
977  foreach([&f, index](const frame& frm) {
978  if (frm.get_profile().stream_type() == RS2_STREAM_FISHEYE &&
979  frm.get_profile().stream_index() == index) f = frm;
980  });
981  }
982  return f;
983  }
984 
990  pose_frame get_pose_frame(const size_t index = 0) const
991  {
992  frame f;
993  if (!index)
994  {
996  }
997  else
998  {
999  foreach([&f, index](const frame& frm) {
1000  if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1001  frm.get_profile().stream_index() == index) f = frm;
1002  });
1003  }
1004  return f.as<pose_frame>();
1005  }
1006 
1011  size_t size() const
1012  {
1013  return _size;
1014  }
1015 
1020  template<class T>
1021  void foreach(T action) const
1022  {
1023  rs2_error* e = nullptr;
1024  auto count = size();
1025  for (size_t i = 0; i < count; i++)
1026  {
1027  auto fref = rs2_extract_frame(get(), (int)i, &e);
1028  error::handle(e);
1029 
1030  action(frame(fref));
1031  }
1032  }
1038  frame operator[](size_t index) const
1039  {
1040  rs2_error* e = nullptr;
1041  if (index < size())
1042  {
1043  auto fref = rs2_extract_frame(get(), (int)index, &e);
1044  error::handle(e);
1045  return frame(fref);
1046  }
1047 
1048  throw error("Requested index is out of range!");
1049  }
1050 
1051  class iterator : public std::iterator<std::forward_iterator_tag, frame>
1052  {
1053  public:
1054  iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1055  iterator& operator++() { ++_index; return *this; }
1056  bool operator==(const iterator& other) const { return _index == other._index; }
1057  bool operator!=(const iterator& other) const { return !(*this == other); }
1058 
1059  frame operator*() { return (*_owner)[_index]; }
1060  private:
1061  size_t _index = 0;
1062  const frameset* _owner;
1063  };
1064 
1065  iterator begin() const { return iterator(this); }
1066  iterator end() const { return iterator(this, size()); }
1067  private:
1068  size_t _size;
1069  };
1070 
1071  template<class T>
1073  {
1074  T on_frame_function;
1075  public:
1076  explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1077 
1078  void on_frame(rs2_frame* fref) override
1079  {
1080  on_frame_function(frame{ fref });
1081  }
1082 
1083  void release() override { delete this; }
1084  };
1085 }
1086 #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:1065
frame apply_filter(filter_interface &filter)
Definition: rs_frame.hpp:535
Definition: rs_frame.hpp:21
int get_bytes_per_pixel() const
Definition: rs_frame.hpp:649
depth_frame(const frame &f)
Definition: rs_frame.hpp:742
Definition: rs_frame.hpp:578
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:313
void release() override
Definition: rs_frame.hpp:1083
void add_ref() const
Definition: rs_frame.hpp:546
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:909
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
rs2_sensor * rs2_get_frame_sensor(const rs2_frame *frame, rs2_error **error)
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:143
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
Definition: rs_frame.hpp:661
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Definition: rs_frame.hpp:161
frame operator*()
Definition: rs_frame.hpp:1059
Definition: rs_frame.hpp:284
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:863
float y
Definition: rs_frame.hpp:653
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:990
Definition: rs_sensor.h:48
Definition: rs_types.h:145
frame(frame &&other) noexcept
Definition: rs_frame.hpp:348
Definition: rs_frame.hpp:857
bool is() const
Definition: rs_frame.hpp:91
void export_to_ply(const std::string &fname, video_frame texture)
Definition: rs_frame.hpp:706
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:428
bool is() const
Definition: rs_frame.hpp:512
size_t size() const
Definition: rs_frame.hpp:726
float u
Definition: rs_frame.hpp:657
video_frame get_color_frame() const
Definition: rs_frame.hpp:929
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs_processing.hpp:205
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:653
int fps() const
Definition: rs_frame.hpp:48
void reset()
Definition: rs_frame.hpp:553
iterator & operator++()
Definition: rs_frame.hpp:1055
struct rs2_sensor rs2_sensor
Definition: rs_types.h:227
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:833
void swap(frame &other)
Definition: rs_frame.hpp:383
Definition: rs_types.h:153
Definition: rs_frame.hpp:1051
frame & operator=(frame other)
Definition: rs_frame.hpp:360
Definition: rs_sensor.h:62
Definition: rs_frame.hpp:798
frame_callback(T on_frame)
Definition: rs_frame.hpp:1076
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
Definition: rs_frame.hpp:1072
rs2_vector get_motion_data() const
Definition: rs_frame.hpp:819
frame(rs2_frame *ref)
Definition: rs_frame.hpp:324
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:892
rs2::frame process(rs2::frame frame) const override
Definition: rs_processing.hpp:324
video_frame(const frame &f)
Definition: rs_frame.hpp:585
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:667
float get_distance(int x, int y) const
Definition: rs_frame.hpp:759
Definition: rs_processing.hpp:18
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:146
motion_frame(const frame &f)
Definition: rs_frame.hpp:805
~frame()
Definition: rs_frame.hpp:396
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:1038
Definition: rs_types.h:144
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
Definition: rs_types.h:107
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:152
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition: rs_frame.hpp:439
T as() const
Definition: rs_frame.hpp:102
T as() const
Definition: rs_frame.hpp:522
video_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:207
struct rs2_stream_profile rs2_stream_profile
Definition: rs_types.h:215
Definition: rs_sensor.h:57
virtual ~filter_interface()=default
rs2_format
A stream&#39;s format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:55
Definition: rs_processing.hpp:384
bool is_default() const
Definition: rs_frame.hpp:124
void keep()
Definition: rs_frame.hpp:407
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:946
const texture_coordinate * get_texture_coordinates() const
Definition: rs_frame.hpp:718
int get_bits_per_pixel() const
Definition: rs_frame.hpp:637
bool operator==(const iterator &other) const
Definition: rs_frame.hpp:1056
static void handle(rs2_error *e)
Definition: rs_types.hpp:121
Definition: rs_sensor.h:41
rs2_sensor * get_sensor()
Definition: rs_frame.hpp:420
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:38
Definition: rs_processing.hpp:315
int get_height() const
Definition: rs_frame.hpp:613
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:136
bool _default
Definition: rs_frame.hpp:197
Definition: rs_frame.hpp:768
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:475
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Definition: rs_sensor.h:84
Definition: rs_types.h:142
iterator end() const
Definition: rs_frame.hpp:1066
iterator(const frameset *owner, size_t index=0)
Definition: rs_frame.hpp:1054
bool is_cloned()
Definition: rs_frame.hpp:168
3D vector in Euclidean coordinate space
Definition: rs_types.h:96
virtual rs2::frame process(rs2::frame frame) const =0
int get_width() const
Definition: rs_frame.hpp:601
const void * get_data() const
Definition: rs_frame.hpp:487
const char * rs2_stream_to_string(rs2_stream stream)
void on_frame(rs2_frame *fref) override
Definition: rs_frame.hpp:1078
Definition: rs_sensor.h:40
long long rs2_metadata_type
Definition: rs_types.h:239
points(const frame &f)
Definition: rs_frame.hpp:673
Definition: rs_frame.hpp:306
Definition: rs_types.h:149
int get_stride_in_bytes() const
Definition: rs_frame.hpp:625
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
disparity_frame(const frame &f)
Definition: rs_frame.hpp:775
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:57
Definition: rs_processing.hpp:569
int height() const
Definition: rs_frame.hpp:229
rs2_pose get_pose_data() const
Definition: rs_frame.hpp:847
bool operator!=(const iterator &other) const
Definition: rs_frame.hpp:1057
bool operator==(const stream_profile &rhs)
Definition: rs_frame.hpp:78
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:70
depth_frame get_depth_frame() const
Definition: rs_frame.hpp:920
Definition: rs_processing.hpp:115
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:451
frameset(const frame &f)
Definition: rs_frame.hpp:868
Definition: rs_frame.hpp:656
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
size_t size() const
Definition: rs_frame.hpp:1011
Definition: rs_types.h:154
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs_types.h:155
struct rs2_error rs2_error
Definition: rs_types.h:205
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:463
rs2_stream stream_type() const
Definition: rs_frame.hpp:38
float x
Definition: rs_frame.hpp:653
Definition: rs_frame.hpp:200
Definition: rs_frame.hpp:826
frame(const frame &other)
Definition: rs_frame.hpp:370
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:968
rs2_frame * get() const
Definition: rs_frame.hpp:532
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
frame()
Definition: rs_frame.hpp:319
float v
Definition: rs_frame.hpp:657
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 is the set of read-only properties that might be exposed for each individual frame...
Definition: rs_frame.h:29
struct rs2_frame rs2_frame
Definition: rs_types.h:207
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
float get_baseline(void) const
Definition: rs_frame.hpp:789
pose_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:291
rs2_stream _type
Definition: rs_frame.hpp:195
Definition: rs_frame.hpp:652
stream_profile get_profile() const
Definition: rs_frame.hpp:499
const vertex * get_vertices() const
Definition: rs_frame.hpp:693
Definition: rs_frame.hpp:735
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