Compare commits

...

1 Commits

Author SHA1 Message Date
b33b45a4ea wip 2019-01-01 20:49:26 +02:00

View File

@ -17,6 +17,7 @@ import Pipes
import Pipes.Files import Pipes.Files
import qualified Pipes.Prelude as P import qualified Pipes.Prelude as P
import Pipes.Safe (runSafeT) import Pipes.Safe (runSafeT)
import qualified Data.BKTree as BK
data Cmd = Cmd { source :: FilePath data Cmd = Cmd { source :: FilePath
@ -24,6 +25,18 @@ data Cmd = Cmd { source :: FilePath
, recursive :: Bool , recursive :: Bool
} deriving (Show, Generic, ParseRecord) } 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 :: DynamicImage -> Word64
fingerprint = hash . grey . scale . convertRGB8 fingerprint = hash . grey . scale . convertRGB8
where where