What is a Perceptual Hash?

A perceptual hash is essentially a fingerprint of an image, audio or video signal such that two perceptually similar signals can be represented by the same fingerprint. Fingerprints can be efficiently compared to determine their degree of similarity. Perceptual Hashing is useful for duplicate or similarity detection and is useful to provide a unique key identifier for content indexing of multimedia files.

A new robust perceptual hash algorithm for images. Based on a neural net classification algorithm, pHashML extracts a concise image descriptor from a given image. Easily compare two image descriptors to obtain a meaningful similarity score.

Demo View On Github Download

Python Usage

//install pyphashml module
$pip install pyphashml

//compare two images
$python -m pyphashml.imgcmp /path/to/file1 /path/to/file2


Use Python module

from pyphashml.phashml import phashmlctx as ctx

x = ctx.imghash("/path/to/imgfile1.jpg")
y = ctx.imghash("/path/to/imgfile2.jpg")
d = ctx.imghash(x, y)