Phash::FFI - FFI-based pHash interface.
Phash::FFI is the library adaptor for pHash, which allows you to generate a hash value from media files (image, video, audio). It is designed so that if 2 media files have identical hash value if they are perceptually the same.
This subroutine takes a path name and returns a 64-bit phash. For example:
my $hash = Phash::FFI::dct_imagehash("Lenna.png"); printf "%064b\t%s\n", $hash, $file; # output 1100100100011100101100100110001001110111010110101001010110110001 Lenna.png
The similary of hash can be calculated by Hamming distance of bits.
When 2 hash values have only 1 or 2 bits that are different, it is very likely that the corresponding 2 images look the same.
Image::Hash
Phash::FFI is released under MIT License.
pHash is released under GPLv3 license.
To install Phash::FFI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Phash::FFI
CPAN shell
perl -MCPAN -e shell install Phash::FFI
For more information on module installation, please visit the detailed CPAN module installation guide.