Struct rxing::PlanarYUVLuminanceSource
source · pub struct PlanarYUVLuminanceSource { /* private fields */ }Expand description
This object extends LuminanceSource around an array of YUV data returned from the camera driver, with the option to crop to a rectangle within the full data. This can be used to exclude superfluous pixels around the perimeter and speed up decoding.
It works for any pixel format where the Y channel is planar and appears first, including YCbCr_420_SP and YCbCr_422_SP.
@author dswitkin@google.com (Daniel Switkin)
Implementations§
source§impl PlanarYUVLuminanceSource
impl PlanarYUVLuminanceSource
pub fn new_with_all(
yuv_data: Vec<u8>,
data_width: usize,
data_height: usize,
left: usize,
top: usize,
width: usize,
height: usize,
reverse_horizontal: bool,
inverted: bool
) -> Result<Self, Exceptions>
pub fn renderThumbnail(&self) -> Vec<u8> ⓘ
sourcepub fn getThumbnailWidth(&self) -> usize
pub fn getThumbnailWidth(&self) -> usize
@return width of image from {@link #renderThumbnail()}
sourcepub fn getThumbnailHeight(&self) -> usize
pub fn getThumbnailHeight(&self) -> usize
@return height of image from {@link #renderThumbnail()}
Trait Implementations§
source§impl Clone for PlanarYUVLuminanceSource
impl Clone for PlanarYUVLuminanceSource
source§fn clone(&self) -> PlanarYUVLuminanceSource
fn clone(&self) -> PlanarYUVLuminanceSource
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for PlanarYUVLuminanceSource
impl Debug for PlanarYUVLuminanceSource
source§impl LuminanceSource for PlanarYUVLuminanceSource
impl LuminanceSource for PlanarYUVLuminanceSource
source§fn getRow(&self, y: usize) -> Vec<u8> ⓘ
fn getRow(&self, y: usize) -> Vec<u8> ⓘ
Fetches one row of luminance data from the underlying platform’s bitmap. Values range from
0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have
to bitwise and with 0xff for each value. It is preferable for implementations of this method
to only fetch this row rather than the whole image, since no 2D Readers may be installed and
getMatrix() may never be called. Read more
source§fn getMatrix(&self) -> Vec<u8> ⓘ
fn getMatrix(&self) -> Vec<u8> ⓘ
Fetches luminance data for the underlying bitmap. Values should be fetched using:
{@code int luminance = array[y * width + x] & 0xff} Read more
source§fn isCropSupported(&self) -> bool
fn isCropSupported(&self) -> bool
@return Whether this subclass supports cropping.
source§fn crop(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Result<Box<dyn LuminanceSource>, Exceptions>
fn crop(
&self,
left: usize,
top: usize,
width: usize,
height: usize
) -> Result<Box<dyn LuminanceSource>, Exceptions>
Returns a new object with cropped image data. Implementations may keep a reference to the
original data rather than a copy. Only callable if isCropSupported() is true. Read more
source§fn isRotateSupported(&self) -> bool
fn isRotateSupported(&self) -> bool
@return Whether this subclass supports counter-clockwise rotation.
source§fn invert(&mut self)
fn invert(&mut self)
@return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns – black becomes
white and vice versa, and each value becomes (255-value).
source§fn rotateCounterClockwise(&self) -> Result<Box<dyn LuminanceSource>, Exceptions>
fn rotateCounterClockwise(&self) -> Result<Box<dyn LuminanceSource>, Exceptions>
Returns a new object with rotated image data by 90 degrees counterclockwise.
Only callable if {@link #isRotateSupported()} is true. Read more
source§fn rotateCounterClockwise45(
&self
) -> Result<Box<dyn LuminanceSource>, Exceptions>
fn rotateCounterClockwise45(
&self
) -> Result<Box<dyn LuminanceSource>, Exceptions>
Returns a new object with rotated image data by 45 degrees counterclockwise.
Only callable if {@link #isRotateSupported()} is true. Read more
fn invert_block_of_bytes(&self, vec_to_invert: Vec<u8>) -> Vec<u8> ⓘ
Auto Trait Implementations§
impl RefUnwindSafe for PlanarYUVLuminanceSource
impl Send for PlanarYUVLuminanceSource
impl Sync for PlanarYUVLuminanceSource
impl Unpin for PlanarYUVLuminanceSource
impl UnwindSafe for PlanarYUVLuminanceSource
Blanket Implementations§
§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.§impl<Src> TryFrom<Src> for Src
impl<Src> TryFrom<Src> for Src
§impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
§impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
§fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.