PHP Classes

PHP Compare Images Similarity: Compare two images to find if they are similar

Recommend this page to a friend!
  Info   View files Example   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (7)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 61%Total: 4,725 All time: 585 This week: 46Up
Version License PHP version Categories
image-compare 1.3GNU General Publi...5.0Algorithms, PHP 5, Graphics
Description 

Author

This class can compare two images to find if they are similar.

It resizes the images to a 8x8 square, converts the result into grey scale images, takes the color mean, and computes the hammering distance of the images' bits.

The class returns a number that is below 10 if the images are similar.

Picture of Ákos Nikházy
Name: Ákos Nikházy <contact>
Classes: 10 packages by
Country: Hungary Hungary
Age: 36
All time rank: 4753 in Hungary Hungary
Week rank: 77 Up1 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 1x

Recommendations

I need a PHP class for face matching
Solution to match faces from uploaded pictures

image comparison with php
image comparison with php with percentage of the similarities

What is the best PHP find images with similarities class?
Search uploaded images for similar images

Example

<?php
require 'image.compare.class.php';
 
/*
    these two images are almost the same so the hammered distance will be less than 10
    try it with images like this:
        1. two complatly different image
        2. the same image (returned number should be 0)
        3. the same image but with different size, even different aspect ratio (returned number should be 0)
        4. the same image with slightly different colors / lights etc. (returned number should be under 10)
    you will see how the returned number will represent the similarity of the images.
*/
$class = new compareImages;
echo
$class->compare('1.jpg','2.jpg');
 
?>


  Files folder image Files  
File Role Description
Accessible without login Image file 1.jpg Output Image for the demo
Accessible without login Image file 2.jpg Output image for the demo
Accessible without login Plain text file demo.php Example demo
Plain text file image.compare.class.php Class the class file
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 66%
Total:4,725
This week:0
All time:585
This week:46Up
User Ratings User Comments (5)
 All time
Utility:89%StarStarStarStarStar
Consistency:89%StarStarStarStarStar
Documentation:-
Examples:80%StarStarStarStarStar
Tests:-
Videos:-
Overall:61%StarStarStarStar
Rank:1023
 
An awesome package.
1 year ago (Kenneth Attans)
80%StarStarStarStarStar
just in watching your example i know it's good
5 years ago (nico)
70%StarStarStarStar
just in watching your example i know it's good
5 years ago (nico)
70%StarStarStarStar
Very easy to use.
9 years ago (norman ridley)
60%StarStarStarStar
Amazing !!!!! Thank you !
9 years ago (dragos)
60%StarStarStarStar