Posted By

sudarkoff on 08/09/06


Tagged

python image-processing PIL RMS difference


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

mthorn
anayhk
FSX
vkolev


Compare two PIL images in Python


 / Published in: Python
 

URL: http://mail.python.org/pipermail/image-sig/1997-March/000223.html

  1. h1 = Image.open("image1").histogram()
  2. h2 = Image.open("image2").histogram()
  3.  
  4. rms = math.sqrt(reduce(operator.add,
  5. map(lambda a,b: (a-b)**2, h1, h2))/len(h1))

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: rawlyn on May 22, 2009

It's worth noting that this method only compares the histograms of the images, and not the images themselves. The title is extremely misleading.

You need to login to post a comment.