2017 © Pedro Peláez
 

library image-compare

micro Lib for image comparison

image

inceddy/image-compare

micro Lib for image comparison

  • Wednesday, January 31, 2018
  • by inceddy
  • Repository
  • 1 Watchers
  • 10 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 2 Versions
  • 78 % Grown

The README.md

ImageCompare

PHP micro Lib for image comparison, (*1)

Installation

Add this repo as dependency in your composer.json, (*2)

{
    "require": {
        "inceddy/image-compare": "dev-master"
    }
}

Concept

The idea behind this comparison is simple., (*3)

  1. Eliminate the background to white
  2. Isolate the remaining areas
  3. Compare the mean-color of all areas and the area count in both images

Sample

// Load first image
$image1 = Image::fromFile('demo_inputs/image1.png');

// Load second image to compare
$image2 = Image::fromFile('demo_inputs/image2.png');

// If both images have an known background substract it
$mask = Image::fromFile('demo_inputs/mask.png');
$image1 = $image1->subtract($mask, 15); // use 15% tolerance
$image2 = $image2->subtract($mask, 15); // use 15% tolerance

// Compare both images
$equal = $image1->compare($image2); // Returns a boolean value whether these images are equal or not

// Or if you are interessted in how equal they are
$diff = $image1->difference($image2); // Retuns a float between 1 and 0, where 1 is equal and 0 is total difference 

The Versions

31/01 2018

dev-master

9999999-dev

micro Lib for image comparison

  Sources   Download

MIT

by Philipp Steingrebe

31/01 2018

1.0.0

1.0.0.0

micro Lib for image comparison

  Sources   Download

MIT

by Philipp Steingrebe