title: Kullback-Leibler divergence of the same image - scipy.stats.entropy
body: <p>I was calculating kl distance between 3 images histograms: </p>
  
  <pre><code>import numpy as np
  import scipy.misc
  from skimage.io import ImageCollection, imread
  from skimage import color
  import skimage
  from sklearn.datasets import load_sample_image
  
  # all images in grayscale
  lena = scipy.misc.lena().astype('uint8')
  china = skimage.img_as_ubyte(color.rgb2grey( load_sample_image("china.jpg")) )
  flower = skimage.img_as_ubyte(color.rgb2grey( load_sample_image("flower.jpg")) )
  
  # histograms for all images
  hist_lena, bin_edges_lena = np.histogram(lena, bins = range(256))
  hist_china, bin_edges_china = np.histogram(china, bins = range(256))
  hist_flower, bin_edges_flower = np.histogram(flower, bins = range(256))
  </code></pre>
  
  <p>When I use scipy.stats.entropy to compare the same image I've got different results:</p>
  
  <pre><code># http://docs.scipy.org/doc/scipy-dev/reference/generated/scipy.stats.entropy.html
  from scipy.stats import entropy
  
  print entropy(pk=hist_lena, qk=hist_lena) # nan
  print entropy(pk=hist_china, qk=hist_china) # -0.0
  print entropy(pk=hist_flower, qk=hist_flower) # nan
  </code></pre>
  
  <p>I was expecting zero (unsigned?) as results.</p>
  
  <p>Am I applying entropy function correctly?
  Does it seem correct to apply this function on images histograms?</p>