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);
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 
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;
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;
243  error::handle(e);
244  return intr;
245  }
246 
247  bool operator==(const video_stream_profile& other) const
248  {
249  return (((stream_profile&)*this)==other &&
250  width() == other.width() &&
251  height() == other.height());
252  }
253 
254  using stream_profile::clone;
255 
267  {
268  rs2_error* e = nullptr;
269  auto ref = rs2_clone_video_stream_profile(_profile, type, index, format, width, height, &intr, &e);
270  error::handle(e);
272  res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
273 
274  return res;
275  }
276  private:
277  int _width = 0;
278  int _height = 0;
279  };
280 
281 
283  {
284  public:
290  : stream_profile(sp)
291  {
292  rs2_error* e = nullptr;
293  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_MOTION_PROFILE, &e) == 0 && !e))
294  {
295  _profile = nullptr;
296  }
297  error::handle(e);
298  }
299 
305  {
306  rs2_error* e = nullptr;
308  rs2_get_motion_intrinsics(_profile, &intrin, &e);
309  error::handle(e);
310  return intrin;
311  }
312  };
313 
315  {
316  public:
322  : stream_profile(sp)
323  {
324  rs2_error* e = nullptr;
325  if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_POSE_PROFILE, &e) == 0 && !e))
326  {
327  _profile = nullptr;
328  }
329  error::handle(e);
330  }
331  };
332 
337  {
338  public:
339  virtual rs2::frame process(rs2::frame frame) const = 0;
340  virtual ~filter_interface() = default;
341  };
342 
343  class frame
344  {
345  public:
349  frame() : frame_ref(nullptr) {}
354  frame(rs2_frame* ref) : frame_ref(ref)
355  {
356 #ifdef _DEBUG
357  if (ref)
358  {
359  rs2_error* e = nullptr;
360  auto r = rs2_get_frame_number(ref, &e);
361  if (!e)
362  frame_number = r;
363  auto s = rs2_get_frame_stream_profile(ref, &e);
364  if (!e)
366  }
367  else
368  {
369  frame_number = 0;
371  }
372 #endif
373  }
378  frame(frame&& other) noexcept : frame_ref(other.frame_ref)
379  {
380  other.frame_ref = nullptr;
381 #ifdef _DEBUG
382  frame_number = other.frame_number;
383  profile = other.profile;
384 #endif
385  }
391  {
392  swap(other);
393  return *this;
394  }
395 
400  frame(const frame& other)
401  : frame_ref(other.frame_ref)
402  {
403  if (frame_ref) add_ref();
404 #ifdef _DEBUG
405  frame_number = other.frame_number;
406  profile = other.profile;
407 #endif
408  }
413  void swap(frame& other)
414  {
415  std::swap(frame_ref, other.frame_ref);
416 
417 #ifdef _DEBUG
418  std::swap(frame_number, other.frame_number);
419  std::swap(profile, other.profile);
420 #endif
421  }
422 
427  {
428  if (frame_ref)
429  {
430  rs2_release_frame(frame_ref);
431  }
432  }
433 
437  void keep() { rs2_keep_frame(frame_ref); }
438 
443  operator bool() const { return frame_ref != nullptr; }
444 
446  {
447  rs2_error* e = nullptr;
448  auto r = rs2_get_frame_sensor(frame_ref, &e);
449  error::handle(e);
450  return r;
451  }
452 
474  double get_timestamp() const
475  {
476  rs2_error* e = nullptr;
477  auto r = rs2_get_frame_timestamp(frame_ref, &e);
478  error::handle(e);
479  return r;
480  }
481 
486  {
487  rs2_error* e = nullptr;
488  auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
489  error::handle(e);
490  return r;
491  }
492 
498  {
499  rs2_error* e = nullptr;
500  auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
501  error::handle(e);
502  return r;
503  }
504 
510  {
511  rs2_error* e = nullptr;
512  auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
513  error::handle(e);
514  return r != 0;
515  }
516 
521  unsigned long long get_frame_number() const
522  {
523  rs2_error* e = nullptr;
524  auto r = rs2_get_frame_number(frame_ref, &e);
525  error::handle(e);
526  return r;
527  }
528 
533  const int get_data_size() const
534  {
535  rs2_error* e = nullptr;
536  auto r = rs2_get_frame_data_size(frame_ref, &e);
537  error::handle(e);
538  return r;
539  }
540 
545  const void* get_data() const
546  {
547  rs2_error* e = nullptr;
548  auto r = rs2_get_frame_data(frame_ref, &e);
549  error::handle(e);
550  return r;
551  }
552 
558  {
559  rs2_error* e = nullptr;
560  auto s = rs2_get_frame_stream_profile(frame_ref, &e);
561  error::handle(e);
562  return stream_profile(s);
563  }
564 
569  template<class T>
570  bool is() const
571  {
572  T extension(*this);
573  return extension;
574  }
579  template<class T>
580  T as() const
581  {
582  T extension(*this);
583  return extension;
584  }
585 
590  rs2_frame* get() const { return frame_ref; }
591  explicit operator rs2_frame*() { return frame_ref; }
592 
594  {
595  return filter.process(*this);
596  }
597 
598  protected:
604  void add_ref() const
605  {
606  rs2_error* e = nullptr;
607  rs2_frame_add_ref(frame_ref, &e);
608  error::handle(e);
609  }
610 
611  void reset()
612  {
613  if (frame_ref)
614  {
615  rs2_release_frame(frame_ref);
616  }
617  frame_ref = nullptr;
618  }
619 
620  private:
621  friend class rs2::frame_source;
622  friend class rs2::frame_queue;
623  friend class rs2::syncer;
624  friend class rs2::processing_block;
625  friend class rs2::pointcloud;
626  friend class rs2::points;
627 
629 
630 #ifdef _DEBUG
632  unsigned long long frame_number = 0;
633 #endif
634  };
635 
636  class video_frame : public frame
637  {
638  public:
644  : frame(f)
645  {
646  rs2_error* e = nullptr;
647  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
648  {
649  reset();
650  }
651  error::handle(e);
652  }
653 
654 
659  int get_width() const
660  {
661  rs2_error* e = nullptr;
662  auto r = rs2_get_frame_width(get(), &e);
663  error::handle(e);
664  return r;
665  }
666 
671  int get_height() const
672  {
673  rs2_error* e = nullptr;
674  auto r = rs2_get_frame_height(get(), &e);
675  error::handle(e);
676  return r;
677  }
678 
684  {
685  rs2_error* e = nullptr;
686  auto r = rs2_get_frame_stride_in_bytes(get(), &e);
687  error::handle(e);
688  return r;
689  }
690 
695  int get_bits_per_pixel() const
696  {
697  rs2_error* e = nullptr;
698  auto r = rs2_get_frame_bits_per_pixel(get(), &e);
699  error::handle(e);
700  return r;
701  }
702 
707  int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
708 
717  bool extract_target_dimensions(rs2_calib_target_type calib_type, float* target_dims, unsigned int target_dims_size) const
718  {
719  rs2_error* e = nullptr;
720  rs2_extract_target_dimensions(get(), calib_type, target_dims, target_dims_size, &e);
721  error::handle(e);
722  return (e == nullptr);
723  }
724  };
725 
726  struct vertex {
727  float x, y, z;
728  operator const float*() const { return &x; }
729  };
731  float u, v;
732  operator const float*() const { return &u; }
733  };
734 
735  class points : public frame
736  {
737  public:
741  points() : frame(), _size(0) {}
742 
747  points(const frame& f)
748  : frame(f), _size(0)
749  {
750  rs2_error* e = nullptr;
751  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
752  {
753  reset();
754  }
755  error::handle(e);
756 
757  if (get())
758  {
759  _size = rs2_get_frame_points_count(get(), &e);
760  error::handle(e);
761  }
762  }
767  const vertex* get_vertices() const
768  {
769  rs2_error* e = nullptr;
770  auto res = rs2_get_frame_vertices(get(), &e);
771  error::handle(e);
772  return (const vertex*)res;
773  }
774 
781  {
782  rs2_frame* ptr = nullptr;
783  std::swap(texture.frame_ref, ptr);
784  rs2_error* e = nullptr;
785  rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
786  error::handle(e);
787  }
793  {
794  rs2_error* e = nullptr;
795  auto res = rs2_get_frame_texture_coordinates(get(), &e);
796  error::handle(e);
797  return (const texture_coordinate*)res;
798  }
799 
800  size_t size() const
801  {
802  return _size;
803  }
804 
805  private:
806  size_t _size;
807  };
808 
809  class depth_frame : public video_frame
810  {
811  public:
817  : video_frame(f)
818  {
819  rs2_error* e = nullptr;
820  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
821  {
822  reset();
823  }
824  error::handle(e);
825  }
826 
833  float get_distance(int x, int y) const
834  {
835  rs2_error * e = nullptr;
836  auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
837  error::handle(e);
838  return r;
839  }
840 
845  float get_units() const
846  {
847  rs2_error * e = nullptr;
848  auto r = rs2_depth_frame_get_units( get(), &e );
849  error::handle( e );
850  return r;
851  }
852  };
853 
855  {
856  public:
862  : depth_frame(f)
863  {
864  rs2_error* e = nullptr;
865  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
866  {
867  reset();
868  }
869  error::handle(e);
870  }
875  float get_baseline(void) const
876  {
877  rs2_error * e = nullptr;
878  auto r = rs2_depth_stereo_frame_get_baseline(get(), &e);
879  error::handle(e);
880  return r;
881  }
882  };
883 
884  class motion_frame : public frame
885  {
886  public:
892  : frame(f)
893  {
894  rs2_error* e = nullptr;
895  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
896  {
897  reset();
898  }
899  error::handle(e);
900  }
906  {
907  auto data = reinterpret_cast<const float*>(get_data());
908  return rs2_vector{ data[0], data[1], data[2] };
909  }
910  };
911 
912  class pose_frame : public frame
913  {
914  public:
920  : frame(f)
921  {
922  rs2_error* e = nullptr;
923  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
924  {
925  reset();
926  }
927  error::handle(e);
928  }
934  {
935  rs2_pose pose_data;
936  rs2_error* e = nullptr;
937  rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
938  error::handle(e);
939  return pose_data;
940  }
941  };
942 
943  class frameset : public frame
944  {
945  public:
949  frameset() :_size(0) {};
954  frameset(const frame& f)
955  : frame(f), _size(0)
956  {
957  rs2_error* e = nullptr;
958  if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
959  {
960  reset();
961  // TODO - consider explicit constructor to move resultion to compile time
962  }
963  error::handle(e);
964 
965  if (get())
966  {
967  _size = rs2_embedded_frames_count(get(), &e);
968  error::handle(e);
969  }
970  }
971 
979  {
980  frame result;
981  foreach_rs([&result, s, f](frame frm) {
982  if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
983  {
984  result = std::move(frm);
985  }
986  });
987  return result;
988  }
996  {
997  auto frm = first_or_default(s, f);
998  if (!frm) throw error("Frame of requested stream type was not found!");
999  return frm;
1000  }
1001 
1007  {
1008  auto f = first_or_default(RS2_STREAM_DEPTH, RS2_FORMAT_Z16);
1009  return f.as<depth_frame>();
1010  }
1016  {
1017  auto f = first_or_default(RS2_STREAM_COLOR);
1018 
1019  if (!f)
1020  {
1021  auto ir = first_or_default(RS2_STREAM_INFRARED);
1022  if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
1023  f = ir;
1024  }
1025  return f;
1026  }
1032  video_frame get_infrared_frame(const size_t index = 0) const
1033  {
1034  frame f;
1035  if (!index)
1036  {
1037  f = first_or_default(RS2_STREAM_INFRARED);
1038  }
1039  else
1040  {
1041  foreach_rs([&f, index](const frame& frm) {
1042  if (frm.get_profile().stream_type() == RS2_STREAM_INFRARED &&
1043  frm.get_profile().stream_index() == index) f = frm;
1044  });
1045  }
1046  return f;
1047  }
1048 
1054  video_frame get_fisheye_frame(const size_t index = 0) const
1055  {
1056  frame f;
1057  if (!index)
1058  {
1059  f = first_or_default(RS2_STREAM_FISHEYE);
1060  }
1061  else
1062  {
1063  foreach_rs([&f, index](const frame& frm) {
1064  if (frm.get_profile().stream_type() == RS2_STREAM_FISHEYE &&
1065  frm.get_profile().stream_index() == index) f = frm;
1066  });
1067  }
1068  return f;
1069  }
1070 
1076  pose_frame get_pose_frame(const size_t index = 0) const
1077  {
1078  frame f;
1079  if (!index)
1080  {
1081  f = first_or_default(RS2_STREAM_POSE);
1082  }
1083  else
1084  {
1085  foreach_rs([&f, index](const frame& frm) {
1086  if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1087  frm.get_profile().stream_index() == index) f = frm;
1088  });
1089  }
1090  return f.as<pose_frame>();
1091  }
1092 
1097  size_t size() const
1098  {
1099  return _size;
1100  }
1101 
1106  template<class T>
1107  void foreach_rs(T action) const
1108  {
1109  rs2_error* e = nullptr;
1110  auto count = size();
1111  for (size_t i = 0; i < count; i++)
1112  {
1113  auto fref = rs2_extract_frame(get(), (int)i, &e);
1114  error::handle(e);
1115 
1116  action(frame(fref));
1117  }
1118  }
1124  frame operator[](size_t index) const
1125  {
1126  rs2_error* e = nullptr;
1127  if (index < size())
1128  {
1129  auto fref = rs2_extract_frame(get(), (int)index, &e);
1130  error::handle(e);
1131  return frame(fref);
1132  }
1133 
1134  throw error("Requested index is out of range!");
1135  }
1136 
1137  class iterator : public std::iterator<std::forward_iterator_tag, frame>
1138  {
1139  public:
1140  iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1141  iterator& operator++() { ++_index; return *this; }
1142  bool operator==(const iterator& other) const { return _index == other._index; }
1143  bool operator!=(const iterator& other) const { return !(*this == other); }
1144 
1145  frame operator*() { return (*_owner)[_index]; }
1146  private:
1147  size_t _index = 0;
1149  };
1150 
1151  iterator begin() const { return iterator(this); }
1152  iterator end() const { return iterator(this, size()); }
1153  private:
1154  size_t _size;
1155  };
1156 
1157  template<class T>
1159  {
1161  public:
1162  explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1163 
1164  void on_frame(rs2_frame* fref) override
1165  {
1166  on_frame_function(frame{ fref });
1167  }
1168 
1169  void release() override { delete this; }
1170  };
1171 }
1172 #endif // LIBREALSENSE_RS2_FRAME_HPP
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
Definition: rs.cpp:1125
frame apply_filter(filter_interface &filter)
Definition: rs_frame.hpp:593
depth_frame(const frame &f)
Definition: rs_frame.hpp:816
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, rs2_error **error)
Definition: rs.cpp:2162
float rs2_depth_frame_get_units(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2356
GLint y
void release() override
Definition: rs_frame.hpp:1169
::realsense_legacy_msgs::extrinsics_< std::allocator< void > > extrinsics
Definition: extrinsics.h:59
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2179
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:971
rs2_frame * get() const
Definition: rs_frame.hpp:590
rs2_sensor * rs2_get_frame_sensor(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:922
GLdouble s
rs2_motion_device_intrinsic get_motion_intrinsics() const
Definition: rs_frame.hpp:304
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
Definition: rs.cpp:1461
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
Definition: rs.cpp:466
GLboolean reset
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Definition: rs_frame.hpp:162
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:497
void rs2_keep_frame(rs2_frame *frame)
Definition: rs.cpp:1000
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
Definition: rs.cpp:1110
rs2_extrinsics get_extrinsics_to(const stream_profile &to) const
Definition: rs_frame.hpp:148
stream_profile get_profile() const
Definition: rs_frame.hpp:557
bool operator!=(const iterator &other) const
Definition: rs_frame.hpp:1143
frame operator[](size_t index) const
Definition: rs_frame.hpp:1124
bool operator==(const iterator &other) const
Definition: rs_frame.hpp:1142
rs2_calib_target_type
Calibration target type.
Definition: rs_frame.h:74
std::function< void(frame_interface *)> on_frame
Definition: streaming.h:164
int get_bytes_per_pixel() const
Definition: rs_frame.hpp:707
float get_units() const
Definition: rs_frame.hpp:845
rs2_intrinsics intrin
frame(frame &&other) noexcept
Definition: rs_frame.hpp:378
const void * get_data() const
Definition: rs_frame.hpp:545
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition: rs_frame.hpp:509
void export_to_ply(const std::string &fname, video_frame texture)
Definition: rs_frame.hpp:780
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:908
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
Definition: rs.cpp:1504
Definition: cah-model.h:10
std::string stream_name() const
Definition: rs_frame.hpp:113
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2171
GLsizei const GLchar *const * string
void add_ref() const
Definition: rs_frame.hpp:604
bool is() const
Definition: rs_frame.hpp:92
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs.cpp:838
e
Definition: rmse.py:177
rs2_stream_profile * rs2_clone_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, rs2_error **error)
Definition: rs.cpp:519
const texture_coordinate * get_texture_coordinates() const
Definition: rs_frame.hpp:792
rs2_pose get_pose_data() const
Definition: rs_frame.hpp:933
The texture class.
Definition: example.hpp:402
void reset()
Definition: rs_frame.hpp:611
iterator & operator++()
Definition: rs_frame.hpp:1141
rs2_frame * frame_ref
Definition: rs_frame.hpp:628
GLuint index
depth_frame get_depth_frame() const
Definition: rs_frame.hpp:1006
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:955
std::shared_ptr< rs2_stream_profile > _clone
Definition: rs_frame.hpp:190
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:978
pose_frame(const frame &f)
Definition: rs_frame.hpp:919
void swap(frame &other)
Definition: rs_frame.hpp:413
size_t size() const
Definition: rs_frame.hpp:800
bool extract_target_dimensions(rs2_calib_target_type calib_type, float *target_dims, unsigned int target_dims_size) const
Definition: rs_frame.hpp:717
frame & operator=(frame other)
Definition: rs_frame.hpp:390
video_frame get_color_frame() const
Definition: rs_frame.hpp:1015
frame_callback(T on_frame)
Definition: rs_frame.hpp:1162
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:963
frame(rs2_frame *ref)
Definition: rs_frame.hpp:354
const rs2_stream_profile * _profile
Definition: rs_frame.hpp:189
GLdouble f
bool is() const
Definition: rs_frame.hpp:570
video_frame(const frame &f)
Definition: rs_frame.hpp:643
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)
Definition: rs.cpp:484
rs2_vector get_motion_data() const
Definition: rs_frame.hpp:905
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition: rs_frame.hpp:995
GLsizeiptr size
video_frame get_fisheye_frame(const size_t index=0) const
Definition: rs_frame.hpp:1054
const frameset * _owner
Definition: rs_frame.hpp:1148
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
Definition: rs.cpp:2144
int rs2_is_stream_profile_default(const rs2_stream_profile *mode, rs2_error **error)
Definition: rs.cpp:477
pose_frame get_pose_frame(const size_t index=0) const
Definition: rs_frame.hpp:1076
motion_frame(const frame &f)
Definition: rs_frame.hpp:891
GLdouble GLdouble r
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:947
GLdouble x
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
Definition: rs.cpp:2346
double get_timestamp() const
Definition: rs_frame.hpp:474
def pointcloud(out, verts, texcoords, color, painter=True)
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
Definition: rs.cpp:915
rs2_format _format
Definition: rs_frame.hpp:195
void rs2_delete_stream_profile(rs2_stream_profile *mode)
Definition: rs.cpp:512
GLint GLsizei GLsizei height
float get_baseline(void) const
Definition: rs_frame.hpp:875
motion_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:289
GLint GLint GLsizei GLint GLenum format
const vertex * get_vertices() const
Definition: rs_frame.hpp:767
video_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:208
rs2_format
A stream&#39;s format identifies how binary data is encoded within a frame.
Definition: rs_sensor.h:59
bool is_default() const
Definition: rs_frame.hpp:125
void keep()
Definition: rs_frame.hpp:437
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:986
int stream_index() const
Definition: rs_frame.hpp:34
iterator end() const
Definition: rs_frame.hpp:1152
iterator begin() const
Definition: rs_frame.hpp:1151
action
Definition: enums.py:62
rs2_intrinsics get_intrinsics() const
Definition: rs_frame.hpp:238
void swap(nlohmann::json &j1, nlohmann::json &j2) noexcept(is_nothrow_move_constructible< nlohmann::json >::value andis_nothrow_move_assignable< nlohmann::json >::value)
exchanges the values of two JSON objects
Definition: json.hpp:12141
static void handle(rs2_error *e)
Definition: rs_types.hpp:144
rs2_sensor * get_sensor()
Definition: rs_frame.hpp:445
int rs2_get_frame_data_size(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:933
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition: rs_sensor.h:42
void rs2_extract_target_dimensions(const rs2_frame *frame, rs2_calib_target_type calib_type, float *target_dims, unsigned int target_dims_size, rs2_error **error)
Definition: rs.cpp:2402
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
Definition: rs.cpp:374
void foreach_rs(T action) const
Definition: rs_frame.hpp:1107
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented...
Definition: rs_sensor.h:96
stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics &intr) const
Definition: rs_frame.hpp:266
iterator(const frameset *owner, size_t index=0)
Definition: rs_frame.hpp:1140
rs2_format format() const
Definition: rs_frame.hpp:44
3D vector in Euclidean coordinate space
Definition: rs_types.h:129
fname
Definition: rmse.py:13
float get_distance(int x, int y) const
Definition: rs_frame.hpp:833
virtual rs2::frame process(rs2::frame frame) const =0
const char * rs2_stream_to_string(rs2_stream stream)
Definition: rs.cpp:1262
void on_frame(rs2_frame *fref) override
Definition: rs_frame.hpp:1164
long long rs2_metadata_type
Definition: rs_types.h:301
GLenum type
points(const frame &f)
Definition: rs_frame.hpp:747
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition: rs_frame.hpp:485
int get_height() const
Definition: rs_frame.hpp:671
const rs2_stream_profile * get() const
Definition: rs_frame.hpp:137
GLint GLsizei count
int get_bits_per_pixel() const
Definition: rs_frame.hpp:695
GLint ref
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:2154
disparity_frame(const frame &f)
Definition: rs_frame.hpp:861
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:1015
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
Video stream intrinsics.
Definition: rs_types.h:58
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)
Definition: rs.cpp:533
bool operator==(const stream_profile &rhs)
Definition: rs_frame.hpp:79
Motion device intrinsics: scale, bias, and variances.
Definition: rs_types.h:103
const int get_data_size() const
Definition: rs_frame.hpp:533
video_frame get_infrared_frame(const size_t index=0) const
Definition: rs_frame.hpp:1032
int i
GLuint res
Definition: glext.h:8856
float rs2_depth_stereo_frame_get_baseline(const rs2_frame *frame_ref, rs2_error **error)
Definition: rs.cpp:2364
stream_profile(const rs2_stream_profile *profile)
Definition: rs_frame.hpp:170
void rs2_release_frame(rs2_frame *frame)
Definition: rs.cpp:993
frameset(const frame &f)
Definition: rs_frame.hpp:954
int unique_id() const
Definition: rs_frame.hpp:54
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
Definition: rs.cpp:2114
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
Definition: rs.cpp:846
unsigned long long get_frame_number() const
Definition: rs_frame.hpp:521
int get_stride_in_bytes() const
Definition: rs_frame.hpp:683
frame(const frame &other)
Definition: rs_frame.hpp:400
size_t size() const
Definition: rs_frame.hpp:1097
rs2_stream stream_type() const
Definition: rs_frame.hpp:39
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
Definition: rs.cpp:455
GLuint64EXT * result
Definition: glext.h:10921
bool operator==(const video_stream_profile &other) const
Definition: rs_frame.hpp:247
size_t _size
Definition: rs_frame.hpp:806
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
Definition: rs.cpp:2372
stream_profile clone(rs2_stream type, int index, rs2_format format) const
Definition: rs_frame.hpp:63
int get_width() const
Definition: rs_frame.hpp:659
int fps() const
Definition: rs_frame.hpp:49
Definition: parser.hpp:150
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:978
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:261
GLint GLsizei width
GLdouble GLdouble GLint GLint const GLdouble * points
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
Definition: rs.cpp:940
pose_stream_profile(const stream_profile &sp)
Definition: rs_frame.hpp:321
rs2_stream _type
Definition: rs_frame.hpp:196
T as() const
Definition: rs_frame.hpp:580
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition: rs_frame.h:19


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:40