4#ifndef LIBREALSENSE_RS2_FRAME_HPP
5#define LIBREALSENSE_RS2_FRAME_HPP
120 std::stringstream ss;
140 operator bool()
const {
return _profile !=
nullptr; }
190 explicit operator std::shared_ptr<rs2_stream_profile>() {
return _clone; }
199 std::shared_ptr<rs2_stream_profile>
_clone;
391 other.frame_ref =
nullptr;
393 frame_number = other.frame_number;
394 profile = other.profile;
412 : frame_ref(other.frame_ref)
416 frame_number = other.frame_number;
417 profile = other.profile;
426 std::swap(frame_ref, other.frame_ref);
429 std::swap(frame_number, other.frame_number);
430 std::swap(profile, other.profile);
454 operator bool()
const {
return frame_ref !=
nullptr; }
643 unsigned long long frame_number = 0;
735 return (e ==
nullptr);
741 operator const float*()
const {
return &
x; }
745 operator const float*()
const {
return &
u; }
785 return (
const vertex*)res;
796 std::swap(texture.frame_ref, ptr);
861 return (
const vertex*)res;
873 return (uint8_t * )res;
1021 auto data =
reinterpret_cast<const float*
>(
get_data());
1022 return rs2_vector{ data[0], data[1], data[2] };
1078 :
frame(f), _size(0)
1107 result = std::move(frm);
1121 if (!frm)
throw error(
"Frame of requested stream type was not found!");
1252 auto count =
size();
1253 for (
size_t i = 0; i < count; i++)
1258 action(
frame(fref));
1276 throw error(
"Requested index is out of range!");
1310 T on_frame_function;
1316 on_frame_function(
frame{ fref });
Definition rs_frame.hpp:923
float get_units() const
Definition rs_frame.hpp:958
float get_distance(int x, int y) const
Definition rs_frame.hpp:946
depth_frame(const frame &f)
Definition rs_frame.hpp:929
disparity_frame(const frame &f)
Definition rs_frame.hpp:974
float get_baseline(void) const
Definition rs_frame.hpp:988
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:361
rs2::frame process(rs2::frame frame) const override
Definition rs_processing.hpp:369
void release() override
Definition rs_frame.hpp:1319
void on_frame(rs2_frame *fref) override
Definition rs_frame.hpp:1314
frame_callback(T on_frame)
Definition rs_frame.hpp:1312
Definition rs_processing.hpp:134
Definition rs_processing.hpp:18
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:1280
bool operator!=(const iterator &other) const
Definition rs_frame.hpp:1293
frame * pointer
Definition rs_frame.hpp:1287
iterator & operator++()
Definition rs_frame.hpp:1291
bool operator==(const iterator &other) const
Definition rs_frame.hpp:1292
iterator(const frameset *owner, size_t index=0)
Definition rs_frame.hpp:1290
std::ptrdiff_t difference_type
Definition rs_frame.hpp:1286
frame operator*()
Definition rs_frame.hpp:1295
frame value_type
Definition rs_frame.hpp:1285
frame & reference
Definition rs_frame.hpp:1288
std::forward_iterator_tag iterator_category
Definition rs_frame.hpp:1284
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:1101
labeled_points get_labeled_point_cloud_frame() const
Definition rs_frame.hpp:1162
pose_frame get_pose_frame(const size_t index=0) const
Definition rs_frame.hpp:1218
video_frame get_fisheye_frame(const size_t index=0) const
Definition rs_frame.hpp:1196
video_frame get_infrared_frame(const size_t index=0) const
Definition rs_frame.hpp:1173
void foreach_rs(T action) const
Definition rs_frame.hpp:1249
iterator end() const
Definition rs_frame.hpp:1302
frame operator[](size_t index) const
Definition rs_frame.hpp:1266
depth_frame get_depth_frame() const
Definition rs_frame.hpp:1129
frameset()
Definition rs_frame.hpp:1072
iterator begin() const
Definition rs_frame.hpp:1301
frameset(const frame &f)
Definition rs_frame.hpp:1077
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Definition rs_frame.hpp:1118
video_frame get_color_frame(const size_t index=0) const
Definition rs_frame.hpp:1138
size_t size() const
Definition rs_frame.hpp:1239
Definition rs_frame.hpp:824
const uint8_t * get_labels() const
Definition rs_frame.hpp:868
unsigned int get_bits_per_pixel() const
Definition rs_frame.hpp:910
size_t size() const
Definition rs_frame.hpp:877
unsigned int get_width() const
Definition rs_frame.hpp:886
unsigned int get_height() const
Definition rs_frame.hpp:898
labeled_points(const frame &f)
Definition rs_frame.hpp:835
const vertex * get_vertices() const
Definition rs_frame.hpp:856
labeled_points()
Definition rs_frame.hpp:829
motion_frame(const frame &f)
Definition rs_frame.hpp:1004
rs2_combined_motion get_combined_motion_data() const
Definition rs_frame.hpp:1029
rs2_vector get_motion_data() const
Definition rs_frame.hpp:1019
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:430
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:1036
pose_frame(const frame &f)
Definition rs_frame.hpp:1042
rs2_pose get_pose_data() const
Definition rs_frame.hpp:1056
pose_stream_profile(const stream_profile &sp)
Definition rs_frame.hpp:332
Definition rs_processing.hpp:251
Definition rs_sensor.hpp:104
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:673
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_vertex * rs2_get_frame_labeled_vertices(const rs2_frame *frame, 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)
unsigned int rs2_get_frame_labeled_points_height(const rs2_frame *frame, rs2_error **error)
unsigned int rs2_get_frame_labeled_points_width(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)
unsigned int rs2_get_frame_labeled_points_bits_per_pixel(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)
int rs2_get_frame_labeled_points_count(const 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)
void * rs2_get_frame_labels(const rs2_frame *frame, rs2_error **error)
rs2_calib_target_type
Calibration target type.
Definition rs_frame.h:170
rs2_stream
Streams are different types of data provided by RealSense devices.
Definition rs_sensor.h:47
@ RS2_STREAM_DEPTH
Definition rs_sensor.h:49
@ RS2_STREAM_ANY
Definition rs_sensor.h:48
@ RS2_STREAM_INFRARED
Definition rs_sensor.h:51
@ RS2_STREAM_LABELED_POINT_CLOUD
Definition rs_sensor.h:61
@ RS2_STREAM_COLOR
Definition rs_sensor.h:50
@ RS2_STREAM_POSE
Definition rs_sensor.h:56
@ RS2_STREAM_FISHEYE
Definition rs_sensor.h:52
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:68
@ RS2_FORMAT_RGB8
Definition rs_sensor.h:74
@ RS2_FORMAT_Z16
Definition rs_sensor.h:70
@ RS2_FORMAT_ANY
Definition rs_sensor.h:69
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:300
struct rs2_stream_profile rs2_stream_profile
Definition rs_types.h:287
@ 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_LABELED_POINTS
Definition rs_types.h:198
@ 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:276
long long rs2_metadata_type
Definition rs_types.h:324
struct rs2_frame rs2_frame
Definition rs_types.h:279
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:116
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
Definition rs_sensor.h:109
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