pub struct BinaryImage {
    pub pixels: BitVec,
    pub width: usize,
    pub height: usize,
}
Expand description

Image with 1 bit per pixel

Fields§

§pixels: BitVec§width: usize§height: usize

Implementations§

source§

impl BinaryImage

source

pub fn operation( &self, other: &BinaryImage, operator: impl FnMut((&mut u8, &u8)) ) -> BinaryImage

source

pub fn negative(&self) -> BinaryImage

source

pub fn diff(&self, other: &BinaryImage) -> BinaryImage

source

pub fn union(&self, other: &BinaryImage) -> BinaryImage

source

pub fn intersect(&self, other: &BinaryImage) -> BinaryImage

source

pub fn clustered_diff(&self, other: &BinaryImage) -> u32

source

pub fn significance(&self, area: u64, threshold: u32) -> u32

early return if diff >= threshold, so maximum return value is equal to threshold

source

pub fn diff_and_count(&self, other: &BinaryImage) -> usize

source

pub fn popcount(i: u32) -> u32

source

pub fn stroke(&self, s: u32) -> BinaryImage

expand a binary image using a circular brush

source§

impl BinaryImage

source

pub fn to_skeleton(&self) -> Skeleton

An extremely fast implementation of skeletonization

source§

impl BinaryImage

source

pub fn to_clusters(&self, diagonal: bool) -> Clusters

source§

impl BinaryImage

source

pub fn new_w_h(width: usize, height: usize) -> BinaryImage

source

pub fn get_pixel_at(&self, p: PointI32) -> bool

source

pub fn get_pixel(&self, x: usize, y: usize) -> bool

source

pub fn get_pixel_at_safe(&self, p: PointI32) -> bool

source

pub fn get_pixel_safe(&self, x: i32, y: i32) -> bool

source

pub fn set_pixel(&mut self, x: usize, y: usize, v: bool)

source

pub fn set_pixel_at(&mut self, p: PointI32, v: bool)

source

pub fn set_pixel_index(&mut self, i: usize, v: bool)

source

pub fn set_pixel_safe(&mut self, x: i32, y: i32, v: bool) -> bool

source

pub fn set_pixel_at_safe(&mut self, p: PointI32, v: bool)

source

pub fn bounding_rect(&self) -> BoundingRect

source

pub fn area(&self) -> u64

source

pub fn crop(&self) -> BinaryImage

crop image to fit content

source

pub fn crop_with_rect(&self, rect: BoundingRect) -> BinaryImage

crop a specific area from image

source

pub fn uncrop(&self, new_width: usize, new_height: usize) -> BinaryImage

expand the image while center original image so that there will be more space surrounding

source

pub fn from_string(string: &str) -> Self

source

pub fn rotate(&self, angle: f64) -> BinaryImage

source

pub fn paste_from(&mut self, src: &BinaryImage, offset: PointI32)

Paste the content of src into self, with offset with respective to the upper-left corner.

source

pub fn to_color_image(&self) -> ColorImage

Trait Implementations§

source§

impl Clone for BinaryImage

source§

fn clone(&self) -> BinaryImage

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BinaryImage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BinaryImage

source§

fn default() -> BinaryImage

Returns the “default value” for a type. Read more
source§

impl Display for BinaryImage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<BinaryImage> for Shape

source§

fn from(image: BinaryImage) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.