title: Compare 2 images and find % difference
body: <p>I want to compare two images and know the % difference between them. I am using raspbian on raspberry pi and python language. I have found PIL and magickimage, but with magick image I can't find a function for this and with PIL I have strange results.</p>
  
  <p>For Pil i use this code :</p>
  
  <pre><code>h1 = image1.histogram()
  h2 = image2.histogram()
  rms = math.sqrt(reduce(operator.add,map(lambda a,b: (a-b)**2, h1, h2))/len(h1))
  </code></pre>
  
  <p>When i take two pics ( no difference ) with 0.5 seconds of intervall i have this results : rms = 4743.766.... If i move during between the two pics i have rms : 4699.288..... 
  So it's does not make the difference between the two " sames " images and when i move :/</p>