BinaryImage

Struct BinaryImage 

Source
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 duplicate 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

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§

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>,

Source§

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>,

Source§

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.