All Projects → KilianB → Jimagehash

KilianB / Jimagehash

Licence: mit
Perceptual image hashing library used to match similar images

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Jimagehash

Transfer Learning Suite
Transfer Learning Suite in Keras. Perform transfer learning using any built-in Keras image classification model easily!
Stars: ✭ 212 (-7.02%)
Mutual labels:  image
React Native Perspective Image Cropper
Perform custom crop, resizing and perspective correction 📐🖼
Stars: ✭ 223 (-2.19%)
Mutual labels:  image
Photofilters
photofilters library for flutter
Stars: ✭ 229 (+0.44%)
Mutual labels:  image
Album
🍉 Album and Gallery for Android platform.
Stars: ✭ 2,430 (+965.79%)
Mutual labels:  image
Use Image Color
🎨 A hook to grab a color palette from images. Render a skeleton color while your original image still loading.
Stars: ✭ 222 (-2.63%)
Mutual labels:  image
React Worker Image
React component to fetch image resources via web workers 🤖🤖
Stars: ✭ 226 (-0.88%)
Mutual labels:  image
Rskimagecropper
An image cropper / photo cropper for iOS like in the Contacts app with support for landscape orientation.
Stars: ✭ 2,371 (+939.91%)
Mutual labels:  image
Shadowimageview
🔥可以根据图片内容变阴影颜色,更加细腻的阴影效果 It can change color according to the picture, more delicate shadow effect
Stars: ✭ 2,560 (+1022.81%)
Mutual labels:  image
Vue Img Cutter
简单易用的vue图片裁剪插件,支持移动图像,裁剪图片,放大缩小图片,上下左右移动,固定比例,固定尺寸,远程图片裁剪,只需要很少的代码就可以实现裁剪功能,也可以通过调整参数以适应你自己的业务需求。
Stars: ✭ 220 (-3.51%)
Mutual labels:  image
Fingerprinter
CMS/LMS/Library etc Versions Fingerprinter
Stars: ✭ 227 (-0.44%)
Mutual labels:  fingerprinting
Gulp Image
Optimize PNG, JPEG, GIF, SVG images with gulp task.
Stars: ✭ 213 (-6.58%)
Mutual labels:  image
React Native Auto Height Image
🖼️React native auto height image
Stars: ✭ 219 (-3.95%)
Mutual labels:  image
Craft Imageoptimize
Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.
Stars: ✭ 227 (-0.44%)
Mutual labels:  image
Igrphototweaks
Drag, Rotate, Scale and Crop
Stars: ✭ 212 (-7.02%)
Mutual labels:  image
Dualgan
DualGAN-tensorflow: tensorflow implementation of DualGAN
Stars: ✭ 230 (+0.88%)
Mutual labels:  image
Contrast Swatch
🅰️ Image microservice for color contrast information
Stars: ✭ 210 (-7.89%)
Mutual labels:  image
Android Imagecropview
android image crop library
Stars: ✭ 225 (-1.32%)
Mutual labels:  image
Sjnetwork
SJNetwork is a high level network request tool based on AFNetworking and inspired on YTKNetwork.
Stars: ✭ 231 (+1.32%)
Mutual labels:  image
Medium Zoom
🔎🖼 A JavaScript library for zooming images like Medium
Stars: ✭ 2,799 (+1127.63%)
Mutual labels:  image
Slideimageview
Simple and convenient library that allows you to slide images through a view.
Stars: ✭ 227 (-0.44%)
Mutual labels:  image

JImageHash

Travis GitHub license Download Codacy Badge

JImageHash is a performant perceptual image fingerprinting library entirely written in Java. The library returns a similarity score aiming to identify entities which are likely modifications of the original source while being robust variouse attack vectors ie. color, rotation and scale transformation.

A perceptual hash is a fingerprint of a multimedia file derived from various features from its content. Unlike cryptographic hash functions which rely on the avalanche effect of small changes in input leading to drastic changes in the output, perceptual hashes are "close" to one another if the features are similar.

This library was inspired by Dr. Neal Krawetz blog post "kind of like that" and incorporates several improvements. A comprehensive overview of perceptual image hashing can be found in this paper by Christoph Zauner.

Maven - Bintray

The project is hosted on bintray and jcenter. Please be aware that migrating from one major version to another usually invalidates creatd hashes

