The blockhash package

[Tags:bsd3, library, program, test]

This is a perceptual image hash calculation tool based on algorithm descibed in Block Mean Value Based Image Perceptual Hashing by Bian Yang, Fan Gu and Xiamu Niu.


[Skip to Readme]

Properties

Versions 0.1.0.0
Dependencies base (>=4.7 && <5), blockhash, bytestring (==0.10.*), JuicyPixels (==3.2.*), optparse-applicative (==0.12.*), primitive (==0.6.*), vector (==0.11.*), vector-algorithms (==0.7.*) [details]
License BSD3
Copyright BSD3
Author Kwang Yul Seo
Maintainer kwangyul.seo@gmail.com
Category Web
Home page https://github.com/kseo/blockhash#readme
Source repository head: git clone https://github.com/kseo/blockhash
Uploaded Tue Jul 19 03:57:45 UTC 2016 by kseo
Distributions NixOS:0.1.0.0
Downloads 60 total (6 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-07-19 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for blockhash

Readme for blockhash-0.1.0.0

blockhash Build Status

This is a perceptual image hash calculation tool based on algorithm descibed in Block Mean Value Based Image Perceptual Hashing by Bian Yang, Fan Gu and Xiamu Niu. Visit the website for further information.

Program

Usage: blockhash [-q|--quick] [-b|--bits ARG] filenames
  blockhash

Available options:
  -h,--help                Show this help text
  -q,--quick               Use quick hashing method
  -b,--bits ARG            Create hash of size N^2 bits.

Library

The example code below uses JuicyPixels to load images and prints the hash to stdout.

import qualified Codec.Picture as P
import Data.Blockhash
import qualified Data.Vector.Generic as VG
import qualified Data.Vector.Unboxed as V

printHash :: FilePath -> IO ()
printHash :: filename = do
  res <- P.readImage filename
  case res of
    Left err -> putStrLn ("Fail to read: " ++ filename)
    Right dynamicImage -> do
      let rgbaImage = P.convertRGBA8 dynamicImage
          pixels = VG.convert (P.imageData rgbaImage)
          image = Image { imagePixels = pixels
                        , imageWidth = P.imageWidth rgbaImage
                        , imageHeight = P.imageHeight rgbaImage }
          hash = blockhash image 16 Precise
      putStrLn (show hash)