Struct magick_rust::KernelInfo

source ·
pub struct KernelInfo { /* private fields */ }

Implementations§

source§

impl KernelInfo

source

pub fn scale(&mut self, factor: f64)

The values within the kernel is scaled directly using given scaling factor without change.

source

pub fn normalize(&mut self)

Kernel normalization is designed to ensure that any use of the kernel scaling factor with ‘Convolve’ or ‘Correlate’ morphology methods will fall into -1.0 to +1.0 range. Note that for non-HDRI versions of IM this may cause images to have any negative results clipped, unless some ‘bias’ is used.

More specifically. Kernels which only contain positive values (such as a ‘Gaussian’ kernel) will be scaled so that those values sum to +1.0, ensuring a 0.0 to +1.0 output range for non-HDRI images.

For Kernels that contain some negative values, (such as ‘Sharpen’ kernels) the kernel will be scaled by the absolute of the sum of kernel values, so that it will generally fall within the +/- 1.0 range.

For kernels whose values sum to zero, (such as ‘Laplacian’ kernels) kernel will be scaled by just the sum of the positive values, so that its output range will again fall into the +/- 1.0 range.

source

pub fn correlate_normalize(&mut self)

For special kernels designed for locating shapes using ‘Correlate’, (often only containing +1 and -1 values, representing foreground/background matching) a special normalization method is provided to scale the positive values separately to those of the negative values, so the kernel will be forced to become a zero-sum kernel better suited to such searches.

source

pub fn unity_add(&mut self, scale: f64)

Adds a given amount of the ‘Unity’ Convolution Kernel to the given pre-scaled and normalized Kernel. This in effect adds that amount of the original image into the resulting convolution kernel. This value is usually provided by the user as a percentage value in the ‘convolve:scale’ setting.

The resulting effect is to convert the defined kernels into blended soft-blurs, unsharp kernels or into sharpening kernels.

source

pub unsafe fn get_ptr(&self) -> *mut KernelInfo

Trait Implementations§

source§

impl Clone for KernelInfo

source§

fn clone(&self) -> Self

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 KernelInfo

source§

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

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

impl Drop for KernelInfo

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

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> 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> ToOwned for T
where 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 T
where U: Into<T>,

§

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>,

§

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.