Crates.io | simimgrs |
lib.rs | simimgrs |
version | 0.1.3 |
source | src |
created_at | 2019-12-05 14:26:38.085263 |
updated_at | 2019-12-11 06:50:49.275308 |
description | this crate checks for similar image using average hash algorism. |
homepage | https://github.com/po3rin/simimgrs |
repository | https://github.com/po3rin/simimgrs |
max_upload_size | |
id | 186663 |
size | 2,616,767 |
Are these similar images ? yes !! this crate checks for similar image using average hash algorism. The average of the luminance values is calculated, and the 64-bit hash value is calculated as “1” for greater than the average and “0” for less than the average.
use image;
use simimgrs;
fn main() {
let img1 = image::open("testdata/go1.jpg").unwrap();
let img2 = image::open("testdata/go2.jpg").unwrap();
let checker = simimgrs::SimilarChecker::new().threshold(10).compression_size(8, 8);
println!("similar image: {}", checker.is_similar(img1, img2)) // true !
}
$ cargo install simimgrs
$ simimgrs testdata/go1.jpg testdata/go2.jpg
similar image: true