title: How to compute the Delta E between two images using OpenCV
body: <p>I'm currently trying to determine the color difference between our output image and a painting of Monet with Python using OpenCV.</p>
  
  <p>With my research I've seen that Delta E is the best for determining color difference. I've tried using extracting the BGR Channels of the two images and then taking the mean "Blue" "Green" and "Red" color used to use for computing the difference of each color channel.</p>
  
  <pre><code>output_chans = cv2.split(image)
  monet_chans = cv2.split(best_painting)
  colors = ("Blue", "Green", "Red")
  
  for (output_chan, monet_chan, color) in zip(output_chans, monet_chans, colors):
      output_mean = np.mean(output_chan)
      monet_mean = np.mean(monet_chan)
  
      color1_rgb = None
      color2_rgb = None
  
      if color == "Blue":
              color1_rgb = sRGBColor(0.0, 0.0, output_mean)
              color2_rgb = sRGBColor(0.0, 0.0, monet_mean)
      elif color == "Green":
              color1_rgb = sRGBColor(0.0, output_mean, 0.0);
              color2_rgb = sRGBColor(0.0, monet_mean, 0.0);
      elif color == "Red":
              color1_rgb = sRGBColor(output_mean, 0.0, 0.0);
              color2_rgb = sRGBColor(monet_mean, 0.0, 0.0);
  
      # Convert from RGB to Lab Color Space
      color1_lab = convert_color(color1_rgb, LabColor);
  
      # Convert from RGB to Lab Color Space
      color2_lab = convert_color(color2_rgb, LabColor);
  
      # Find the color difference
      delta_e = delta_e_cie2000(color1_lab, color2_lab);
  
      print("Delta E of the Mean of %s Channel: %f" % (color, delta_e))
  </code></pre>
  
  <p>I receive an output of for the color difference for each color channel, however my professor suggests that I may be doing Delta E wrong as I'm supposed to only get one value for the color difference of the entire image instead of one value for each three color channels. In this case is there an alternative method or a correct method of of calculating the Delta E of our two images?</p>
  
  <p>This is a link to a sample of our test image: <a href="https://imgur.com/a/KToggFS" rel="noreferrer">https://imgur.com/a/KToggFS</a></p>
  
  <p>And a link to a sample of the paintings: <a href="https://imgur.com/a/vi1SFax" rel="noreferrer">https://imgur.com/a/vi1SFax</a></p>