blockhash: Blockhash perceptual image hash algorithm

[ bsd3, library, program, web ] [ Propose Tags ] [ Report a vulnerability ]

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]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Dependencies base (>=4.7 && <5), blockhash, bytestring (>=0.10 && <0.11), JuicyPixels (>=3.2 && <3.3), optparse-applicative (>=0.12 && <0.13), primitive (>=0.6 && <0.7), vector (>=0.11 && <0.12), vector-algorithms (>=0.7 && <0.8) [details]
Tested with ghc ==7.8, ghc ==7.10, ghc ==8.0
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 2016-07-19T03:57:45Z
Distributions
Executables blockhash
Downloads 930 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-07-19 [all 1 reports]

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)