Struct ImageArray

Source
pub struct ImageArray<T: Gradient + Average + VectorLen + Norm> { /* private fields */ }
Expand description

An array representing an image, used with the solvers. The From trait is implemented for the types GrayImage and RgbImage in the image crate.

Implementations§

Source§

impl ImageArray<Array3<f64>>

Source

pub fn into_luma(&self) -> GrayImage

Assumes Array3 axis 2 is colors, will flatten axis 2 if bigger than 1.

Source

pub fn into_rgb(&self) -> RgbImage

Assumes Array3 axis 2 is colors, will use 3 first elements of axis 2 if bigger than 3, or cycle through the elements if smaller than 3.

Source§

impl ImageArray<Array3<f64>>

Source

pub fn denoise( &self, lambda: f64, tau: f64, sigma: f64, gamma: f64, max_iter: u32, convergence_threshold: f64, ) -> Result<Self, ShapeError>

Image denoising algorithm for 2 dimentional shapes with 1 dimention of information (pixels) as an arbitrarily sized vector. Assumes axes 0 and 1 and the x and y coordinates of the image, and axis 2 is the pixel vector coordinate of the image.

§inputs

lambda is the target value of the dual objective function, i.e. how close you want the output to be to the input: approaching 0, the output should be completely smooth (flat), approaching “infinifty”, the output should be the same as the original input.

tau and sigma affect how fast the algorithm converges, according to Chambolle, A. and Pock, T. (2011) these should be chosen such that tau * lambda * L2 norm^2 <= 1 where L2 norm^2 <= 8.

gamma updates the algorithm’s internal variables, for the accelerated algorithm of Chambolle, A. and Pock, T. (2011) the chosen value is 0.35 * lambda.

max_iter and convergence_threshold bound the runtime of the algorithm, i.e. it runs until convergence_threshold < norm(current - previous) / norm(previous) or max_iter is hit.

Trait Implementations§

Source§

impl<T: Clone + Gradient + Average + VectorLen + Norm> Clone for ImageArray<T>

Source§

fn clone(&self) -> ImageArray<T>

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<T: Debug + Gradient + Average + VectorLen + Norm> Debug for ImageArray<T>

Source§

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

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

impl<T: Gradient + Average + VectorLen + Norm> Deref for ImageArray<T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T: Copy + Into<f64>, D: Dimension + RemoveAxis> From<&ArrayBase<OwnedRepr<T>, D>> for ImageArray<Array<f64, D>>

Source§

fn from(value: &Array<T, D>) -> Self

Converts to this type from the input type.
Source§

impl From<&ImageBuffer<Luma<u8>, Vec<u8>>> for ImageArray<Array3<f64>>

Source§

fn from(value: &GrayImage) -> Self

Converts to this type from the input type.
Source§

impl From<&ImageBuffer<Rgb<u8>, Vec<u8>>> for ImageArray<Array3<f64>>

Source§

fn from(value: &RgbImage) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for ImageArray<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ImageArray<T>
where T: RefUnwindSafe,

§

impl<T> Send for ImageArray<T>
where T: Send,

§

impl<T> Sync for ImageArray<T>
where T: Sync,

§

impl<T> Unpin for ImageArray<T>
where T: Unpin,

§

impl<T> UnwindSafe for ImageArray<T>
where T: UnwindSafe,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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, 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.