PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 61%Total: 4,749 This week: 1All time: 579 This week: 42Up
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
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 (6)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 66%
Total:4,749
This week:1
All time:579
This week:42Up
User Ratings User Comments (5)
 All time
Utility:89%StarStarStarStarStar
Consistency:89%StarStarStarStarStar
Documentation:-
Examples:80%StarStarStarStarStar
Tests:-
Videos:-
Overall:61%StarStarStarStar
Rank:1036
 
An awesome package.
1 year ago (Kenneth Attans)
80%StarStarStarStarStar
just in watching your example i know it's good
6 years ago (nico)
70%StarStarStarStar
just in watching your example i know it's good
6 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