This commit is contained in:
Mats Rauhala 2019-01-01 20:49:26 +02:00
parent dbb5cbb209
commit b33b45a4ea

View File

@ -17,6 +17,7 @@ import Pipes
import Pipes.Files
import qualified Pipes.Prelude as P
import Pipes.Safe (runSafeT)
import qualified Data.BKTree as BK
data Cmd = Cmd { source :: FilePath
@ -24,6 +25,18 @@ data Cmd = Cmd { source :: FilePath
, recursive :: Bool
} deriving (Show, Generic, ParseRecord)
data Fingerprint =
Fingerprint { imagePath :: FilePath
, hash :: !Word64
} deriving Show
instance BK.Metric Fingerprint where
-- hamming distance
distance (Fingerprint _ a) (Fingerprint _ b) =
let xored = a `xor` b
in _
fingerprint :: DynamicImage -> Word64
fingerprint = hash . grey . scale . convertRGB8
where