Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

perceptual-hash

This Library calculates the similarity between two images and returns a value in similarity in percentage

Algorithm

  • Start
  • Open Images to compare
  • Decode them using a suitable Decoder(jpeg, png)
  • Convert them to Grayscale
  • Downsize them to a 9x9(faster, less accurate) or 17x17(slightly slower, but more accurate)
  • Calculate the dHash or differenceHash of each image
  • Compare the two hashes and then calculate the difference in percentage b/w the two
  • End

Notes

You can provide hash length to whatever value you want. Keep in mind, that increasing hash length will decrease performance and might increase accuracy.

Example

Say, You provided 512 bits as hash length, Then,

512 / 2 = 256
sqrt(256) = 16

Now the image is downsized to 17x17.

Inspiration

License

MIT

About

perceptual hashing library to check similarity in percentage between two similar images

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages