Struct visioncortex::SummedAreaTable
source · pub struct SummedAreaTable {
pub sums: Vec<u32>,
pub width: usize,
pub height: usize,
}
Expand description
A data structure to efficiently compute summed pixel values over regions in an image (repeatedly).
Fields§
§sums: Vec<u32>
§width: usize
§height: usize
Implementations§
source§impl SummedAreaTable
impl SummedAreaTable
sourcepub fn from_color_image(image: &ColorImage) -> Self
pub fn from_color_image(image: &ColorImage) -> Self
Creates an SAT of the same size of image, where each entry (x,y) is the sum of pixel values of the block of pixels with bottom right corner at (x,y) in image.
This construction takes 1 pass through the pixels in image.
sourcepub fn get_bot_right_sum(&self, x: i32, y: i32) -> u32
pub fn get_bot_right_sum(&self, x: i32, y: i32) -> u32
Returns the entry in the SAT.
If the input point is out of boundary, this function returns 0.
This is only to facilitate the implementation of other functions; avoid calling this function directly.
sourcepub fn get_region_sum_top_left_bot_right(
&self,
top_left: PointI32,
bot_right: PointI32
) -> u32
pub fn get_region_sum_top_left_bot_right( &self, top_left: PointI32, bot_right: PointI32 ) -> u32
Computes the sum of pixel values in the specified region in O(1) time.
sourcepub fn get_region_sum_x_y_w_h(
&self,
x: usize,
y: usize,
w: usize,
h: usize
) -> u32
pub fn get_region_sum_x_y_w_h( &self, x: usize, y: usize, w: usize, h: usize ) -> u32
Computes the sum of pixel values in the specified region in O(1) time.
sourcepub fn get_region_mean_top_left_bot_right(
&self,
top_left: PointI32,
bot_right: PointI32
) -> f64
pub fn get_region_mean_top_left_bot_right( &self, top_left: PointI32, bot_right: PointI32 ) -> f64
Computes the mean of pixel values in the specified region in O(1) time.
Auto Trait Implementations§
impl Freeze for SummedAreaTable
impl RefUnwindSafe for SummedAreaTable
impl Send for SummedAreaTable
impl Sync for SummedAreaTable
impl Unpin for SummedAreaTable
impl UnwindSafe for SummedAreaTable
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