diff --git a/Ch04/Code11_phash/Main.hs b/Ch04/Code11_phash/Main.hs index 74440e8..b5f4f40 100644 --- a/Ch04/Code11_phash/Main.hs +++ b/Ch04/Code11_phash/Main.hs @@ -13,14 +13,28 @@ main = do phash3 <- imageHash "image3.jpg" putStrLn $ "image3: " ++ show phash3 + if isJust phash1 && isJust phash2 then do + putStr "hamming distance between image1 and image2: " + print $ hammingDistance (fromJust phash1) (fromJust phash2) + else + print "Error, could not read images" + + if isJust phash1 && isJust phash3 then do + putStr "hamming distance between image1 and image3: " + print $ hammingDistance (fromJust phash1) (fromJust phash3) + else + print "Error, could not read images" + +{- case (phash1, phash2) of (Just h1, Just h2) -> do - putStr "hammind distance: " + putStr "hamming distance between image1 and image2: " print $ hammingDistance h1 h2 _ -> putStrLn "Error, could not read images" case (phash1, phash3) of (Just h1, Just h3) -> do - putStr "hammind distance: " + putStr "hamming distance between image1 and image3: " print $ hammingDistance h1 h3 _ -> putStrLn "Error, could not read images" +-}