The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Phash::FFI - FFI-based pHash interface.

DESCRIPTION

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.

FUNCTIONS

dct_imagehash($file_path)

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
ph_hamming_distance($hash1, $hash2)

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.

SEE ALSO

Image::Hash

LICENSE

Phash::FFI is released under MIT License.

pHash is released under GPLv3 license.