|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
4 #ifndef LIBREALSENSE_RS2_FRAME_HPP
5 #define LIBREALSENSE_RS2_FRAME_HPP
14 class processing_block;
18 class pipeline_profile;
20 class video_stream_profile;
115 std::stringstream ss;
131 operator bool()
const {
return _profile !=
nullptr; }
181 explicit operator std::shared_ptr<rs2_stream_profile>() {
return _clone; }
190 std::shared_ptr<rs2_stream_profile>
_clone;
380 other.frame_ref =
nullptr;
382 frame_number = other.frame_number;
383 profile = other.profile;
401 : frame_ref(other.frame_ref)
405 frame_number = other.frame_number;
406 profile = other.profile;
418 std::swap(frame_number, other.frame_number);
443 operator bool()
const {
return frame_ref !=
nullptr; }
632 unsigned long long frame_number = 0;
722 return (e ==
nullptr);
728 operator const float*()
const {
return &
x; }
732 operator const float*()
const {
return &
u; }
772 return (
const vertex*)res;
984 result = std::move(frm);
998 if (!frm)
throw error(
"Frame of requested stream type was not found!");
1110 auto count =
size();
1111 for (
size_t i = 0; i < count; i++)
1116 action(
frame(fref));
1134 throw error(
"Requested index is out of range!");
1137 class iterator :
public std::iterator<std::forward_iterator_tag, frame>
1160 T on_frame_function;
1166 on_frame_function(
frame{ fref });
1172 #endif // LIBREALSENSE_RS2_FRAME_HPP
void rs2_get_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics *extrin, rs2_error **error)
void rs2_register_extrinsics(const rs2_stream_profile *from, const rs2_stream_profile *to, rs2_extrinsics extrin, rs2_error **error)
video_frame get_fisheye_frame(const size_t index=0) const
Retrieve the fisheye monochrome video frame.
3D vector in Euclidean coordinate space
void foreach_rs(T action) const
Template function, extract internal frame handles from the frameset and invoke the action function.
rs2_metadata_type rs2_get_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
retrieve metadata from frame handle
motion_stream_profile(const stream_profile &sp)
Stream profile instance which contains IMU-specific intrinsics.
rs2_format format() const
Return the stream format.
bool operator==(const stream_profile &rhs)
Comparison operator, compare if two stream profiles are the same.
int get_stride_in_bytes() const
retrieve frame stride, meaning the actual line width in memory in bytes (not the logical image width)
depth_frame get_depth_frame() const
Retrieve the first depth frame, if no frame is found, return an empty frame instance.
float rs2_depth_frame_get_units(const rs2_frame *frame, rs2_error **error)
retrieve the scaling factor to use when converting a depth frame's get_data() units to meters
@ RS2_EXTENSION_DEPTH_FRAME
void rs2_delete_stream_profile(rs2_stream_profile *mode)
Delete stream profile allocated by rs2_clone_stream_profile Should not be called on stream profiles r...
stream_profile clone(rs2_stream type, int index, rs2_format format, int width, int height, const rs2_intrinsics &intr) const
Clone current profile and change the type, index and format to input parameters.
rs2_intrinsics get_intrinsics() const
Get stream profile instrinsics attributes.
The source used to generate frames, which is usually done by the low level driver for each sensor.
float get_distance(int x, int y) const
Provide the depth in meters at the given pixel.
Cross-stream extrinsics: encodes the topology describing how the different devices are oriented.
bool extract_target_dimensions(rs2_calib_target_type calib_type, float *target_dims, unsigned int target_dims_size) const
Extract the target dimensions on the specific target.
void rs2_get_video_stream_intrinsics(const rs2_stream_profile *mode, rs2_intrinsics *intrinsics, rs2_error **error)
When called on a video profile, returns the intrinsics of specific stream configuration.
rs2_sensor * get_sensor()
int fps() const
Return the stream frame per second.
stream_profile(const rs2_stream_profile *profile)
bool is() const
Template function, checking if current instance is the type of another class.
T as() const
Template function, casting the instance as another class type.
float get_baseline(void) const
Retrieve the distance between the two IR sensors.
frame first(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Retrieve the first frame of a specific stream type and optionally with a specific format.
const vertex * get_vertices() const
Retrieve the vertices of the point cloud.
void swap(frame &other)
Swap the internal frame handle with the one in parameter.
void keep()
keep the frame, otherwise if no refernce to the frame, the frame will be released.
frame & operator=(frame other)
Change the internal frame handle to the one in parameter, the function exchange the internal frame ha...
rs2_frame * rs2_extract_frame(rs2_frame *composite, int index, rs2_error **error)
Extract frame from within a composite frame.
frame apply_filter(filter_interface &filter)
rs2_vertex * rs2_get_frame_vertices(const rs2_frame *frame, rs2_error **error)
When called on Points frame type, this method returns a pointer to an array of 3D vertices of the mod...
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)
Extract the target dimensions on the specific target.
frame first_or_default(rs2_stream s, rs2_format f=RS2_FORMAT_ANY) const
Retrieve the first frame of a specific stream and optionally with a specific format.
unsigned long long get_frame_number() const
retrieve frame number (from frame handle)
std::string stream_name() const
Return the string of stream name.
rs2_stream stream_type() const
Return the stream type.
stream_profile clone(rs2_stream type, int index, rs2_format format) const
Clone the current profile and change the type, index and format to input parameters.
pose_stream_profile(const stream_profile &sp)
Stream profile instance with an explicit pose extension type.
int rs2_stream_profile_is(const rs2_stream_profile *mode, rs2_extension type, rs2_error **error)
Try to extend stream profile to an extension type.
rs2_motion_device_intrinsic get_motion_intrinsics() const
Returns scale/bias/covariances of a the motion sensors.
@ RS2_EXTENSION_MOTION_FRAME
@ RS2_STREAM_COLOR
Native stream of color data captured by RealSense device.
@ RS2_STREAM_DEPTH
Native stream of depth data produced by RealSense device.
const void * get_data() const
retrieve data from frame handle
rs2_extrinsics get_extrinsics_to(const stream_profile &to) const
Operator implement, return the internal stream profile instance.
frame operator[](size_t index) const
Bracket operator retrieves back the frame from frameset using arrary notation.
int rs2_get_frame_stride_in_bytes(const rs2_frame *frame, rs2_error **error)
retrieve frame stride in bytes (number of bytes from start of line N to start of line N+1)
int get_bits_per_pixel() const
retrieve bits per pixel
int rs2_get_frame_data_size(const rs2_frame *frame, rs2_error **error)
retrieve data size from frame handle
void rs2_release_frame(rs2_frame *frame)
relases the frame handle
pose_frame get_pose_frame(const size_t index=0) const
Retrieve the pose frame.
bool supports_frame_metadata(rs2_frame_metadata_value frame_metadata) const
determine if the device allows a specific metadata to be queried
void rs2_export_to_ply(const rs2_frame *frame, const char *fname, rs2_frame *texture, rs2_error **error)
When called on Points frame type, this method creates a ply file of the model with the given file nam...
Motion device intrinsics: scale, bias, and variances.
double get_timestamp() const
retrieve the time at which the frame was captured During the frame's lifetime it receives timestamps ...
depth_frame(const frame &f)
Extends the video_frame class with additional depth related attributes and functions.
stream_profile()
Class to store the profile of stream.
frameset(const frame &f)
Extends the frame class with additional frameset related attributes and functions.
float rs2_depth_stereo_frame_get_baseline(const rs2_frame *frame_ref, rs2_error **error)
Retrieve the stereoscopic baseline value from frame.
frame()
Base class for multiple frame extensions.
frame(frame &&other) noexcept
Change the internal frame handle to the one in parameter, then put the other frame internal frame han...
struct rs2_stream_profile rs2_stream_profile
Define the processing block flow, inherit this class to generate your own processing_block.
struct rs2_sensor rs2_sensor
rs2_timestamp_domain rs2_get_frame_timestamp_domain(const rs2_frame *frameset, rs2_error **error)
retrieve timestamp domain from frame handle.
rs2_frame * get() const
Retrieve back the internal frame handle.
std::shared_ptr< rs2_stream_profile > _clone
size_t size() const
Return the size of the frameset.
void on_frame(rs2_frame *fref) override
video_stream_profile(const stream_profile &sp)
Stream profile instance which contains additional video attributes.
rs2_time_t rs2_get_frame_timestamp(const rs2_frame *frame, rs2_error **error)
retrieve timestamp from frame handle in milliseconds
int rs2_get_frame_width(const rs2_frame *frame, rs2_error **error)
retrieve frame width in pixels
@ RS2_EXTENSION_VIDEO_FRAME
@ RS2_EXTENSION_VIDEO_PROFILE
const rs2_stream_profile * _profile
frame(rs2_frame *ref)
Base class for multiple frame extensions with internal frame handle.
void rs2_get_motion_intrinsics(const rs2_stream_profile *mode, rs2_motion_device_intrinsic *intrinsics, rs2_error **error)
Obtain the intrinsics of a specific stream configuration from the device.
rs2_sensor * rs2_get_frame_sensor(const rs2_frame *frame, rs2_error **error)
retrieve frame parent sensor from frame handle
struct rs2_frame rs2_frame
video_frame(const frame &f)
Extends the frame class with additional video related attributes and functions.
@ RS2_STREAM_FISHEYE
Native stream of fish-eye (wide) data captured from the dedicate motion camera.
int get_width() const
returns image width in pixels
bool operator==(const iterator &other) const
bool operator==(const video_stream_profile &other) const
void rs2_keep_frame(rs2_frame *frame)
communicate to the library you intend to keep the frame alive for a while this will remove the frame ...
@ RS2_EXTENSION_COMPOSITE_FRAME
rs2_frame_metadata_value
Per-Frame-Metadata is the set of read-only properties that might be exposed for each individual frame...
const rs2_stream_profile * get() const
Get back the internal stream profile instance.
@ RS2_STREAM_INFRARED
Native stream of infrared data captured by RealSense device.
rs2_pixel * rs2_get_frame_texture_coordinates(const rs2_frame *frame, rs2_error **error)
When called on Points frame type, this method returns a pointer to an array of texture coordinates pe...
bool is_default() const
Checks if stream profile is marked/assigned as default, meaning that the profile will be selected whe...
const rs2_stream_profile * rs2_get_frame_stream_profile(const rs2_frame *frame, rs2_error **error)
Returns the stream profile that was used to start the stream of this frame.
@ RS2_FORMAT_ANY
When passed to enable stream, librealsense will try to provide best suited format.
float rs2_depth_frame_get_distance(const rs2_frame *frame_ref, int x, int y, rs2_error **error)
Given the 2D depth coordinate (x,y) provide the corresponding depth in metric units.
rs2_format
A stream's format identifies how binary data is encoded within a frame.
int rs2_supports_frame_metadata(const rs2_frame *frame, rs2_frame_metadata_value frame_metadata, rs2_error **error)
determine device metadata
~frame()
releases the frame handle
const void * rs2_get_frame_data(const rs2_frame *frame, rs2_error **error)
retrieve data from frame handle
frameset()
Extends the frame class with additional frameset related attributes and functions.
rs2_calib_target_type
Calibration target type.
int rs2_is_stream_profile_default(const rs2_stream_profile *mode, rs2_error **error)
Returns non-zero if selected profile is recommended for the sensor This is an optional hint we offer ...
float get_units() const
Provide the scaling factor to use when converting from get_data() units to meters.
points(const frame &f)
Extends the frame class with additional point cloud related attributes and functions.
video_frame get_color_frame() const
Retrieve the first color frame, if no frame is found, search for the color frame from IR stream.
bool is() const
Template function, checking if the instance belongs to specific class type.
rs2_metadata_type get_frame_metadata(rs2_frame_metadata_value frame_metadata) const
retrieve the current value of a single frame_metadata
rs2_stream_profile * rs2_clone_stream_profile(const rs2_stream_profile *mode, rs2_stream stream, int index, rs2_format format, rs2_error **error)
Creates a copy of stream profile, assigning new values to some of the fields.
frame_callback(T on_frame)
virtual ~filter_interface()=default
void register_extrinsics_to(const stream_profile &to, rs2_extrinsics extrinsics)
Assign extrinsic transformation parameters to a specific profile (sensor).
points()
Extends the frame class with additional point cloud related attributes and functions.
rs2_timestamp_domain get_frame_timestamp_domain() const
retrieve the timestamp domain
T as() const
Template function, cast current instance as the type of another class.
Interface for frame filtering functionality.
frame(const frame &other)
Set the internal frame handle to the one in parameter, the function create additional reference if in...
Define the filter workflow, inherit this class to generate your own filter.
@ RS2_FORMAT_Z16
16-bit linear depth values.
@ RS2_EXTENSION_POSE_FRAME
@ RS2_STREAM_POSE
6 Degrees of Freedom pose data, calculated by RealSense device
const int get_data_size() const
retrieve data size from frame handle
void rs2_get_video_stream_resolution(const rs2_stream_profile *mode, int *width, int *height, rs2_error **error)
When called on a video stream profile, will return the width and the height of the stream.
int rs2_is_frame_extendable_to(const rs2_frame *frame, rs2_extension extension_type, rs2_error **error)
Test if the given frame can be extended to the requested extension.
stream_profile get_profile() const
retrieve stream profile from frame handle
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)
Extract common parameters of a stream profiles.
int unique_id() const
Return the assigned unique index when the stream was created.
long long rs2_metadata_type
Metadata attribute type is defined as 64 bit signed integer.
virtual rs2::frame process(rs2::frame frame) const =0
static void handle(rs2_error *e)
video_frame get_infrared_frame(const size_t index=0) const
Retrieve the first infrared frame, if no frame is found, return an empty frame instance.
void export_to_ply(const std::string &fname, video_frame texture)
Export the point cloud to a PLY file.
void rs2_pose_frame_get_pose_data(const rs2_frame *frame, rs2_pose *pose, rs2_error **error)
When called on Pose frame type, this method returns the transformation represented by the pose data.
iterator(const frameset *owner, size_t index=0)
const texture_coordinate * get_texture_coordinates() const
Retrieve the texture coordinates (uv map) for the point cloud.
int get_bytes_per_pixel() const
retrieve bytes per pixel
int rs2_get_frame_bits_per_pixel(const rs2_frame *frame, rs2_error **error)
retrieve bits per pixels in the frame image (note that bits per pixel is not necessarily divided by 8...
motion_frame(const frame &f)
Extends the frame class with additional motion related attributes and functions.
void rs2_frame_add_ref(rs2_frame *frame, rs2_error **error)
create additional reference to a frame without duplicating frame data
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)
Creates a copy of stream profile, assigning new values to some of the fields.
The pipeline profile includes a device and a selection of active streams, with specific profiles.
int rs2_embedded_frames_count(rs2_frame *composite, rs2_error **error)
Get number of frames embedded within a composite frame.
Generates 3D point clouds based on a depth frame.
int rs2_get_frame_height(const rs2_frame *frame, rs2_error **error)
retrieve frame height in pixels
@ RS2_EXTENSION_POSE_PROFILE
int rs2_get_frame_points_count(const rs2_frame *frame, rs2_error **error)
When called on Points frame type, this method returns the number of vertices in the frame.
@ RS2_EXTENSION_MOTION_PROFILE
rs2_pose get_pose_data() const
Retrieve the pose data from T2xx position tracking sensor.
rs2_vector get_motion_data() const
Retrieve the motion data from IMU sensor.
unsigned long long rs2_get_frame_number(const rs2_frame *frame, rs2_error **error)
retrieve frame number from frame handle
int stream_index() const
Return the specific stream index.
bool operator!=(const iterator &other) const
void add_ref() const
add additional reference to a frame without duplicating frame data
@ RS2_EXTENSION_DISPARITY_FRAME
pose_frame(const frame &f)
Extends the frame class with additional pose related attributes and functions.
const char * rs2_stream_to_string(rs2_stream stream)
disparity_frame(const frame &f)
Extend depth_frame class with additional disparity related attributes/functions.
rs2_stream
Streams are different types of data provided by RealSense devices.
int get_height() const
returns image height in pixels
rs2::frame process(rs2::frame frame) const override
Ask processing block to process the frame and poll the processed frame from internal queue.
rs2_timestamp_domain
Specifies the clock in relation to which the frame timestamp was measured.
@ RS2_FORMAT_RGB8
8-bit red, green and blue channels
struct rs2_error rs2_error