[−][src]Struct bardecoder::prepare::BlockedMean
Reduce the image to black/white by calculating local thresholds
The algorithm runs the following steps:
- Divide the image into blocks and count the cumulative grayscale value of all pixels in the block
- For each block of blocks, take mean grayscale value by adding each block's value and dividing by total number of pixels
- 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 blockblock_mean_size
: width in blocks of each block of blocks
Trait Implementations
impl Prepare<DynamicImage, ImageBuffer<Luma<u8>, Vec<u8>>> for BlockedMean
[src]
fn prepare(&self, input: DynamicImage) -> GrayImage
[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]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.