Enum basic_frame::DynamicFrame
source · pub enum DynamicFrame {
Show 14 variants
Mono8(BasicFrame<Mono8>),
Mono32f(BasicFrame<Mono32f>),
RGB8(BasicFrame<RGB8>),
BayerRG8(BasicFrame<BayerRG8>),
BayerRG32f(BasicFrame<BayerRG32f>),
BayerGB8(BasicFrame<BayerGB8>),
BayerGB32f(BasicFrame<BayerGB32f>),
BayerGR8(BasicFrame<BayerGR8>),
BayerGR32f(BasicFrame<BayerGR32f>),
BayerBG8(BasicFrame<BayerBG8>),
BayerBG32f(BasicFrame<BayerBG32f>),
YUV444(BasicFrame<YUV444>),
YUV422(BasicFrame<YUV422>),
NV12(BasicFrame<NV12>),
}
Expand description
An image whose pixel format is known only at runtime.
When reading an image from disk, for example, its pixel format is not known in advance. This enum represents the different possible formats as different variants.
Note that we do not implement ImageData<FMT>
trait because the pixel
format (parameterized by FMT) is not known at compile-time for DynamicFrame.
Variants§
Mono8(BasicFrame<Mono8>)
Mono32f(BasicFrame<Mono32f>)
RGB8(BasicFrame<RGB8>)
BayerRG8(BasicFrame<BayerRG8>)
BayerRG32f(BasicFrame<BayerRG32f>)
BayerGB8(BasicFrame<BayerGB8>)
BayerGB32f(BasicFrame<BayerGB32f>)
BayerGR8(BasicFrame<BayerGR8>)
BayerGR32f(BasicFrame<BayerGR32f>)
BayerBG8(BasicFrame<BayerBG8>)
BayerBG32f(BasicFrame<BayerBG32f>)
YUV444(BasicFrame<YUV444>)
YUV422(BasicFrame<YUV422>)
NV12(BasicFrame<NV12>)
Implementations§
source§impl DynamicFrame
impl DynamicFrame
pub fn new( width: u32, height: u32, stride: u32, extra: Box<dyn HostTimeData>, image_data: Vec<u8>, pixel_format: PixFmt ) -> DynamicFrame
pub fn copy_from<FMT: PixelFormat>(frame: &dyn ImageStrideTime<FMT>) -> Self
pub fn from<FRAME, FMT>(frame: FRAME) -> Self
source§impl DynamicFrame
impl DynamicFrame
sourcepub fn as_basic<FMT>(self) -> Option<BasicFrame<FMT>>where
FMT: PixelFormat,
pub fn as_basic<FMT>(self) -> Option<BasicFrame<FMT>>where
FMT: PixelFormat,
Return the image as a BasicFrame
of the given pixel format.
This is done by moving the data. No copy is made.
If the image is a different pixel format than requested, None will be returned.
To convert the image data if necessary, use Self::into_pixel_format.
sourcepub fn into_pixel_format<FMT>(self) -> Result<BasicFrame<FMT>, Error>where
FMT: PixelFormat,
pub fn into_pixel_format<FMT>(self) -> Result<BasicFrame<FMT>, Error>where
FMT: PixelFormat,
Return the image as a BasicFrame
converting the data to the requested
pixel format as necessary.
To avoid converting the data, use Self::as_basic.
pub fn pixel_format(&self) -> PixFmt
sourcepub fn force_pixel_format(self, pixfmt: PixFmt) -> DynamicFrame
pub fn force_pixel_format(self, pixfmt: PixFmt) -> DynamicFrame
Force the frame into a new pixel format without altering the data.
pub fn width(&self) -> u32
pub fn height(&self) -> u32
sourcepub fn image_data_without_format(&self) -> &[u8] ⓘ
pub fn image_data_without_format(&self) -> &[u8] ⓘ
Get a view of the image data.
Note that this discards any type information about the pixel format.
pub fn into_data_extra(self) -> (Vec<u8>, Box<dyn HostTimeData>)
Trait Implementations§
source§impl Clone for DynamicFrame
impl Clone for DynamicFrame
source§fn clone(&self) -> DynamicFrame
fn clone(&self) -> DynamicFrame
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DynamicFrame
impl Debug for DynamicFrame
source§impl ExtraTimeData for DynamicFrame
impl ExtraTimeData for DynamicFrame
fn extra(&self) -> &dyn HostTimeData
source§impl From<DynamicFrame> for Vec<u8>
impl From<DynamicFrame> for Vec<u8>
source§fn from(orig: DynamicFrame) -> Self
fn from(orig: DynamicFrame) -> Self
source§impl PartialEq for DynamicFrame
impl PartialEq for DynamicFrame
source§fn eq(&self, other: &DynamicFrame) -> bool
fn eq(&self, other: &DynamicFrame) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Stride for DynamicFrame
impl Stride for DynamicFrame
impl StructuralPartialEq for DynamicFrame
Auto Trait Implementations§
impl Freeze for DynamicFrame
impl !RefUnwindSafe for DynamicFrame
impl Send for DynamicFrame
impl !Sync for DynamicFrame
impl Unpin for DynamicFrame
impl !UnwindSafe for DynamicFrame
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more