pub struct Dssim { /* private fields */ }Expand description
Configuration for the comparison
Implementations§
Source§impl Dssim
impl Dssim
Sourcepub fn set_scales(&mut self, scales: &[f64])
pub fn set_scales(&mut self, scales: &[f64])
Set how many scales will be used, and weights of each scale
Sourcepub fn set_save_ssim_maps(&mut self, num_scales: u8)
pub fn set_save_ssim_maps(&mut self, num_scales: u8)
Set how many scales will be kept for saving
Sourcepub fn create_image_rgba(
&self,
bitmap: &[RGBA<u8>],
width: usize,
height: usize,
) -> Option<DssimImage<f32>>
pub fn create_image_rgba( &self, bitmap: &[RGBA<u8>], width: usize, height: usize, ) -> Option<DssimImage<f32>>
Create image from an array of RGBA pixels (sRGB, non-premultiplied, alpha last).
If you have a slice of u8, then see rgb crate’s as_rgba().
Sourcepub fn create_image_rgb(
&self,
bitmap: &[RGB<u8>],
width: usize,
height: usize,
) -> Option<DssimImage<f32>>
pub fn create_image_rgb( &self, bitmap: &[RGB<u8>], width: usize, height: usize, ) -> Option<DssimImage<f32>>
Create image from an array of packed RGB pixels (sRGB).
If you have a slice of u8, then see rgb crate’s as_rgb().
Sourcepub fn create_image<InBitmap, OutBitmap>(
&self,
src_img: &InBitmap,
) -> Option<DssimImage<f32>>where
InBitmap: ToLABBitmap + Send + Sync + Downsample<Output = OutBitmap>,
OutBitmap: ToLABBitmap + Send + Sync + Downsample<Output = OutBitmap>,
pub fn create_image<InBitmap, OutBitmap>(
&self,
src_img: &InBitmap,
) -> Option<DssimImage<f32>>where
InBitmap: ToLABBitmap + Send + Sync + Downsample<Output = OutBitmap>,
OutBitmap: ToLABBitmap + Send + Sync + Downsample<Output = OutBitmap>,
The input image is defined using the imgref crate, and the pixel type can be:
ImgVec<RGBAPLU>— RGBA premultiplied alpha, linear, float scaled to 0..1ImgVec<RGBLU>— RGBA linear, float scaled to 0..1ImgVec<f32>— linear light grayscale, float scaled to 0..1
And there’s ToRGBAPLU::to_rgbaplu() trait to convert the input pixels from
[RGBA<u8>], [RGBA<u16>], [RGB<u8>], or RGB<u16>. See lib.rs for example how it’s done.
You can implement ToLABBitmap and Downsample traits on your own image type.
Sourcepub fn compare<M: Borrow<DssimImage<f32>>>(
&self,
original_image: &DssimImage<f32>,
modified_image: M,
) -> (Val, Vec<SsimMap>)
pub fn compare<M: Borrow<DssimImage<f32>>>( &self, original_image: &DssimImage<f32>, modified_image: M, ) -> (Val, Vec<SsimMap>)
Compare original with another image. See create_image
The SsimMaps are returned only if you’ve enabled them first.
Val is a fancy wrapper for f64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dssim
impl RefUnwindSafe for Dssim
impl Send for Dssim
impl Sync for Dssim
impl Unpin for Dssim
impl UnwindSafe for Dssim
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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