blockhash: Blockhash perceptual image hash algorithm

[ bsd3, library, program, web ] [ Propose Tags ]

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]
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 BSD-3-Clause
Copyright BSD3
Author Kwang Yul Seo
Maintainer kwangyul.seo@gmail.com
Category Web
Home page https://github.com/kseo/blockhash#readme
Source repo head: git clone https://github.com/kseo/blockhash
Uploaded by kseo at Tue Jul 19 03:57:45 UTC 2016
Distributions NixOS:0.1.0.0
Executables blockhash
Downloads 311 total (10 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
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-0.1.0.0

[back to package description]

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)