<repositories>
	<repository>
		<id>jcenter</id>
		<url>https://jcenter.bintray.com/</url>
	</repository>
</repositories>

<dependency>
	<groupId>com.github.kilianB</groupId>
	<artifactId>JImageHash</artifactId>
	<version>3.0.0</version>
</dependency>

<!-- If you want to use the database image matcher you need to add h2 as well -->
<dependency>
	<groupId>com.h2database</groupId>
	<artifactId>h2</artifactId>
	<version>1.4.197</version>
</dependency>

Hello World

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
}
		
//Chaining multiple matcher for single image comparison

SingleImageMatcher matcher = new SingleImageMatcher();
matcher.addHashingAlgorithm(new AverageHash(64),.3);
matcher.addHashingAlgorithm(new PerceptiveHash(32),.2);
		
if(matcher.checkSimilarity(img0,img1)) {
    //Considered a duplicate in this particular case
}

Examples

Below you can find examples of convenience methods used to get fast results. Further examples are provided in the examples folder explain how to choose and optimize individual algorithms on your own.

File Content
CompareImages.java Compare the similarity of two images using a single algorithm and a custom threshold
ChainAlgorithms.java Chain multiple algorithms to achieve a better precision & recall.
MatchMultipleImages.java Precompute the hash of multiple images to retrieve all relevant images in a batch.
DatabaseExample.java Store hashes persistently in a database. Serialize and Deserialize the matcher.
AlgorithmBenchmark.java Test different algorithm/setting combinations against your images to see which settings give the best result.
Clustering Example Extensive tutotial matching 17.000 images . As described in the blog

Multiple types image matchers are available for each situation

The persistent package allows hashes and matchers to be saved to disk. In turn the images are not kept in memory and are only referenced by file path allowing to handle a great deal of images at the same time. The cached version keeps the BufferedImage image objects in memory allowing to change hashing algorithms on the fly and a direct retrieval of the buffered image objects of matching images. The categorize package contains image clustering matchers. KMeans and Categorical as well as weighted matchers. The exotic package features BloomFilter, and the SingleImageMatcher used to match 2 images without any fancy additions.

Image High Low Copyright Thumbnail Ballon
High Quality

Low Quality

Altered Copyright

Thumbnail

Ballon

Hashing algorithm

Image matchers can be configured using different algorithm. Each comes with individual properties

Algorithm Feature Notes
AverageHash Average Luminosity Fast and good all purpose algorithm
AverageColorHash Average Color Version 1.x.x AHash. Usually worse off than AverageHash. Not robust against color changes
DifferenceHash Gradient/Edge detection A bit more robust against hue/sat changes compared to AColorHash
Wavelet Hash Frequency & Location Feature extracting by applying haar wavlets multiple times to the input image. Detection quality better than inbetween aHash and pHash.
PerceptiveHash Frequency Hash based on Discrete Cosine Transformation. Smaller hash distribution but best accuracy / bitResolution.
MedianHash Median Luminosity Identical to AHash but takes the median value into account. A bit better to detect watermarks but worse at scale transformation
AverageKernelHash Average luminosity Same as AHash with kernel preprocessing. So far usually performs worse, but testing is not done yet.
Rotational Invariant
RotAverageHash Average Luminosity Rotational robust version of AHash. Performs well but performance scales disastrous with higher bit resolutions . Conceptual issue: pixels further away from the center are weightend less.
RotPHash Frequency Rotational invariant version of pHash using ring partition to map pixels in a circular fashion. Lower complexity for high bit sizes but due to sorting pixel values usually maps to a lower normalized distance. Usually bit res of >= 64bits are preferable
Experimental. Hashes available but not well tuned and subject to changes
HogHash Angular Gradient based (detection of shapes?) A hashing algorithm based on hog feature detection which extracts gradients and pools them by angles. Usually used in support vector machine/NNs human outline detection. It's not entirely set how the feature vectors should be encoded. Currently average, but not great results, expensive to compute and requires a rather high bit resolution

Version 3.0.0 Image clustering

Image clustering with fuzzy hashes allowing to represent hashes with probability bits instead of simple 0's and 1's

1_fxpw79yoon8xo3slqsvmta

Algorithm benchmarking

See the wiki page on how to test differet hashing algorithms with your set of images

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].