Expand description

Comparing gray images using structure

This crate allows to compare grayscale images using either structure or histogramming methods. The easiest use is loading two images, converting them to grayscale and running a comparison:

use image_compare::Algorithm;
let image_one = image::open("image1.png").expect("Could not find test-image").into_luma8();
let image_two = image::open("image2.png").expect("Could not find test-image").into_luma8();
let result = image_compare::gray_similarity_structure(&Algorithm::MSSIMSimple, &image_one, &image_two).expect("Images had different dimensions");

Check the Algorithm enum for implementation details

Comparing gray images using histogram

Histogram comparisons are possible using the histogram comparison function

use image_compare::Metric;
let image_one = image::open("image1.png").expect("Could not find test-image").into_luma8();
let image_two = image::open("image2.png").expect("Could not find test-image").into_luma8();
let result = image_compare::gray_similarity_histogram(Metric::Hellinger, &image_one, &image_two).expect("Images had different dimensions");

//! Check the Metric enum for implementation details

Enums

The enum for selecting a grayscale comparison implementation

The errors that can occur during comparison of the images

The distance metric choices for histogram comparisons

Traits

Functions

Comparing gray images using histogram

Comparing gray images using structure.

Comparing rgb images using structure. RGB structure similarity is performed by doing a channel split and taking the maximum deviation (minimum similarity) for the result. The image contains the complete deviations.

Type Definitions

a single-channel f32 typed image containing a result-score for each pixel

a three-channel f32 typed image containing a result-score per color channel for each pixel