Intel® RealSense™ Cross Platform API
Intel Realsense Cross-platform API
Loading...
Searching...
No Matches
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
9namespace 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;
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);
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 }
156
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;
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:
205
211 : stream_profile(sp)
212 {
213 rs2_error* e = nullptr;
214 if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_VIDEO_PROFILE, &e) == 0 && !e))
215 {
216 _profile = nullptr;
217 }
218 error::handle(e);
219
220 if (_profile)
221 {
222 rs2_get_video_stream_resolution(_profile, &_width, &_height, &e);
223 error::handle(e);
224 }
225 }
226
227 int width() const
228 {
229 return _width;
230 }
231
232 int height() const
233 {
234 return _height;
235 }
236
241 {
242 rs2_error* e = nullptr;
243 rs2_intrinsics intr;
245 error::handle(e);
246 return intr;
247 }
248
249 bool operator==(const video_stream_profile& other) const
250 {
251 return (((stream_profile&)*this)==other &&
252 width() == other.width() &&
253 height() == other.height());
254 }
255
257
268 stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics& intr) const
269 {
270 rs2_error* e = nullptr;
271 auto ref = rs2_clone_video_stream_profile(_profile, type, index, format, width, height, &intr, &e);
272 error::handle(e);
273 stream_profile res(ref);
274 res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
275
276 return res;
277 }
278 private:
279 int _width = 0;
280 int _height = 0;
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_MOTION_PROFILE, &e) == 0 && !e))
296 {
297 _profile = nullptr;
298 }
299 error::handle(e);
300 }
301
307 {
308 rs2_error* e = nullptr;
311 error::handle(e);
312 return intrin;
313 }
314 };
315
317 {
318 public:
324 : stream_profile(sp)
325 {
326 rs2_error* e = nullptr;
327 if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_POSE_PROFILE, &e) == 0 && !e))
328 {
329 _profile = nullptr;
330 }
331 error::handle(e);
332 }
333 };
334
339 {
340 public:
341 virtual rs2::frame process(rs2::frame frame) const = 0;
342 virtual ~filter_interface() = default;
343 };
344
345 class frame
346 {
347 public:
351 frame() : frame_ref(nullptr) {}
356 frame(rs2_frame* ref) : frame_ref(ref)
357 {
358#ifdef _DEBUG
359 if (ref)
360 {
361 rs2_error* e = nullptr;
362 auto r = rs2_get_frame_number(ref, &e);
363 if (!e)
364 frame_number = r;
365 auto s = rs2_get_frame_stream_profile(ref, &e);
366 if (!e)
367 profile = stream_profile(s);
368 }
369 else
370 {
371 frame_number = 0;
372 profile = stream_profile();
373 }
374#endif
375 }
376
380 frame(frame&& other) noexcept : frame_ref(other.frame_ref)
381 {
382 other.frame_ref = nullptr;
383#ifdef _DEBUG
384 frame_number = other.frame_number;
385 profile = other.profile;
386#endif
387 }
388
393 {
394 swap(other);
395 return *this;
396 }
397
402 frame(const frame& other)
403 : frame_ref(other.frame_ref)
404 {
405 if (frame_ref) add_ref();
406#ifdef _DEBUG
407 frame_number = other.frame_number;
408 profile = other.profile;
409#endif
410 }
411
415 void swap(frame& other)
416 {
417 std::swap(frame_ref, other.frame_ref);
418
419#ifdef _DEBUG
420 std::swap(frame_number, other.frame_number);
421 std::swap(profile, other.profile);
422#endif
423 }
424
429 {
430 if (frame_ref)
431 {
432 rs2_release_frame(frame_ref);
433 }
434 }
435
439 void keep() { rs2_keep_frame(frame_ref); }
440
445 operator bool() const { return frame_ref != nullptr; }
446
448 {
449 rs2_error* e = nullptr;
450 auto r = rs2_get_frame_sensor(frame_ref, &e);
451 error::handle(e);
452 return r;
453 }
454
476 double get_timestamp() const
477 {
478 rs2_error* e = nullptr;
479 auto r = rs2_get_frame_timestamp(frame_ref, &e);
480 error::handle(e);
481 return r;
482 }
483
488 {
489 rs2_error* e = nullptr;
490 auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
491 error::handle(e);
492 return r;
493 }
494
500 {
501 rs2_error* e = nullptr;
502 auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
503 error::handle(e);
504 return r;
505 }
506
512 {
513 rs2_error* e = nullptr;
514 auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
515 error::handle(e);
516 return r != 0;
517 }
518
523 unsigned long long get_frame_number() const
524 {
525 rs2_error* e = nullptr;
526 auto r = rs2_get_frame_number(frame_ref, &e);
527 error::handle(e);
528 return r;
529 }
530
535 const int get_data_size() const
536 {
537 rs2_error* e = nullptr;
538 auto r = rs2_get_frame_data_size(frame_ref, &e);
539 error::handle(e);
540 return r;
541 }
542
547 const void* get_data() const
548 {
549 rs2_error* e = nullptr;
550 auto r = rs2_get_frame_data(frame_ref, &e);
551 error::handle(e);
552 return r;
553 }
554
560 {
561 rs2_error* e = nullptr;
562 auto s = rs2_get_frame_stream_profile(frame_ref, &e);
563 error::handle(e);
564 return stream_profile(s);
565 }
566
571 template<class T>
572 bool is() const
573 {
574 T extension(*this);
575 return extension;
576 }
577
581 template<class T>
582 T as() const
583 {
584 T extension(*this);
585 return extension;
586 }
587
592 rs2_frame* get() const { return frame_ref; }
593 explicit operator rs2_frame*() { return frame_ref; }
594
596 {
597 return filter.process(*this);
598 }
599
600 protected:
606 void add_ref() const
607 {
608 rs2_error* e = nullptr;
609 rs2_frame_add_ref(frame_ref, &e);
610 error::handle(e);
611 }
612
613 void reset()
614 {
615 if (frame_ref)
616 {
617 rs2_release_frame(frame_ref);
618 }
619 frame_ref = nullptr;
620 }
621
622 private:
623 friend class rs2::frame_source;
624 friend class rs2::frame_queue;
625 friend class rs2::syncer;
627 friend class rs2::pointcloud;
628 friend class rs2::points;
629
630 rs2_frame* frame_ref;
631
632#ifdef _DEBUG
633 stream_profile profile;
634 unsigned long long frame_number = 0;
635#endif
636 };
637
638 class video_frame : public frame
639 {
640 public:
646 : frame(f)
647 {
648 rs2_error* e = nullptr;
649 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
650 {
651 reset();
652 }
653 error::handle(e);
654 }
655
656
661 int get_width() const
662 {
663 rs2_error* e = nullptr;
664 auto r = rs2_get_frame_width(get(), &e);
665 error::handle(e);
666 return r;
667 }
668
673 int get_height() const
674 {
675 rs2_error* e = nullptr;
676 auto r = rs2_get_frame_height(get(), &e);
677 error::handle(e);
678 return r;
679 }
680
686 {
687 rs2_error* e = nullptr;
688 auto r = rs2_get_frame_stride_in_bytes(get(), &e);
689 error::handle(e);
690 return r;
691 }
692
698 {
699 rs2_error* e = nullptr;
700 auto r = rs2_get_frame_bits_per_pixel(get(), &e);
701 error::handle(e);
702 return r;
703 }
704
709 int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
710
721 bool extract_target_dimensions(rs2_calib_target_type calib_type, float* target_dims, unsigned int target_dims_size) const
722 {
723 rs2_error* e = nullptr;
724 rs2_extract_target_dimensions(get(), calib_type, target_dims, target_dims_size, &e);
725 error::handle(e);
726 return (e == nullptr);
727 }
728 };
729
730 struct vertex {
731 float x, y, z;
732 operator const float*() const { return &x; }
733 };
735 float u, v;
736 operator const float*() const { return &u; }
737 };
738
739 class points : public frame
740 {
741 public:
745 points() : frame(), _size(0) {}
746
751 points(const frame& f)
752 : frame(f), _size(0)
753 {
754 rs2_error* e = nullptr;
755 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
756 {
757 reset();
758 }
759 error::handle(e);
760
761 if (get())
762 {
763 _size = rs2_get_frame_points_count(get(), &e);
764 error::handle(e);
765 }
766 }
767
771 const vertex* get_vertices() const
772 {
773 rs2_error* e = nullptr;
774 auto res = rs2_get_frame_vertices(get(), &e);
775 error::handle(e);
776 return (const vertex*)res;
777 }
778
784 void export_to_ply(const std::string& fname, video_frame texture)
785 {
786 rs2_frame* ptr = nullptr;
787 std::swap(texture.frame_ref, ptr);
788 rs2_error* e = nullptr;
789 rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
790 error::handle(e);
791 }
792
797 {
798 rs2_error* e = nullptr;
799 auto res = rs2_get_frame_texture_coordinates(get(), &e);
800 error::handle(e);
801 return (const texture_coordinate*)res;
802 }
803
804 size_t size() const
805 {
806 return _size;
807 }
808
809 private:
810 size_t _size;
811 };
812
814 {
815 public:
821 : video_frame(f)
822 {
823 rs2_error* e = nullptr;
824 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
825 {
826 reset();
827 }
828 error::handle(e);
829 }
830
837 float get_distance(int x, int y) const
838 {
839 rs2_error * e = nullptr;
840 auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
841 error::handle(e);
842 return r;
843 }
844
849 float get_units() const
850 {
851 rs2_error * e = nullptr;
852 auto r = rs2_depth_frame_get_units( get(), &e );
853 error::handle( e );
854 return r;
855 }
856 };
857
859 {
860 public:
866 : depth_frame(f)
867 {
868 rs2_error* e = nullptr;
869 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
870 {
871 reset();
872 }
873 error::handle(e);
874 }
875
879 float get_baseline(void) const
880 {
881 rs2_error * e = nullptr;
883 error::handle(e);
884 return r;
885 }
886 };
887
888 class motion_frame : public frame
889 {
890 public:
896 : frame(f)
897 {
898 rs2_error* e = nullptr;
899 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
900 {
901 reset();
902 }
903 error::handle(e);
904 }
905
911 {
912 auto data = reinterpret_cast<const float*>(get_data());
913 return rs2_vector{ data[0], data[1], data[2] };
914 }
915
921 {
922 return *reinterpret_cast< rs2_combined_motion const * >( get_data() );
923 }
924 };
925
926 class pose_frame : public frame
927 {
928 public:
934 : frame(f)
935 {
936 rs2_error* e = nullptr;
937 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
938 {
939 reset();
940 }
941 error::handle(e);
942 }
943
948 {
949 rs2_pose pose_data;
950 rs2_error* e = nullptr;
951 rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
952 error::handle(e);
953 return pose_data;
954 }
955 };
956
957 class frameset : public frame
958 {
959 public:
963 frameset() :_size(0) {};
968 frameset(const frame& f)
969 : frame(f), _size(0)
970 {
971 rs2_error* e = nullptr;
972 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
973 {
974 reset();
975 // TODO - consider explicit constructor to move resultion to compile time
976 }
977 error::handle(e);
978
979 if (get())
980 {
981 _size = rs2_embedded_frames_count(get(), &e);
982 error::handle(e);
983 }
984 }
985
993 {
994 frame result;
995 foreach_rs([&result, s, f](frame frm) {
996 if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
997 {
998 result = std::move(frm);
999 }
1000 });
1001 return result;
1002 }
1003
1010 {
1011 auto frm = first_or_default(s, f);
1012 if (!frm) throw error("Frame of requested stream type was not found!");
1013 return frm;
1014 }
1015
1021 {
1023 return f.as<depth_frame>();
1024 }
1025
1030 {
1032
1033 if (!f)
1034 {
1036 if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
1037 f = ir;
1038 }
1039 return f;
1040 }
1041
1046 video_frame get_infrared_frame(const size_t index = 0) const
1047 {
1048 frame f;
1049 if (!index)
1050 {
1052 }
1053 else
1054 {
1055 foreach_rs([&f, index](const frame& frm) {
1057 frm.get_profile().stream_index() == index) f = frm;
1058 });
1059 }
1060 return f;
1061 }
1062
1068 video_frame get_fisheye_frame(const size_t index = 0) const
1069 {
1070 frame f;
1071 if (!index)
1072 {
1074 }
1075 else
1076 {
1077 foreach_rs([&f, index](const frame& frm) {
1079 frm.get_profile().stream_index() == index) f = frm;
1080 });
1081 }
1082 return f;
1083 }
1084
1090 pose_frame get_pose_frame(const size_t index = 0) const
1091 {
1092 frame f;
1093 if (!index)
1094 {
1096 }
1097 else
1098 {
1099 foreach_rs([&f, index](const frame& frm) {
1100 if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1101 frm.get_profile().stream_index() == index) f = frm;
1102 });
1103 }
1104 return f.as<pose_frame>();
1105 }
1106
1111 size_t size() const
1112 {
1113 return _size;
1114 }
1115
1120 template<class T>
1121 void foreach_rs(T action) const
1122 {
1123 rs2_error* e = nullptr;
1124 auto count = size();
1125 for (size_t i = 0; i < count; i++)
1126 {
1127 auto fref = rs2_extract_frame(get(), (int)i, &e);
1128 error::handle(e);
1129
1130 action(frame(fref));
1131 }
1132 }
1133
1138 frame operator[](size_t index) const
1139 {
1140 rs2_error* e = nullptr;
1141 if (index < size())
1142 {
1143 auto fref = rs2_extract_frame(get(), (int)index, &e);
1144 error::handle(e);
1145 return frame(fref);
1146 }
1147
1148 throw error("Requested index is out of range!");
1149 }
1150
1152 {
1153 public:
1154 // inheriting from std::iterator template is deprecated in C++17, this is the new way to define an iterator
1155 // go to https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/ for more info
1156 using iterator_category = std::forward_iterator_tag;
1158 using difference_type = std::ptrdiff_t;
1159 using pointer = frame*;
1161
1162 iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1163 iterator& operator++() { ++_index; return *this; }
1164 bool operator==(const iterator& other) const { return _index == other._index; }
1165 bool operator!=(const iterator& other) const { return !(*this == other); }
1166
1167 frame operator*() { return (*_owner)[_index]; }
1168 private:
1169 size_t _index = 0;
1170 const frameset* _owner;
1171 };
1172
1173 iterator begin() const { return iterator(this); }
1174 iterator end() const { return iterator(this, size()); }
1175 private:
1176 size_t _size;
1177 };
1178
1179 template<class T>
1181 {
1182 T on_frame_function;
1183 public:
1184 explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1185
1186 void on_frame(rs2_frame* fref) override
1187 {
1188 on_frame_function(frame{ fref });
1189 }
1190
1191 void release() override { delete this; }
1192 };
1193}
1194#endif // LIBREALSENSE_RS2_FRAME_HPP
Definition rs_frame.hpp:814
float get_units() const
Definition rs_frame.hpp:849
float get_distance(int x, int y) const
Definition rs_frame.hpp:837
depth_frame(const frame &f)
Definition rs_frame.hpp:820
disparity_frame(const frame &f)
Definition rs_frame.hpp:865
float get_baseline(void) const
Definition rs_frame.hpp:879
Definition rs_types.hpp:111
static void handle(rs2_error *e)
Definition rs_types.hpp:162
Definition rs_frame.hpp:339
virtual rs2::frame process(rs2::frame frame) const =0
virtual ~filter_interface()=default
Definition rs_processing.hpp:362
rs2::frame process(rs2::frame frame) const override
Definition rs_processing.hpp:370
void release() override
Definition rs_frame.hpp:1191
void on_frame(rs2_frame *fref) override
Definition rs_frame.hpp:1186
frame_callback(T on_frame)
Definition rs_frame.hpp:1184
Definition rs_processing.hpp:135
Definition rs_processing.hpp:19
Definition rs_frame.hpp:346
void reset()
Definition rs_frame.hpp:613
frame(rs2_frame *ref)
Definition rs_frame.hpp:356
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition rs_frame.hpp:487
frame & operator=(frame other)
Definition rs_frame.hpp:392
double get_timestamp() const
Definition rs_frame.hpp:476
frame(frame &&other) noexcept
Definition rs_frame.hpp:380
frame()
Definition rs_frame.hpp:351
frame(const frame &other)
Definition rs_frame.hpp:402
void keep()
Definition rs_frame.hpp:439
void swap(frame &other)
Definition rs_frame.hpp:415
frame apply_filter(filter_interface &filter)
Definition rs_frame.hpp:595
~frame()
Definition rs_frame.hpp:428
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition rs_frame.hpp:499
bool is() const
Definition rs_frame.hpp:572
stream_profile get_profile() const
Definition rs_frame.hpp:559
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition rs_frame.hpp:511
const int get_data_size() const
Definition rs_frame.hpp:535
T as() const
Definition rs_frame.hpp:582
const void * get_data() const
Definition rs_frame.hpp:547
unsigned long long get_frame_number() const
Definition rs_frame.hpp:523
rs2_sensor * get_sensor()
Definition rs_frame.hpp:447
rs2_frame * get() const
Definition rs_frame.hpp:592
void add_ref() const
Definition rs_frame.hpp:606
Definition rs_frame.hpp:1152
bool operator!=(const iterator &other) const
Definition rs_frame.hpp:1165
frame * pointer
Definition rs_frame.hpp:1159
iterator & operator++()
Definition rs_frame.hpp:1163
bool operator==(const iterator &other) const
Definition rs_frame.hpp:1164
iterator(const frameset *owner, size_t index=0)
Definition rs_frame.hpp:1162
std::ptrdiff_t difference_type
Definition rs_frame.hpp:1158
frame operator*()
Definition rs_frame.hpp:1167
frame value_type
Definition rs_frame.hpp:1157
frame & reference
Definition rs_frame.hpp:1160
std::forward_iterator_tag iterator_category
Definition rs_frame.hpp:1156
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:992
pose_frame get_pose_frame(const size_t index=0) const
Definition rs_frame.hpp:1090
video_frame get_fisheye_frame(const size_t index=0) const
Definition rs_frame.hpp:1068
video_frame get_infrared_frame(const size_t index=0) const
Definition rs_frame.hpp:1046
void foreach_rs(T action) const
Definition rs_frame.hpp:1121
iterator end() const
Definition rs_frame.hpp:1174
video_frame get_color_frame() const
Definition rs_frame.hpp:1029
frame operator[](size_t index) const
Definition rs_frame.hpp:1138
depth_frame get_depth_frame() const
Definition rs_frame.hpp:1020
frameset()
Definition rs_frame.hpp:963
iterator begin() const
Definition rs_frame.hpp:1173
frameset(const frame &f)
Definition rs_frame.hpp:968
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:1009
size_t size() const
Definition rs_frame.hpp:1111
motion_frame(const frame &f)
Definition rs_frame.hpp:895
rs2_combined_motion get_combined_motion_data() const
Definition rs_frame.hpp:920
rs2_vector get_motion_data() const
Definition rs_frame.hpp:910
motion_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:291
rs2_motion_device_intrinsic get_motion_intrinsics() const
Definition rs_frame.hpp:306
Definition rs_pipeline.hpp:19
Definition rs_processing.hpp:431
Definition rs_frame.hpp:740
points()
Definition rs_frame.hpp:745
const texture_coordinate * get_texture_coordinates() const
Definition rs_frame.hpp:796
size_t size() const
Definition rs_frame.hpp:804
void export_to_ply(const std::string &fname, video_frame texture)
Definition rs_frame.hpp:784
const vertex * get_vertices() const
Definition rs_frame.hpp:771
points(const frame &f)
Definition rs_frame.hpp:751
Definition rs_frame.hpp:927
pose_frame(const frame &f)
Definition rs_frame.hpp:933
rs2_pose get_pose_data() const
Definition rs_frame.hpp:947
pose_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:323
Definition rs_processing.hpp:252
Definition rs_sensor.hpp:103
Definition rs_frame.hpp:23
rs2_extrinsics get_extrinsics_to(const stream_profile &to) const
Definition rs_frame.hpp:148
rs2_format format() const
Definition rs_frame.hpp:44
stream_profile(const rs2_stream_profile *profile)
Definition rs_frame.hpp:170
rs2_format _format
Definition rs_frame.hpp:195
int _uid
Definition rs_frame.hpp:193
stream_profile()
Definition rs_frame.hpp:28
int _framerate
Definition rs_frame.hpp:194
int stream_index() const
Definition rs_frame.hpp:34
int unique_id() const
Definition rs_frame.hpp:54
bool is_default() const
Definition rs_frame.hpp:125
std::shared_ptr< rs2_stream_profile > _clone
Definition rs_frame.hpp:190
std::string stream_name() const
Definition rs_frame.hpp:113
rs2_stream _type
Definition rs_frame.hpp:196
const rs2_stream_profile * _profile
Definition rs_frame.hpp:189
bool is() const
Definition rs_frame.hpp:92
int fps() const
Definition rs_frame.hpp:49
T as() const
Definition rs_frame.hpp:103
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Definition rs_frame.hpp:162
bool _default
Definition rs_frame.hpp:198
rs2_stream stream_type() const
Definition rs_frame.hpp:39
const rs2_stream_profile * get() const
Definition rs_frame.hpp:137
int _index
Definition rs_frame.hpp:192
stream_profile clone(rs2_stream type, int index, rs2_format format) const
Definition rs_frame.hpp:63
bool operator==(const stream_profile &rhs)
Definition rs_frame.hpp:79
bool is_cloned()
Definition rs_frame.hpp:169
Definition rs_processing.hpp:642
Definition rs_frame.hpp:639
int get_bits_per_pixel() const
Definition rs_frame.hpp:697
int get_height() const
Definition rs_frame.hpp:673
video_frame(const frame &f)
Definition rs_frame.hpp:645
int get_stride_in_bytes() const
Definition rs_frame.hpp:685
int get_width() const
Definition rs_frame.hpp:661
int get_bytes_per_pixel() const
Definition rs_frame.hpp:709
bool extract_target_dimensions(rs2_calib_target_type calib_type, float *target_dims, unsigned int target_dims_size) const
Definition rs_frame.hpp:721
Definition rs_frame.hpp:202
stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics &intr) const
Definition rs_frame.hpp:268
int height() const
Definition rs_frame.hpp:232
video_stream_profile()
Definition rs_frame.hpp:204
video_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:210
int width() const
Definition rs_frame.hpp:227
rs2_intrinsics get_intrinsics() const
Definition rs_frame.hpp:240
bool operator==(const video_stream_profile &other) const
Definition rs_frame.hpp:249
Definition rs_processing_gl.hpp:13
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
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)
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
int rs2_get_frame_data_size(const rs2_frame *frame, rs2_error **error)
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
void rs2_release_frame(rs2_frame *frame)
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
Definition rs_frame.h:20
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, 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:30
void rs2_keep_frame(rs2_frame *frame)
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
rs2_sensor * rs2_get_frame_sensor(const rs2_frame *frame, rs2_error **error)
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
float rs2_depth_frame_get_units(const rs2_frame *frame, rs2_error **error)
rs2_calib_target_type
Calibration target type.
Definition rs_frame.h:85
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition rs_sensor.h:44
@ RS2_STREAM_DEPTH
Definition rs_sensor.h:46
@ RS2_STREAM_ANY
Definition rs_sensor.h:45
@ RS2_STREAM_INFRARED
Definition rs_sensor.h:48
@ RS2_STREAM_COLOR
Definition rs_sensor.h:47
@ RS2_STREAM_POSE
Definition rs_sensor.h:53
@ RS2_STREAM_FISHEYE
Definition rs_sensor.h:49
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
float rs2_depth_stereo_frame_get_baseline(const rs2_frame *frame_ref, rs2_error **error)
void rs2_delete_stream_profile(rs2_stream_profile *mode)
const char * rs2_stream_to_string(rs2_stream stream)
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
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)
int rs2_is_stream_profile_default(const rs2_stream_profile *mode, rs2_error **error)
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)
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
rs2_format
A stream's format identifies how binary data is encoded within a frame.
Definition rs_sensor.h:62
@ RS2_FORMAT_RGB8
Definition rs_sensor.h:68
@ RS2_FORMAT_Z16
Definition rs_sensor.h:64
@ RS2_FORMAT_ANY
Definition rs_sensor.h:63
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
rs2_stream_profile * rs2_clone_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, rs2_error **error)
struct rs2_sensor rs2_sensor
Definition rs_types.h:254
struct rs2_stream_profile rs2_stream_profile
Definition rs_types.h:241
@ RS2_EXTENSION_MOTION_FRAME
Definition rs_types.h:147
@ RS2_EXTENSION_MOTION_PROFILE
Definition rs_types.h:157
@ RS2_EXTENSION_DISPARITY_FRAME
Definition rs_types.h:156
@ RS2_EXTENSION_POSE_PROFILE
Definition rs_types.h:159
@ RS2_EXTENSION_VIDEO_PROFILE
Definition rs_types.h:153
@ RS2_EXTENSION_VIDEO_FRAME
Definition rs_types.h:146
@ RS2_EXTENSION_COMPOSITE_FRAME
Definition rs_types.h:148
@ RS2_EXTENSION_DEPTH_FRAME
Definition rs_types.h:150
@ RS2_EXTENSION_POINTS
Definition rs_types.h:149
@ RS2_EXTENSION_POSE_FRAME
Definition rs_types.h:158
struct rs2_error rs2_error
Definition rs_types.h:230
long long rs2_metadata_type
Definition rs_types.h:275
struct rs2_frame rs2_frame
Definition rs_types.h:233
Definition rs_frame.hpp:734
float v
Definition rs_frame.hpp:735
float u
Definition rs_frame.hpp:735
Definition rs_frame.hpp:730
float y
Definition rs_frame.hpp:731
float x
Definition rs_frame.hpp:731
float z
Definition rs_frame.hpp:731
RS2_STREAM_MOTION / RS2_FORMAT_COMBINED_MOTION content is similar to ROS2's Imu message.
Definition rs_sensor.h:110
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition rs_sensor.h:103
Definition rs_types.hpp:27
Video stream intrinsics.
Definition rs_types.h:61
Motion device intrinsics: scale, bias, and variances.
Definition rs_types.h:74
Definition rs_types.h:111
3D vector in Euclidean coordinate space
Definition rs_types.h:100