Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 858 Bytes

README.md

File metadata and controls

25 lines (17 loc) · 858 Bytes

Dhash

Dhash's (or difference hashes) are a way of calculating similarity between images. If two images have a similar dhash, then the likelihood is that they both are depicting the same image (albeit slightly cropped compressed etc).

For more information, check out the links below.

Installation

gem 'dhash'

Usage

hash1 = Dhash.calculate('face-high.jpg')
hash2 = Dhash.calculate('face-low.jpg')

if Dhash.hamming(hash1, hash2) < 10
  puts "Images are very similar"
else
  puts "No match"
end