项目作者: shamazmazum

项目描述 :
Perceptual image hashing for Common Lisp
高级语言: Common Lisp
项目地址: git://github.com/shamazmazum/perceptual-hashes.git
创建时间: 2020-03-22T05:31:26Z
项目社区:https://github.com/shamazmazum/perceptual-hashes

开源协议:BSD 2-Clause "Simplified" License

下载


perceptual-hashes

Build Status
CI

perceptual-hashes library computes perceptual hashes for images
(supported formats include formats supported by
imago + jpeg). Perceptual hashes
are a measure of similarity between images.

Installation

You can install perceptual-hashes from Ultralisp
repository. Add Ultralisp repository to quicklisp (if you haven’t already):

  1. (ql-dist:install-dist "http://dist.ultralisp.org/"
  2. :prompt nil)

and install perceptual-hashes:

  1. (ql:quickload :perceptual-hashes)

Supported algorithms

The following algorithms are supported:

  • aHash: An algorithm based on whenever each pixel of an image is
    brighter or darker than the average luminance of all pixels.
  • dHash: An algorithm based on whenever each pixel of an image is
    brighter or darker than its neighbours.

You can find more information
here.

Examples

  1. (defconstant +threshold+ 45
  2. "The distance between hashes can vary from 0 to (length hash) =
  3. 1024. If it is small enough (<= ~45) the images are similar")
  4. (defun images-similar-p (image-name-1 image-name-2)
  5. (let ((hash1 (perceptual-hashes:ahash image-name-1))
  6. (hash2 (perceptual-hashes:ahash image-name-2)))
  7. (< (perceptual-hashes:hamming-distance hash1 hash2)
  8. +threshold+)))