PHP Classes

PHP Image Compare: Compare images to determine how similar they are

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStar 36%Total: 478 This week: 1All time: 5,959 This week: 560Up
Version License PHP version Categories
compare-images 1.0GNU General Publi...5.0Algorithms, PHP 5, Graphics
Description 

Author

This class can compare images to determine how similar they are.

It can take the path of two image files and computes a hash value for each based on a resized version of the image then turned into black and white.

The class returns the similarity level in terms of percentage after comparing the hash values.

In Spanish:

Con este codigo podemos realizar la comparacion entre dos imagenes y obtener un grado de similitud, abre las puertas para investigar sistemas de busquedas.

Picture of Damian Cipolat
Name: Damian Cipolat <contact>
Classes: 1 package by
Country: Argentina Argentina
Age: 36
All time rank: 332444 in Argentina Argentina
Week rank: 411 Up3 in Argentina Argentina Up

Example

<?php
   
   
include 'comparer.php';
   
   
$comparador = new comparadorImg(8);
   
   
$f1 = './mina.jpg';
   
$f2 = './mina2.jpg';
   
   
$hash = $comparador->getHash_img('./mina.jpg');
    echo
$hash;
   
$dif = $comparador->comparar_imgs($f1,$f2);
   
    echo
"<img src='".$f1."'><br><br>";
    echo
"<img src='".$f2."'><br><br>";
       
    echo
"<b>Diferencias</b> ".$dif."%<br>";
    echo
"<b>Similitudes</b> ".(100-$dif)."%<br>";
   
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file basefilecomparer.php Example archivo base comparador de imagenes
Plain text file comparer.php Class image comparer

 Version Control Unique User Downloads Download Rankings  
 0%
Total:478
This week:1
All time:5,959
This week:560Up
User Ratings User Comments (1)
 All time
Utility:43%StarStarStar
Consistency:62%StarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:36%StarStar
Rank:3993
 
Works perfectly
4 years ago (Embrace Humanity)
70%StarStarStarStar