KilianB/JImageHash

hllo,i want to create a picture fingerprint ,how can i use you class to make it,thank you

lxy826076 opened this issue · 1 comments

hllo,i want to create a picture fingerprint ,how can i use you class to make it,thank you

What exactly do you want to achieve? The fingerprint you are talking about most likely is saved in a Hash object containing the image converted to a fixed binary (01) representation.

This is a hello world example:

File img0 = new File("path/to/file.png");
File img1 = new File("path/to/secondFile.jpg");
		
HashingAlgorithm hasher = new PerceptiveHash(32);
		
Hash hash0 = hasher.hash(img0);
Hash hash1 = hasher.hash(img1);
		
double similarityScore = hash0.normalizedHammingDistance(hash1);
		
if(similarityScore < .2) {
		//Considered a duplicate in this particular case
}

Be aware this step has to be repeated with multiple algorithms to reduce false positives. The different image matchers are utility classes to help performing such a task.
The example section points to a few classes explaining how to solve such a request. Please let me know if anything is unclear and we can work it out.