ImagePhash - Perl binding for pHash (http://phash.org)
use ImagePhash qw(pdiff phash);
my $hash1 = phash("img1.jpg");
my $hash2 = phash("img1.png");
my $diff = pdiff($hash1, $hash2);
Measure similarity between images.
None by default.
phash($img)
Calculate a perceptual hash for an image and returns a 16-byte long lowercase hex string which itself represents a 64bit unsinged integer.
pdiff($hash1, $hash2)
Calculate the hamming distance between the two image hashes and returns a positive integer less than 64. A small value means that the two images look similar to each other.
For linux, libjpeg-dev and libpng-dev are requried.
For Mac, ImageMagic and libjpeg are required.
Windows is not supported.
perl Makefile.PL
make
make test
make install
phash bindings for other languages https://github.com/clearscene/pHash/tree/master/bindings
How to automatically identify similar images using phash http://cloudinary.com/blog/how_to_automatically_identify_similar_images_using_phash
Wenjun Yan, <wenjun.yan.dev@gmail.com>
Copyright (C) 2017 by Wenjun Yan
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.