pub struct StructuringElement {
pub width: usize,
pub height: usize,
pub anchor_x: usize,
pub anchor_y: usize,
pub mask: Vec<bool>,
}Expand description
A binary structuring element (neighbourhood mask) with an anchor.
The mask is a row-major [height × width] boolean grid; true cells are
members of the neighbourhood. The anchor (anchor_y, anchor_x) marks the
cell that aligns with the output pixel — typically the geometric centre.
Fields§
§width: usizeElement width (number of columns).
height: usizeElement height (number of rows).
anchor_x: usizeAnchor column (origin of the element), < width.
anchor_y: usizeAnchor row (origin of the element), < height.
mask: Vec<bool>Row-major [height × width] membership mask (true = member).
Implementations§
Source§impl StructuringElement
impl StructuringElement
Sourcepub fn new(width: usize, height: usize, mask: Vec<bool>) -> VisionResult<Self>
pub fn new(width: usize, height: usize, mask: Vec<bool>) -> VisionResult<Self>
Build a structuring element from an explicit [height × width] mask,
anchored at its geometric centre (height / 2, width / 2).
§Errors
Returns VisionError::EmptyInput if the element is degenerate (zero
dimension or no member cells) and VisionError::DimensionMismatch if
mask.len() != width * height.
Sourcepub fn rect(width: usize, height: usize) -> VisionResult<Self>
pub fn rect(width: usize, height: usize) -> VisionResult<Self>
Build a solid (all-member) width × height rectangular element anchored
at its centre.
§Errors
Returns VisionError::EmptyInput if either dimension is zero.
Sourcepub fn square(size: usize) -> VisionResult<Self>
pub fn square(size: usize) -> VisionResult<Self>
Trait Implementations§
Source§impl Clone for StructuringElement
impl Clone for StructuringElement
Source§fn clone(&self) -> StructuringElement
fn clone(&self) -> StructuringElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StructuringElement
impl Debug for StructuringElement
impl Eq for StructuringElement
Source§impl PartialEq for StructuringElement
impl PartialEq for StructuringElement
Source§fn eq(&self, other: &StructuringElement) -> bool
fn eq(&self, other: &StructuringElement) -> bool
self and other values to be equal, and is used by ==.