Struct realsense_rust::frame::ImageFrame [−][src]
pub struct ImageFrame<Kind> { /* fields omitted */ }
Expand description
Holds the raw data pointer and derived data for an RS2 Image frame.
This generic type isn’t particularly useful on it’s own. In all cases, you want a specialized
version of this class (DepthFrame
, ColorFrame
, DisparityFrame
).
Implementations
Given the 2D depth coordinate (x,y) provide the corresponding depth in metric units.
Warning
It is fairly expensive to use this in practice as it will copy the underlying pixel into a
f32 value that gives you the direct distance. In practice getting
DepthFrame::depth_units
and then applying that to the raw data with ImageFrame::get
is a much more efficient way to handle this.
Get the metric units currently used for reporting depth information.
Given the 2D depth coordinate (x,y) provide the corresponding depth in metric units.
Warning
Like with depth frames, this method is fairly expensive to use in practice. The disparity can be converted to depth fairly easily, but this will effectively copy every pixel if you loop through the data with this method for every index.
It is often much more efficient to directly stream the
Rs2Format::Distance
format if you want the distance
directly, and access the frame data with ImageFrame::get
.
Get the metric units currently used for reporting depth information.
Get a pixel value from the Video Frame.
Safety
This makes a call directly to the underlying data pointer inherited from
the rs2_frame
.
Get the bits per pixel.
Get the size of the data in this Video frame in bytes.
Get a reference to the raw data held by this Video frame.
Safety
This is a raw pointer to the underlying data. This data has to be interpreted according to
the format of the frame itself. In most scenarios you will probably want to just use the
get_unchecked
function associated with the FrameEx
trait, but
this can be useful if you need more immediate access to the underlying pixel data.
Trait Implementations
Attempt to construct an Image frame of extension K from the raw rs2_frame
.
All members of the ImageFrame
struct are validated and populated during this call.
Errors
There are a number of errors that may occur if the data in the rs2_frame
is not valid,
all of type FrameConstructionError
.
CouldNotGetWidth
CouldNotGetHeight
CouldNotGetBitsPerPixel
CouldNotGetStride
CouldNotGetTimestamp
CouldNotGetTimestampDomain
CouldNotGetFrameStreamProfile
CouldNotGetDataSize
CouldNotGetData
See FrameConstructionError
documentation for more details.
Auto Trait Implementations
impl<Kind> RefUnwindSafe for ImageFrame<Kind> where
Kind: RefUnwindSafe,
impl<Kind> !Sync for ImageFrame<Kind>
impl<Kind> Unpin for ImageFrame<Kind> where
Kind: Unpin,
impl<Kind> UnwindSafe for ImageFrame<Kind> where
Kind: UnwindSafe,