[][src]Function diffimg::diff

pub fn diff(image_a: &[u8], image_b: &[u8], precision: f64) -> f64

Compute the amount of difference between two images

Receives two &DymanicImage (the images that are going to be compared) and returns a f64 between 0 and 1, representing how much both images differ from each other, i.e. 0 means they are completely equal and 1 means they are completely different.

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());