Compare commits
1 Commits
b61ca54011
...
b33b45a4ea
Author | SHA1 | Date | |
---|---|---|---|
b33b45a4ea |
13
src/Main.hs
13
src/Main.hs
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user