[−][src]Function diffimg::diff
pub fn diff(image_a: &[u8], image_b: &[u8], precision: f64) -> f64
Compute the amount of difference between two images using their raw bytes.
Receives two &[u8]
(the raw bytes of the images to be compared)
and returns a f64
between 0 and 1, representing how much both images
differ from each other, where 0 means they are completely equal and 1 means
they are completely different. Presicion value goes from 0 to 1 and determines
the number of chunks that is going to be used.
Example
use image::*; // To get raw-pixels use diffimg; let image1 = image::open("tests/images/image1.png").expect("Failed to open image"); let image2 = image::open("tests/images/image2.png").expect("Failed to open image"); let diff = diffimg::diff(&image1.to_bytes(), &image2.to_bytes());