-1

I have a collection of images taken with different lens (same distorsion) and I want to see if theres a difference in the colour.

I think the best way to compare is simple average, for which I have:

import cv2
import numpy
myimg = cv2.imread('image.jpg')
avg_color_per_row = numpy.average(myimg, axis=0)
avg_color = numpy.average(avg_color_per_row, axis=0)
print(avg_color)

From: How to find the average colour of an image in Python with OpenCV?

I am struggling to find out if I should be using squared values of rgb and how i would do this in python. Any help highly appreciated & any advice on other ways to compare colour of identical images. I am new here so pls advise on any protocol ive missed out on too. Thank you.

Buzzius
  • 1
  • 1

1 Answers1

0

That is a very broad question. And it depends on what you call "difference of color".

  • Are your images supposed to be strictly (to the pixel) aligned? Your comparison by rows seems to indicate so. But the rest of the text makes it very unrealistic (in fact, even in industrial computer vision, for example to control defects on parts, in very controlled environment, strictly positioned parts and cameras, this is unrealistic).
  • Are differences of luminosity considered difference of color?
  • Are the images contents supposed to be identical?
  • ...

Very generally speaking, if what you are trying to assess is color impact of a lense, on an otherwise very similar image (same lighting, same object), I would just compute histograms of colors and compare them.

chrslg
  • 9,023
  • 5
  • 17
  • 31
  • - the images are pixel aligned as precisely as possible. However i chose average colour as i hoped this would negate the need to precise alignment. - I had not considered luminosity effect, but will consider it now. - image contents are identical. I will look into computing histograms instead. Thanks. – Buzzius Oct 29 '22 at 12:44