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;
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);
68 stream_profile res(ref);
69 res._clone = std::shared_ptr<rs2_stream_profile>(ref, [](rs2_stream_profile* r) { rs2_delete_stream_profile(r); });
70
71 return res;
72 }
73
79 bool operator==(const stream_profile& rhs)
80 {
81 return stream_index() == rhs.stream_index() &&
82 stream_type() == rhs.stream_type() &&
83 format() == rhs.format() &&
84 fps() == rhs.fps();
85 }
86
91 template<class T>
92 bool is() const
93 {
94 T extension(*this);
95 return extension;
96 }
97
102 template<class T>
103 T as() const
104 {
105 T extension(*this);
106 return extension;
107 }
108
113 std::string stream_name() const
114 {
115 std::stringstream ss;
117 if (stream_index() != 0) ss << " " << stream_index();
118 return ss.str();
119 }
120
125 bool is_default() const { return _default; }
126
131 operator bool() const { return _profile != nullptr; }
132
137 const rs2_stream_profile* get() const { return _profile; }
138
149 {
150 rs2_error* e = nullptr;
151 rs2_extrinsics res;
152 rs2_get_extrinsics(get(), to.get(), &res, &e);
153 error::handle(e);
154 return res;
155 }
163 {
164 rs2_error* e = nullptr;
165 rs2_register_extrinsics(get(), to.get(), extrinsics, &e);
166 error::handle(e);
167 }
168
169 bool is_cloned() { return bool(_clone); }
170 explicit stream_profile(const rs2_stream_profile* profile) : _profile(profile)
171 {
172 rs2_error* e = nullptr;
174 error::handle(e);
175
177 error::handle(e);
178
179 }
180 operator const rs2_stream_profile*() { return _profile; }
181 explicit operator std::shared_ptr<rs2_stream_profile>() { return _clone; }
182
183 protected:
184 friend class rs2::sensor;
185 friend class rs2::frame;
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
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 }
910 {
911 auto data = reinterpret_cast<const float*>(get_data());
912 return rs2_vector{ data[0], data[1], data[2] };
913 }
914 };
915
916 class pose_frame : public frame
917 {
918 public:
924 : frame(f)
925 {
926 rs2_error* e = nullptr;
927 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_POSE_FRAME, &e) == 0 && !e))
928 {
929 reset();
930 }
931 error::handle(e);
932 }
938 {
939 rs2_pose pose_data;
940 rs2_error* e = nullptr;
941 rs2_pose_frame_get_pose_data(get(), &pose_data, &e);
942 error::handle(e);
943 return pose_data;
944 }
945 };
946
947 class frameset : public frame
948 {
949 public:
953 frameset() :_size(0) {};
958 frameset(const frame& f)
959 : frame(f), _size(0)
960 {
961 rs2_error* e = nullptr;
962 if (!f || (rs2_is_frame_extendable_to(f.get(), RS2_EXTENSION_COMPOSITE_FRAME, &e) == 0 && !e))
963 {
964 reset();
965 // TODO - consider explicit constructor to move resultion to compile time
966 }
967 error::handle(e);
968
969 if (get())
970 {
971 _size = rs2_embedded_frames_count(get(), &e);
972 error::handle(e);
973 }
974 }
975
983 {
984 frame result;
985 foreach_rs([&result, s, f](frame frm) {
986 if (!result && frm.get_profile().stream_type() == s && (f == RS2_FORMAT_ANY || f == frm.get_profile().format()))
987 {
988 result = std::move(frm);
989 }
990 });
991 return result;
992 }
1000 {
1001 auto frm = first_or_default(s, f);
1002 if (!frm) throw error("Frame of requested stream type was not found!");
1003 return frm;
1004 }
1005
1011 {
1013 return f.as<depth_frame>();
1014 }
1020 {
1022
1023 if (!f)
1024 {
1026 if (ir && ir.get_profile().format() == RS2_FORMAT_RGB8)
1027 f = ir;
1028 }
1029 return f;
1030 }
1036 video_frame get_infrared_frame(const size_t index = 0) const
1037 {
1038 frame f;
1039 if (!index)
1040 {
1042 }
1043 else
1044 {
1045 foreach_rs([&f, index](const frame& frm) {
1047 frm.get_profile().stream_index() == index) f = frm;
1048 });
1049 }
1050 return f;
1051 }
1052
1058 video_frame get_fisheye_frame(const size_t index = 0) const
1059 {
1060 frame f;
1061 if (!index)
1062 {
1064 }
1065 else
1066 {
1067 foreach_rs([&f, index](const frame& frm) {
1069 frm.get_profile().stream_index() == index) f = frm;
1070 });
1071 }
1072 return f;
1073 }
1074
1080 pose_frame get_pose_frame(const size_t index = 0) const
1081 {
1082 frame f;
1083 if (!index)
1084 {
1086 }
1087 else
1088 {
1089 foreach_rs([&f, index](const frame& frm) {
1090 if (frm.get_profile().stream_type() == RS2_STREAM_POSE &&
1091 frm.get_profile().stream_index() == index) f = frm;
1092 });
1093 }
1094 return f.as<pose_frame>();
1095 }
1096
1101 size_t size() const
1102 {
1103 return _size;
1104 }
1105
1110 template<class T>
1111 void foreach_rs(T action) const
1112 {
1113 rs2_error* e = nullptr;
1114 auto count = size();
1115 for (size_t i = 0; i < count; i++)
1116 {
1117 auto fref = rs2_extract_frame(get(), (int)i, &e);
1118 error::handle(e);
1119
1120 action(frame(fref));
1121 }
1122 }
1128 frame operator[](size_t index) const
1129 {
1130 rs2_error* e = nullptr;
1131 if (index < size())
1132 {
1133 auto fref = rs2_extract_frame(get(), (int)index, &e);
1134 error::handle(e);
1135 return frame(fref);
1136 }
1137
1138 throw error("Requested index is out of range!");
1139 }
1140
1142 {
1143 public:
1144 // inheriting from std::iterator template is deprecated in C++17, this is the new way to define an iterator
1145 // go to https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/ for more info
1146 using iterator_category = std::forward_iterator_tag;
1148 using difference_type = std::ptrdiff_t;
1149 using pointer = frame*;
1151
1152 iterator(const frameset* owner, size_t index = 0) : _index(index), _owner(owner) {}
1153 iterator& operator++() { ++_index; return *this; }
1154 bool operator==(const iterator& other) const { return _index == other._index; }
1155 bool operator!=(const iterator& other) const { return !(*this == other); }
1156
1157 frame operator*() { return (*_owner)[_index]; }
1158 private:
1159 size_t _index = 0;
1160 const frameset* _owner;
1161 };
1162
1163 iterator begin() const { return iterator(this); }
1164 iterator end() const { return iterator(this, size()); }
1165 private:
1166 size_t _size;
1167 };
1168
1169 template<class T>
1171 {
1172 T on_frame_function;
1173 public:
1174 explicit frame_callback(T on_frame) : on_frame_function(on_frame) {}
1175
1176 void on_frame(rs2_frame* fref) override
1177 {
1178 on_frame_function(frame{ fref });
1179 }
1180
1181 void release() override { delete this; }
1182 };
1183}
1184#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
Definition rs_frame.hpp:859
disparity_frame(const frame &f)
Definition rs_frame.hpp:865
float get_baseline(void) const
Definition rs_frame.hpp:879
Definition rs_types.hpp:110
static void handle(rs2_error *e)
Definition rs_types.hpp:161
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
Definition rs_frame.hpp:1171
void release() override
Definition rs_frame.hpp:1181
void on_frame(rs2_frame *fref) override
Definition rs_frame.hpp:1176
frame_callback(T on_frame)
Definition rs_frame.hpp:1174
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:1142
bool operator!=(const iterator &other) const
Definition rs_frame.hpp:1155
iterator & operator++()
Definition rs_frame.hpp:1153
bool operator==(const iterator &other) const
Definition rs_frame.hpp:1154
iterator(const frameset *owner, size_t index=0)
Definition rs_frame.hpp:1152
std::ptrdiff_t difference_type
Definition rs_frame.hpp:1148
frame operator*()
Definition rs_frame.hpp:1157
std::forward_iterator_tag iterator_category
Definition rs_frame.hpp:1146
Definition rs_frame.hpp:948
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:982
pose_frame get_pose_frame(const size_t index=0) const
Definition rs_frame.hpp:1080
video_frame get_fisheye_frame(const size_t index=0) const
Definition rs_frame.hpp:1058
video_frame get_infrared_frame(const size_t index=0) const
Definition rs_frame.hpp:1036
void foreach_rs(T action) const
Definition rs_frame.hpp:1111
iterator end() const
Definition rs_frame.hpp:1164
video_frame get_color_frame() const
Definition rs_frame.hpp:1019
frame operator[](size_t index) const
Definition rs_frame.hpp:1128
depth_frame get_depth_frame() const
Definition rs_frame.hpp:1010
frameset()
Definition rs_frame.hpp:953
iterator begin() const
Definition rs_frame.hpp:1163
frameset(const frame &f)
Definition rs_frame.hpp:958
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:999
size_t size() const
Definition rs_frame.hpp:1101
Definition rs_frame.hpp:889
motion_frame(const frame &f)
Definition rs_frame.hpp:895
rs2_vector get_motion_data() const
Definition rs_frame.hpp:909
Definition rs_frame.hpp:285
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:917
pose_frame(const frame &f)
Definition rs_frame.hpp:923
rs2_pose get_pose_data() const
Definition rs_frame.hpp:937
Definition rs_frame.hpp:317
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:251
struct rs2_stream_profile rs2_stream_profile
Definition rs_types.h:238
@ RS2_EXTENSION_MOTION_FRAME
Definition rs_types.h:145
@ RS2_EXTENSION_MOTION_PROFILE
Definition rs_types.h:155
@ RS2_EXTENSION_DISPARITY_FRAME
Definition rs_types.h:154
@ RS2_EXTENSION_POSE_PROFILE
Definition rs_types.h:157
@ RS2_EXTENSION_VIDEO_PROFILE
Definition rs_types.h:151
@ RS2_EXTENSION_VIDEO_FRAME
Definition rs_types.h:144
@ RS2_EXTENSION_COMPOSITE_FRAME
Definition rs_types.h:146
@ RS2_EXTENSION_DEPTH_FRAME
Definition rs_types.h:148
@ RS2_EXTENSION_POINTS
Definition rs_types.h:147
@ RS2_EXTENSION_POSE_FRAME
Definition rs_types.h:156
struct rs2_error rs2_error
Definition rs_types.h:227
long long rs2_metadata_type
Definition rs_types.h:272
struct rs2_frame rs2_frame
Definition rs_types.h:230
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
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition rs_sensor.h:103
Definition rs_types.hpp:26
Video stream intrinsics.
Definition rs_types.h:59
Motion device intrinsics: scale, bias, and variances.
Definition rs_types.h:72
Definition rs_types.h:109
3D vector in Euclidean coordinate space
Definition rs_types.h:98