Struct visioncortex::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
impl BinaryImage
pub fn operation( &self, other: &BinaryImage, operator: impl FnMut((&mut u8, &u8)) ) -> BinaryImage
pub fn negative(&self) -> BinaryImage
pub fn diff(&self, other: &BinaryImage) -> BinaryImage
pub fn union(&self, other: &BinaryImage) -> BinaryImage
pub fn intersect(&self, other: &BinaryImage) -> BinaryImage
pub fn clustered_diff(&self, other: &BinaryImage) -> u32
sourcepub fn significance(&self, area: u64, threshold: u32) -> u32
pub fn significance(&self, area: u64, threshold: u32) -> u32
early return if diff >= threshold, so maximum return value is equal to threshold
pub fn diff_and_count(&self, other: &BinaryImage) -> usize
pub fn popcount(i: u32) -> u32
sourcepub fn stroke(&self, s: u32) -> BinaryImage
pub fn stroke(&self, s: u32) -> BinaryImage
expand a binary image using a circular brush
source§impl BinaryImage
impl BinaryImage
sourcepub fn to_skeleton(&self) -> Skeleton
pub fn to_skeleton(&self) -> Skeleton
An extremely fast implementation of skeletonization
source§impl BinaryImage
impl BinaryImage
pub fn to_clusters(&self, diagonal: bool) -> Clusters
source§impl BinaryImage
impl BinaryImage
pub fn new_w_h(width: usize, height: usize) -> BinaryImage
pub fn get_pixel_at(&self, p: PointI32) -> bool
pub fn get_pixel(&self, x: usize, y: usize) -> bool
pub fn get_pixel_at_safe(&self, p: PointI32) -> bool
pub fn get_pixel_safe(&self, x: i32, y: i32) -> bool
pub fn set_pixel(&mut self, x: usize, y: usize, v: bool)
pub fn set_pixel_at(&mut self, p: PointI32, v: bool)
pub fn set_pixel_index(&mut self, i: usize, v: bool)
pub fn set_pixel_safe(&mut self, x: i32, y: i32, v: bool) -> bool
pub fn set_pixel_at_safe(&mut self, p: PointI32, v: bool)
pub fn bounding_rect(&self) -> BoundingRect
pub fn area(&self) -> u64
sourcepub fn crop(&self) -> BinaryImage
pub fn crop(&self) -> BinaryImage
crop image to fit content
sourcepub fn crop_with_rect(&self, rect: BoundingRect) -> BinaryImage
pub fn crop_with_rect(&self, rect: BoundingRect) -> BinaryImage
crop a specific area from image
sourcepub fn uncrop(&self, new_width: usize, new_height: usize) -> BinaryImage
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
pub fn from_string(string: &str) -> Self
pub fn rotate(&self, angle: f64) -> BinaryImage
sourcepub fn paste_from(&mut self, src: &BinaryImage, offset: PointI32)
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.
pub fn to_color_image(&self) -> ColorImage
Trait Implementations§
source§impl Clone for BinaryImage
impl Clone for BinaryImage
source§fn clone(&self) -> BinaryImage
fn clone(&self) -> BinaryImage
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 BinaryImage
impl Debug for BinaryImage
source§impl Default for BinaryImage
impl Default for BinaryImage
source§fn default() -> BinaryImage
fn default() -> BinaryImage
Returns the “default value” for a type. Read more
source§impl Display for BinaryImage
impl Display for BinaryImage
source§impl From<BinaryImage> for Shape
impl From<BinaryImage> for Shape
source§fn from(image: BinaryImage) -> Self
fn from(image: BinaryImage) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for BinaryImage
impl RefUnwindSafe for BinaryImage
impl Send for BinaryImage
impl Sync for BinaryImage
impl Unpin for BinaryImage
impl UnwindSafe for BinaryImage
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more