Struct image2::kernel::Kernel

source ·
pub struct Kernel { /* private fields */ }
Expand description

2-dimensional convolution kernel

Implementations§

source§

impl Kernel

source

pub fn new(rows: usize, cols: usize) -> Kernel

Create a new kernel with the given number of rows and columns

source

pub fn square(x: usize) -> Kernel

Create a new, square kernel

source

pub fn normalize(&mut self)

Ensures the sum of the kernel is <= 1

source

pub fn create<F: Fn(usize, usize) -> f64>( rows: usize, cols: usize, f: F ) -> Kernel

Create a new kernel and fill it by executing f with each possible (row, col) pair

source

pub fn gaussian(n: usize, std: f64) -> Kernel

Generate gaussian blur kernel

source

pub fn gaussian_3x3() -> Kernel

3x3 pixel gaussian blur

source

pub fn gaussian_5x5() -> Kernel

5x5 pixel gaussian blur

source

pub fn gaussian_7x7() -> Kernel

7x7 pixel gaussian blur

source

pub fn gaussian_9x9() -> Kernel

9x9 pixel gaussian blur

source

pub fn sobel_x() -> Kernel

Sobel X

source

pub fn sobel_y() -> Kernel

Sobel Y

source

pub fn laplacian() -> Kernel

Laplacian

source

pub fn sobel() -> Kernel

Sobel X and Y combined

Trait Implementations§

source§

impl Add<Kernel> for Kernel

§

type Output = Kernel

The resulting type after applying the + operator.
source§

fn add(self, other: Kernel) -> Kernel

Performs the + operation. Read more
source§

impl Clone for Kernel

source§

fn clone(&self) -> Kernel

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 Kernel

source§

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

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

impl<'de> Deserialize<'de> for Kernel

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Div<Kernel> for Kernel

§

type Output = Kernel

The resulting type after applying the / operator.
source§

fn div(self, other: Kernel) -> Kernel

Performs the / operation. Read more
source§

impl<T: Type, C: Color, U: Type, D: Color> Filter<T, C, U, D> for Kernel

source§

fn schedule(&self) -> Schedule

Determines whether a filter should be executed one pixel at a time, or a whole image at a time
source§

fn compute_at( &self, pt: Point, input: &Input<'_, T, C>, dest: &mut DataMut<'_, U, D> )

Compute filter at the given point for the provided input Read more
source§

fn output_size(&self, _input: &Input<'_, T, C>, dest: &mut Image<U, D>) -> Size

Get filter output size, this is typically the destination image size, however when used as part of a pipeline a single filter might have a different output size
source§

fn eval_partial( &self, roi: Region, input: &[&Image<T, C>], output: &mut Image<U, D> )

Evaluate a filter on part of an image
source§

fn eval_partial_in_place(&self, roi: Region, output: &mut Image<U, D>)

Evaluate filter on part of an image using the same image for input and output
source§

fn eval(&self, input: &[&Image<T, C>], output: &mut Image<U, D>)

Evaluate filter
source§

fn eval_in_place(&self, output: &mut Image<U, D>)

Evaluate filter using the same image for input and output
source§

impl<'a> From<&'a [&'a [f64]]> for Kernel

source§

fn from(data: &'a [&'a [f64]]) -> Kernel

Converts to this type from the input type.
source§

impl<const N: usize> From<[[f64; N]; N]> for Kernel

source§

fn from(data: [[f64; N]; N]) -> Kernel

Converts to this type from the input type.
source§

impl From<Vec<Vec<f64, Global>, Global>> for Kernel

source§

fn from(data: Vec<Vec<f64>>) -> Kernel

Converts to this type from the input type.
source§

impl Mul<Kernel> for Kernel

§

type Output = Kernel

The resulting type after applying the * operator.
source§

fn mul(self, other: Kernel) -> Kernel

Performs the * operation. Read more
source§

impl PartialEq<Kernel> for Kernel

source§

fn eq(&self, other: &Kernel) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Kernel

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Sub<Kernel> for Kernel

§

type Output = Kernel

The resulting type after applying the - operator.
source§

fn sub(self, other: Kernel) -> Kernel

Performs the - operation. Read more
source§

impl StructuralPartialEq for Kernel

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,