Skip to content

kiwionly/jphash

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About jpHash

This is library based on the great work behind pHash, the perceptual hash library (http://www.phash.org/).

My main problem with using this library is that it is written in C++ and I'm a Java guy. So I decided to have a go at converting it to Java.

Currently, only the Radial Image hash algorithm is implemented as that's the only one I've needed yet, but implementing the rest of the image hashing algorithms should be trivial as they are all based on the same preprocessing of the image (grayscaling, correcting brightness, blurring and scaling)... and all that is done already.

Efficiency

I've invested quite a bit in making this efficient. Some personal benchmarks have given me execution times comparable to the C++ version. Of course that meant that I had to implement my own grayscaling, resizing and bluring algorithms.

Licence

I still need to add all the licencing info, but the idea is that it be LGPL so it can be included in other distributed work. I'm still checking, but I believe this is compatible with the GPL version that pHash is on.

Build

gradlew radial

Usage

Simple:

RadialHash hash1 = JpHash.getImageRadialHash("/path/to/image");
System.out.println("Hash1: " + hash1);
RadialHash hash2 = JpHash.getImageRadialHash("/path/to/other/image");
System.out.println("Hash2: " + hash2);

System.out.println("Similarity: " + jpHash.getSimilarity(hash1, hash2));

You can also persist the string representation of the hash and recover it with: RadialHash.fromString(String)

Links

Some links of interest that this work is based upon:

For info on building an efficient index for Nearest neighbour search (my planned next stage). These are some of the papers I've found:

About

Java Perceptual Hash

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%