[][src]Struct bardecoder::prepare::BlockedMean

pub struct BlockedMean { /* fields omitted */ }

Reduce the image to black/white by calculating local thresholds

The algorithm runs the following steps:

  1. Divide the image into blocks and count the cumulative grayscale value of all pixels in the block
  2. For each block of blocks, take mean grayscale value by adding each block's value and dividing by total number of pixels
  3. For each pixel in the image, see if the grayscale value of that pixel exceeds the mean of its corresponding block. If so, output a white pixel. If not, output a black pixel

Methods

impl BlockedMean[src]

pub fn new(block_size: u32, block_mean_size: u32) -> BlockedMean[src]

Construct a new BlockedMean

Arguments

  • block_size: width in pixels of each block
  • block_mean_size: width in blocks of each block of blocks

Trait Implementations

impl Prepare<DynamicImage, ImageBuffer<Luma<u8>, Vec<u8>>> for BlockedMean[src]

Auto Trait Implementations

impl Send for BlockedMean

impl Sync for BlockedMean

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.