phash-0.0.3: Haskell bindings to pHash, the open source perceptual hash library

Safe HaskellNone
LanguageHaskell2010

Data.PHash

Synopsis

Documentation

hammingDistance :: PHash -> PHash -> Int Source

Calculate the distance between two hashes. This can be used to detect how similar two images are.

>>> import Data.PHash
>>> hammingDistance (PHash 15243782418149777067) (PHash 17549625427362946731)
2
>>> hammingDistance (PHash 15243782418149777067) (PHash 15243782418149777067)
0

imagesSimilar Source

Arguments

:: FilePath 
-> FilePath 
-> Int

Threshold for similarity. If the hamming distance exceeds this number, it will return False. 15 seems to be a reasonable default.

-> IO (Maybe Bool) 

Determine if two images are similar by a user-defined threshold