PHP Classes

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

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
StarStar 36%Total: 479 All time: 5,960 This week: 40Up
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

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 (2)  
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

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  
 0%
Total:479
This week:0
All time:5,960
This week:40Up
User Ratings User Comments (1)
 All time
Utility:43%StarStarStar
Consistency:62%StarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:36%StarStar
Rank:4076
 
Works perfectly
5 years ago (Embrace Humanity)
70%StarStarStarStar