1

I've been looking at calculating the difference between 2 images. After some googling, I keep running into sources advising to use the Mean Squared Error or Root Mean Squared Error.

Further, there seem to be 2 algorithms for this that keep popping up in searches:

I have 2 questions:

Why use the Mean Squared Error or Root Mean Squared Error as opposed to, say, the Mean Absolute Error (or any other error function)?

Why would you calculate the Mean Squared Error of a histogram? What does a histogram have to do with anything? And why use the square of the histogram index?

cowlinator
  • 7,195
  • 6
  • 41
  • 61
  • Just because someone writes a blog post about it online doesn’t mean it makes sense or you should do the same. There are lots of bad ideas and bad conclusions online. – Cris Luengo Aug 07 '19 at 00:08
  • So you're saying it is a bad idea? Any particular reason why? – cowlinator Aug 07 '19 at 00:43
  • since the errors are squared before they are averaged, the RMSE gives a relatively high weight to large errors. This means the RMSE should be more useful when large errors are particularly undesirable. Apart from that RMSE and MAE doesnt differ much – venkata krishnan Aug 07 '19 at 01:27
  • You were asking “Why would you calculate the Mean Squared Error of a histogram? What does a histogram have to do with anything?” Those are good questions, but have no answer. It makes no sense to do these things. No need to give a reason why you shouldn’t do them, if you don’t have a reason to do them. – Cris Luengo Aug 07 '19 at 01:30
  • If you compare histograms, you ignore the spatial location and the spatial relationship between pixels. Many different images have the same histogram. It makes no sense to compare images by their histogram. – Cris Luengo Aug 07 '19 at 01:31
  • @CrisLuengo, I see, thanks. By the way, it's not just "a blog post about it online", there are many top-voted answers here on Stack Overflow that recommend histograms. Example: https://stackoverflow.com/questions/11816203/python-code-to-compare-images-in-python – cowlinator Aug 07 '19 at 02:09
  • 1
    That first answer computes the histogram of the differences, not the difference of histograms. It uses the histogram as a shortcut to compute the RMSE. However, it is even easier to compute without the histogram. If you need the histogram for something else, you can re-use it to compute the second order moment (and many other statistics). But otherwise it’s easier to directly compute the sum of squares. – Cris Luengo Aug 07 '19 at 02:22

0 Answers0