Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing python modules - ImageChops

I'm looking for a good way to analyze image similarity, using python. I'm NOT looking for a way to establish whether two images are identical. I'm just looking for a way to establish the similarity between two images (e.g., if two images are very similar they could be given a "grade" of 9/10; if they are completely unalike, they'll be given a very low index, such as 2/10). From some reading that I've done, the module ImageChops has been suggested - however, I haven't been able to find a way to download it. If anyone knows how to download it, or has a suggestion for other effective solutions, I'd greatly appreciate their advice!

Thanks in advance!

like image 890
JMS Avatar asked Sep 11 '25 18:09

JMS


1 Answers

ImageChops is a module from PIL(Pillow). To use the ImageChops function you need to pip install Pillow OR easy_install Pillow OR download the src & extract the src then from CMD CD to the extracted folder & run python setup.py install.

To use the ImageChops you can do this from PIL import ImageChops you can read the document section

some basic usage example http://effbot.org/imagingbook/imagechops.htm

To check the difference between 2 images:

import Image
from PIL import ImageChops

im1 = Image.open("splash.png")
im2 = Image.open("splash2.png")

diff = ImageChops.difference(im2, im1)

there's a compare images script, but its not a PIL; its on scipy module You may also check this script here

like image 95
Simon K Bhatta4ya Avatar answered Sep 14 '25 10:09

Simon K Bhatta4ya