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 rs2_error * e = nullptr;
116 std::string name = rs2_get_stream_profile_name( _profile, &e );
117
118 if( name.empty() )
119 {
120 std::stringstream ss;
122 if( stream_index() != 0 )
123 ss << " " << stream_index();
124 name = ss.str();
125 }
126
127 return name;
128 }
129
134 bool is_default() const { return _default; }
135
140 operator bool() const { return _profile != nullptr; }
141
146 const rs2_stream_profile* get() const { return _profile; }
147
158 {
159 rs2_error* e = nullptr;
160 rs2_extrinsics res;
161 rs2_get_extrinsics(get(), to.get(), &res, &e);
162 error::handle(e);
163 return res;
164 }
165
172 {
173 rs2_error* e = nullptr;
174 rs2_register_extrinsics(get(), to.get(), extrinsics, &e);
175 error::handle(e);
176 }
177
178 bool is_cloned() { return bool(_clone); }
179 explicit stream_profile(const rs2_stream_profile* profile) : _profile(profile)
180 {
181 rs2_error* e = nullptr;
183 error::handle(e);
184
186 error::handle(e);
187
188 }
189 operator const rs2_stream_profile*() { return _profile; }
190 explicit operator std::shared_ptr<rs2_stream_profile>() { return _clone; }
191
192 protected:
193 friend class rs2::sensor;
194 friend class rs2::frame;
197
199 std::shared_ptr<rs2_stream_profile> _clone;
200
201 int _index = 0;
202 int _uid = 0;
203 int _framerate = 0;
206
207 bool _default = false;
208 };
209
211 {
212 public:
214
220 : stream_profile(sp)
221 {
222 rs2_error* e = nullptr;
223 if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_VIDEO_PROFILE, &e) == 0 && !e))
224 {
225 _profile = nullptr;
226 }
227 error::handle(e);
228
229 if (_profile)
230 {
231 rs2_get_video_stream_resolution(_profile, &_width, &_height, &e);
232 error::handle(e);
233 }
234 }
235
236 int width() const
237 {
238 return _width;
239 }
240
241 int height() const
242 {
243 return _height;
244 }
245
250 {
251 rs2_error* e = nullptr;
252 rs2_intrinsics intr;
254 error::handle(e);
255 return intr;
256 }
257
258 bool operator==(const video_stream_profile& other) const
259 {
260 return (((stream_profile&)*this)==other &&
261 width() == other.width() &&
262 height() == other.height());
263 }
264
266
277 stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics& intr) const
278 {
279 rs2_error* e = nullptr;
280 auto ref = rs2_clone_video_stream_profile(_profile, type, index, format, width, height, &intr, &e);
281 error::handle(e);
282 stream_profile res(ref);
283 res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
284
285 return res;
286 }
287 private:
288 int _width = 0;
289 int _height = 0;
290 };
291
292
294 {
295 public:
301 : stream_profile(sp)
302 {
303 rs2_error* e = nullptr;
304 if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_MOTION_PROFILE, &e) == 0 && !e))
305 {
306 _profile = nullptr;
307 }
308 error::handle(e);
309 }
310
316 {
317 rs2_error* e = nullptr;
320 error::handle(e);
321 return intrin;
322 }
323 };
324
326 {
327 public:
333 : stream_profile(sp)
334 {
335 rs2_error* e = nullptr;
336 if ((rs2_stream_profile_is(sp.get(), RS2_EXTENSION_POSE_PROFILE, &e) == 0 && !e))
337 {
338 _profile = nullptr;
339 }
340 error::handle(e);
341 }
342 };
343
348 {
349 public:
350 virtual rs2::frame process(rs2::frame frame) const = 0;
351 virtual ~filter_interface() = default;
352 };
353
354 class frame
355 {
356 public:
360 frame() : frame_ref(nullptr) {}
365 frame(rs2_frame* ref) : frame_ref(ref)
366 {
367#ifdef _DEBUG
368 if (ref)
369 {
370 rs2_error* e = nullptr;
371 auto r = rs2_get_frame_number(ref, &e);
372 if (!e)
373 frame_number = r;
374 auto s = rs2_get_frame_stream_profile(ref, &e);
375 if (!e)
376 profile = stream_profile(s);
377 }
378 else
379 {
380 frame_number = 0;
381 profile = stream_profile();
382 }
383#endif
384 }
385
389 frame(frame&& other) noexcept : frame_ref(other.frame_ref)
390 {
391 other.frame_ref = nullptr;
392#ifdef _DEBUG
393 frame_number = other.frame_number;
394 profile = other.profile;
395#endif
396 }
397
402 {
403 swap(other);
404 return *this;
405 }
406
411 frame(const frame& other)
412 : frame_ref(other.frame_ref)
413 {
414 if (frame_ref) add_ref();
415#ifdef _DEBUG
416 frame_number = other.frame_number;
417 profile = other.profile;
418#endif
419 }
420
424 void swap(frame& other)
425 {
426 std::swap(frame_ref, other.frame_ref);
427
428#ifdef _DEBUG
429 std::swap(frame_number, other.frame_number);
430 std::swap(profile, other.profile);
431#endif
432 }
433
438 {
439 if (frame_ref)
440 {
441 rs2_release_frame(frame_ref);
442 }
443 }
444
448 void keep() { rs2_keep_frame(frame_ref); }
449
454 operator bool() const { return frame_ref != nullptr; }
455
457 {
458 rs2_error* e = nullptr;
459 auto r = rs2_get_frame_sensor(frame_ref, &e);
460 error::handle(e);
461 return r;
462 }
463
485 double get_timestamp() const
486 {
487 rs2_error* e = nullptr;
488 auto r = rs2_get_frame_timestamp(frame_ref, &e);
489 error::handle(e);
490 return r;
491 }
492
497 {
498 rs2_error* e = nullptr;
499 auto r = rs2_get_frame_timestamp_domain(frame_ref, &e);
500 error::handle(e);
501 return r;
502 }
503
509 {
510 rs2_error* e = nullptr;
511 auto r = rs2_get_frame_metadata(frame_ref, frame_metadata, &e);
512 error::handle(e);
513 return r;
514 }
515
521 {
522 rs2_error* e = nullptr;
523 auto r = rs2_supports_frame_metadata(frame_ref, frame_metadata, &e);
524 error::handle(e);
525 return r != 0;
526 }
527
532 unsigned long long get_frame_number() const
533 {
534 rs2_error* e = nullptr;
535 auto r = rs2_get_frame_number(frame_ref, &e);
536 error::handle(e);
537 return r;
538 }
539
544 const int get_data_size() const
545 {
546 rs2_error* e = nullptr;
547 auto r = rs2_get_frame_data_size(frame_ref, &e);
548 error::handle(e);
549 return r;
550 }
551
556 const void* get_data() const
557 {
558 rs2_error* e = nullptr;
559 auto r = rs2_get_frame_data(frame_ref, &e);
560 error::handle(e);
561 return r;
562 }
563
569 {
570 rs2_error* e = nullptr;
571 auto s = rs2_get_frame_stream_profile(frame_ref, &e);
572 error::handle(e);
573 return stream_profile(s);
574 }
575
580 template<class T>
581 bool is() const
582 {
583 T extension(*this);
584 return extension;
585 }
586
590 template<class T>
591 T as() const
592 {
593 T extension(*this);
594 return extension;
595 }
596
601 rs2_frame* get() const { return frame_ref; }
602 explicit operator rs2_frame*() { return frame_ref; }
603
605 {
606 return filter.process(*this);
607 }
608
609 protected:
615 void add_ref() const
616 {
617 rs2_error* e = nullptr;
618 rs2_frame_add_ref(frame_ref, &e);
619 error::handle(e);
620 }
621
622 void reset()
623 {
624 if (frame_ref)
625 {
626 rs2_release_frame(frame_ref);
627 }
628 frame_ref = nullptr;
629 }
630
631 private:
632 friend class rs2::frame_source;
633 friend class rs2::frame_queue;
634 friend class rs2::syncer;
636 friend class rs2::pointcloud;
637 friend class rs2::points;
638
639 rs2_frame* frame_ref;
640
641#ifdef _DEBUG
642 stream_profile profile;
643 unsigned long long frame_number = 0;
644#endif
645 };
646
647 class video_frame : public frame
648 {
649 public:
655 : frame(f)
656 {
657 rs2_error* e = nullptr;
658 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_VIDEO_FRAME, &e) == 0 && !e))
659 {
660 reset();
661 }
662 error::handle(e);
663 }
664
665
670 int get_width() const
671 {
672 rs2_error* e = nullptr;
673 auto r = rs2_get_frame_width(get(), &e);
674 error::handle(e);
675 return r;
676 }
677
682 int get_height() const
683 {
684 rs2_error* e = nullptr;
685 auto r = rs2_get_frame_height(get(), &e);
686 error::handle(e);
687 return r;
688 }
689
695 {
696 rs2_error* e = nullptr;
697 auto r = rs2_get_frame_stride_in_bytes(get(), &e);
698 error::handle(e);
699 return r;
700 }
701
707 {
708 rs2_error* e = nullptr;
709 auto r = rs2_get_frame_bits_per_pixel(get(), &e);
710 error::handle(e);
711 return r;
712 }
713
718 int get_bytes_per_pixel() const { return get_bits_per_pixel() / 8; }
719
730 bool extract_target_dimensions(rs2_calib_target_type calib_type, float* target_dims, unsigned int target_dims_size) const
731 {
732 rs2_error* e = nullptr;
733 rs2_extract_target_dimensions(get(), calib_type, target_dims, target_dims_size, &e);
734 error::handle(e);
735 return (e == nullptr);
736 }
737 };
738
739 struct vertex {
740 float x, y, z;
741 operator const float*() const { return &x; }
742 };
744 float u, v;
745 operator const float*() const { return &u; }
746 };
747
748 class points : public frame
749 {
750 public:
754 points() : frame(), _size(0) {}
755
760 points(const frame& f)
761 : frame(f), _size(0)
762 {
763 rs2_error* e = nullptr;
764 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POINTS, &e) == 0 && !e))
765 {
766 reset();
767 }
768 error::handle(e);
769
770 if (get())
771 {
772 _size = rs2_get_frame_points_count(get(), &e);
773 error::handle(e);
774 }
775 }
776
780 const vertex* get_vertices() const
781 {
782 rs2_error* e = nullptr;
783 auto res = rs2_get_frame_vertices(get(), &e);
784 error::handle(e);
785 return (const vertex*)res;
786 }
787
793 void export_to_ply(const std::string& fname, video_frame texture)
794 {
795 rs2_frame* ptr = nullptr;
796 std::swap(texture.frame_ref, ptr);
797 rs2_error* e = nullptr;
798 rs2_export_to_ply(get(), fname.c_str(), ptr, &e);
799 error::handle(e);
800 }
801
806 {
807 rs2_error* e = nullptr;
808 auto res = rs2_get_frame_texture_coordinates(get(), &e);
809 error::handle(e);
810 return (const texture_coordinate*)res;
811 }
812
813 size_t size() const
814 {
815 return _size;
816 }
817
818 private:
819 size_t _size;
820 };
821
823 {
824 public:
830 : video_frame(f)
831 {
832 rs2_error* e = nullptr;
833 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DEPTH_FRAME, &e) == 0 && !e))
834 {
835 reset();
836 }
837 error::handle(e);
838 }
839
846 float get_distance(int x, int y) const
847 {
848 rs2_error * e = nullptr;
849 auto r = rs2_depth_frame_get_distance(get(), x, y, &e);
850 error::handle(e);
851 return r;
852 }
853
858 float get_units() const
859 {
860 rs2_error * e = nullptr;
861 auto r = rs2_depth_frame_get_units( get(), &e );
862 error::handle( e );
863 return r;
864 }
865 };
866
868 {
869 public:
875 : depth_frame(f)
876 {
877 rs2_error* e = nullptr;
878 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_DISPARITY_FRAME, &e) == 0 && !e))
879 {
880 reset();
881 }
882 error::handle(e);
883 }
884
888 float get_baseline(void) const
889 {
890 rs2_error * e = nullptr;
892 error::handle(e);
893 return r;
894 }
895 };
896
897 class motion_frame : public frame
898 {
899 public:
905 : frame(f)
906 {
907 rs2_error* e = nullptr;
908 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_MOTION_FRAME, &e) == 0 && !e))
909 {
910 reset();
911 }
912 error::handle(e);
913 }
914
920 {
921 auto data = reinterpret_cast<const float*>(get_data());
922 return rs2_vector{ data[0], data[1], data[2] };
923 }
924
930 {
931 return *reinterpret_cast< rs2_combined_motion const * >( get_data() );
932 }
933 };
934
935 class pose_frame : public frame
936 {
937 public:
943 : frame(f)
944 {
945 rs2_error* e = nullptr;
946 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
947 {
948 reset();
949 }
950 error::handle(e);
951 }
952
957 {
958 rs2_pose pose_data;
959 rs2_error* e = nullptr;
960 rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
961 error::handle(e);
962 return pose_data;
963 }
964 };
965
966 class frameset : public frame
967 {
968 public:
972 frameset() :_size(0) {};
977 frameset(const frame& f)
978 : frame(f), _size(0)
979 {
980 rs2_error* e = nullptr;
981 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
982 {
983 reset();
984 // TODO - consider explicit constructor to move resultion to compile time
985 }
986 error::handle(e);
987
988 if (get())
989 {
990 _size = rs2_embedded_frames_count(get(), &e);
991 error::handle(e);
992 }
993 }
994
1002 {
1003 frame result;
1004 foreach_rs([&result, s, f](frame frm) {
1005 if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
1006 {
1007 result = std::move(frm);
1008 }
1009 });
1010 return result;
1011 }
1012
1019 {
1020 auto frm = first_or_default(s, f);
1021 if (!frm) throw error("Frame of requested stream type was not found!");
1022 return frm;
1023 }
1024
1030 {
1032 return f.as<depth_frame>();
1033 }
1034
1039 {
1041
1042 if (!f)
1043 {
1045 if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
1046 f = ir;
1047 }
1048 return f;
1049 }
1050
1055 video_frame get_infrared_frame(const size_t index = 0) const
1056 {
1057 frame f;
1058 if (!index)
1059 {
1061 }
1062 else
1063 {
1064 foreach_rs([&f, index](const frame& frm) {
1066 frm.get_profile().stream_index() == index) f = frm;
1067 });
1068 }
1069 return f;
1070 }
1071
1077 video_frame get_fisheye_frame(const size_t index = 0) const
1078 {
1079 frame f;
1080 if (!index)
1081 {
1083 }
1084 else
1085 {
1086 foreach_rs([&f, index](const frame& frm) {
1088 frm.get_profile().stream_index() == index) f = frm;
1089 });
1090 }
1091 return f;
1092 }
1093
1099 pose_frame get_pose_frame(const size_t index = 0) const
1100 {
1101 frame f;
1102 if (!index)
1103 {
1105 }
1106 else
1107 {
1108 foreach_rs([&f, index](const frame& frm) {
1109 if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1110 frm.get_profile().stream_index() == index) f = frm;
1111 });
1112 }
1113 return f.as<pose_frame>();
1114 }
1115
1120 size_t size() const
1121 {
1122 return _size;
1123 }
1124
1129 template<class T>
1130 void foreach_rs(T action) const
1131 {
1132 rs2_error* e = nullptr;
1133 auto count = size();
1134 for (size_t i = 0; i < count; i++)
1135 {
1136 auto fref = rs2_extract_frame(get(), (int)i, &e);
1137 error::handle(e);
1138
1139 action(frame(fref));
1140 }
1141 }
1142
1147 frame operator[](size_t index) const
1148 {
1149 rs2_error* e = nullptr;
1150 if (index < size())
1151 {
1152 auto fref = rs2_extract_frame(get(), (int)index, &e);
1153 error::handle(e);
1154 return frame(fref);
1155 }
1156
1157 throw error("Requested index is out of range!");
1158 }
1159
1161 {
1162 public:
1163 // inheriting from std::iterator template is deprecated in C++17, this is the new way to define an iterator
1164 // go to https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/ for more info
1165 using iterator_category = std::forward_iterator_tag;
1167 using difference_type = std::ptrdiff_t;
1168 using pointer = frame*;
1170
1171 iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1172 iterator& operator++() { ++_index; return *this; }
1173 bool operator==(const iterator& other) const { return _index == other._index; }
1174 bool operator!=(const iterator& other) const { return !(*this == other); }
1175
1176 frame operator*() { return (*_owner)[_index]; }
1177 private:
1178 size_t _index = 0;
1179 const frameset* _owner;
1180 };
1181
1182 iterator begin() const { return iterator(this); }
1183 iterator end() const { return iterator(this, size()); }
1184 private:
1185 size_t _size;
1186 };
1187
1188 template<class T>
1190 {
1191 T on_frame_function;
1192 public:
1193 explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1194
1195 void on_frame(rs2_frame* fref) override
1196 {
1197 on_frame_function(frame{ fref });
1198 }
1199
1200 void release() override { delete this; }
1201 };
1202}
1203#endif // LIBREALSENSE_RS2_FRAME_HPP
Definition rs_frame.hpp:823
float get_units() const
Definition rs_frame.hpp:858
float get_distance(int x, int y) const
Definition rs_frame.hpp:846
depth_frame(const frame &f)
Definition rs_frame.hpp:829
disparity_frame(const frame &f)
Definition rs_frame.hpp:874
float get_baseline(void) const
Definition rs_frame.hpp:888
Definition rs_types.hpp:116
static void handle(rs2_error *e)
Definition rs_types.hpp:167
Definition rs_frame.hpp:348
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:1200
void on_frame(rs2_frame *fref) override
Definition rs_frame.hpp:1195
frame_callback(T on_frame)
Definition rs_frame.hpp:1193
Definition rs_processing.hpp:135
Definition rs_processing.hpp:19
Definition rs_frame.hpp:355
void reset()
Definition rs_frame.hpp:622
frame(rs2_frame *ref)
Definition rs_frame.hpp:365
rs2_timestamp_domain get_frame_timestamp_domain() const
Definition rs_frame.hpp:496
frame & operator=(frame other)
Definition rs_frame.hpp:401
double get_timestamp() const
Definition rs_frame.hpp:485
frame(frame &&other) noexcept
Definition rs_frame.hpp:389
frame()
Definition rs_frame.hpp:360
frame(const frame &other)
Definition rs_frame.hpp:411
void keep()
Definition rs_frame.hpp:448
void swap(frame &other)
Definition rs_frame.hpp:424
frame apply_filter(filter_interface &filter)
Definition rs_frame.hpp:604
~frame()
Definition rs_frame.hpp:437
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition rs_frame.hpp:508
bool is() const
Definition rs_frame.hpp:581
stream_profile get_profile() const
Definition rs_frame.hpp:568
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
Definition rs_frame.hpp:520
const int get_data_size() const
Definition rs_frame.hpp:544
T as() const
Definition rs_frame.hpp:591
const void * get_data() const
Definition rs_frame.hpp:556
unsigned long long get_frame_number() const
Definition rs_frame.hpp:532
rs2_sensor * get_sensor()
Definition rs_frame.hpp:456
rs2_frame * get() const
Definition rs_frame.hpp:601
void add_ref() const
Definition rs_frame.hpp:615
Definition rs_frame.hpp:1161
bool operator!=(const iterator &other) const
Definition rs_frame.hpp:1174
frame * pointer
Definition rs_frame.hpp:1168
iterator & operator++()
Definition rs_frame.hpp:1172
bool operator==(const iterator &other) const
Definition rs_frame.hpp:1173
iterator(const frameset *owner, size_t index=0)
Definition rs_frame.hpp:1171
std::ptrdiff_t difference_type
Definition rs_frame.hpp:1167
frame operator*()
Definition rs_frame.hpp:1176
frame value_type
Definition rs_frame.hpp:1166
frame & reference
Definition rs_frame.hpp:1169
std::forward_iterator_tag iterator_category
Definition rs_frame.hpp:1165
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:1001
pose_frame get_pose_frame(const size_t index=0) const
Definition rs_frame.hpp:1099
video_frame get_fisheye_frame(const size_t index=0) const
Definition rs_frame.hpp:1077
video_frame get_infrared_frame(const size_t index=0) const
Definition rs_frame.hpp:1055
void foreach_rs(T action) const
Definition rs_frame.hpp:1130
iterator end() const
Definition rs_frame.hpp:1183
video_frame get_color_frame() const
Definition rs_frame.hpp:1038
frame operator[](size_t index) const
Definition rs_frame.hpp:1147
depth_frame get_depth_frame() const
Definition rs_frame.hpp:1029
frameset()
Definition rs_frame.hpp:972
iterator begin() const
Definition rs_frame.hpp:1182
frameset(const frame &f)
Definition rs_frame.hpp:977
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:1018
size_t size() const
Definition rs_frame.hpp:1120
motion_frame(const frame &f)
Definition rs_frame.hpp:904
rs2_combined_motion get_combined_motion_data() const
Definition rs_frame.hpp:929
rs2_vector get_motion_data() const
Definition rs_frame.hpp:919
motion_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:300
rs2_motion_device_intrinsic get_motion_intrinsics() const
Definition rs_frame.hpp:315
Definition rs_pipeline.hpp:19
Definition rs_processing.hpp:431
Definition rs_frame.hpp:749
points()
Definition rs_frame.hpp:754
const texture_coordinate * get_texture_coordinates() const
Definition rs_frame.hpp:805
size_t size() const
Definition rs_frame.hpp:813
void export_to_ply(const std::string &fname, video_frame texture)
Definition rs_frame.hpp:793
const vertex * get_vertices() const
Definition rs_frame.hpp:780
points(const frame &f)
Definition rs_frame.hpp:760
Definition rs_frame.hpp:936
pose_frame(const frame &f)
Definition rs_frame.hpp:942
rs2_pose get_pose_data() const
Definition rs_frame.hpp:956
pose_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:332
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:157
rs2_format format() const
Definition rs_frame.hpp:44
stream_profile(const rs2_stream_profile *profile)
Definition rs_frame.hpp:179
rs2_format _format
Definition rs_frame.hpp:204
int _uid
Definition rs_frame.hpp:202
stream_profile()
Definition rs_frame.hpp:28
int _framerate
Definition rs_frame.hpp:203
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:134
std::shared_ptr< rs2_stream_profile > _clone
Definition rs_frame.hpp:199
std::string stream_name() const
Definition rs_frame.hpp:113
rs2_stream _type
Definition rs_frame.hpp:205
const rs2_stream_profile * _profile
Definition rs_frame.hpp:198
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:171
bool _default
Definition rs_frame.hpp:207
rs2_stream stream_type() const
Definition rs_frame.hpp:39
const rs2_stream_profile * get() const
Definition rs_frame.hpp:146
int _index
Definition rs_frame.hpp:201
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:178
Definition rs_processing.hpp:642
Definition rs_frame.hpp:648
int get_bits_per_pixel() const
Definition rs_frame.hpp:706
int get_height() const
Definition rs_frame.hpp:682
video_frame(const frame &f)
Definition rs_frame.hpp:654
int get_stride_in_bytes() const
Definition rs_frame.hpp:694
int get_width() const
Definition rs_frame.hpp:670
int get_bytes_per_pixel() const
Definition rs_frame.hpp:718
bool extract_target_dimensions(rs2_calib_target_type calib_type, float *target_dims, unsigned int target_dims_size) const
Definition rs_frame.hpp:730
Definition rs_frame.hpp:211
stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics &intr) const
Definition rs_frame.hpp:277
int height() const
Definition rs_frame.hpp:241
video_stream_profile()
Definition rs_frame.hpp:213
video_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:219
int width() const
Definition rs_frame.hpp:236
rs2_intrinsics get_intrinsics() const
Definition rs_frame.hpp:249
bool operator==(const video_stream_profile &other) const
Definition rs_frame.hpp:258
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)
const char * rs2_get_stream_profile_name(const rs2_stream_profile *profile, 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:45
@ RS2_STREAM_DEPTH
Definition rs_sensor.h:47
@ RS2_STREAM_ANY
Definition rs_sensor.h:46
@ RS2_STREAM_INFRARED
Definition rs_sensor.h:49
@ RS2_STREAM_COLOR
Definition rs_sensor.h:48
@ RS2_STREAM_POSE
Definition rs_sensor.h:54
@ RS2_STREAM_FISHEYE
Definition rs_sensor.h:50
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:63
@ RS2_FORMAT_RGB8
Definition rs_sensor.h:69
@ RS2_FORMAT_Z16
Definition rs_sensor.h:65
@ RS2_FORMAT_ANY
Definition rs_sensor.h:64
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:255
struct rs2_stream_profile rs2_stream_profile
Definition rs_types.h:242
@ RS2_EXTENSION_MOTION_FRAME
Definition rs_types.h:148
@ RS2_EXTENSION_MOTION_PROFILE
Definition rs_types.h:158
@ RS2_EXTENSION_DISPARITY_FRAME
Definition rs_types.h:157
@ RS2_EXTENSION_POSE_PROFILE
Definition rs_types.h:160
@ RS2_EXTENSION_VIDEO_PROFILE
Definition rs_types.h:154
@ RS2_EXTENSION_VIDEO_FRAME
Definition rs_types.h:147
@ RS2_EXTENSION_COMPOSITE_FRAME
Definition rs_types.h:149
@ RS2_EXTENSION_DEPTH_FRAME
Definition rs_types.h:151
@ RS2_EXTENSION_POINTS
Definition rs_types.h:150
@ RS2_EXTENSION_POSE_FRAME
Definition rs_types.h:159
struct rs2_error rs2_error
Definition rs_types.h:231
long long rs2_metadata_type
Definition rs_types.h:277
struct rs2_frame rs2_frame
Definition rs_types.h:234
Definition rs_frame.hpp:743
float v
Definition rs_frame.hpp:744
float u
Definition rs_frame.hpp:744
Definition rs_frame.hpp:739
float y
Definition rs_frame.hpp:740
float x
Definition rs_frame.hpp:740
float z
Definition rs_frame.hpp:740
RS2_STREAM_MOTION / RS2_FORMAT_COMBINED_MOTION content is similar to ROS2's Imu message.
Definition rs_sensor.h:111
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition rs_sensor.h:104
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