finding MSE and MAE for RGB image

 Accepted Answer

To within a constant factor that might depend upon image size,
MSE = sum( (FirstImage(:) - SecondImage(:)).^2 );

8 Comments

Walter then for MAE
my image is peppers.png
It's just the absolute value of the differences! Be sure to cast to double to allow negative numbers. Subtracting uint8's will clip to zero. Is this homework?
Good point about casting to doubles. I should have said
MSE = sum( (double(FirstImage(:)) - double(SecondImage(:))).^2 );
can u please tell what is the difference in notation of 1 and 2,both equation are sme but notation is different
As the document indicates, |x| with a subscript of 2 corresponds to the L2 normal, which is the Euclidean Norm, also known as Euclidean distance. The Euclidean distance is like sqrt( (x1-x2)^2 + (y1-y2)^2) and so on. Notice that in the formula given, they square this value -- that is what the superscript 2 is about, squaring the result of the Euclidean distance. The squaring cancels out the sqrt(), leaving (x1-x2)^2 + (y1-y2)^2
The |x| with a subscript 1 is the L1 norm, also known as the taxicab distance or the Manhattan norm. This corresponds to x1-x2 + y1-y2 with no sqrt(). Notice though that in the formula they do not square this, leaving x1-x2 + y1-y2, abs(x1-x2) + abs(y1-y2)
so walter can u tell how to write eq for MAE PLEASE
Like MSE except using abs() instead of .^2

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!