Azzera filtri
Azzera filtri

What does a low RMSE value of an image determine?

4 visualizzazioni (ultimi 30 giorni)
soni
soni il 12 Apr 2015
Commentato: Image Analyst il 12 Apr 2015
Hi,
I am comparing two images and wanted to calculate the error.
Does a lower RMSE value show a small error?
Thanks

Risposte (1)

Image Analyst
Image Analyst il 12 Apr 2015
It means that the "test" image is close to the "reference" image on a pixel-by-pixel basis, if that's the RMSE method you used.
  1 Commento
Image Analyst
Image Analyst il 12 Apr 2015
I assume b and N are images, then it's almost correct. You need to square the (a-b) before you take the mean. You can use mean2() instead of mean(mean()) if they are gray scale images. See this snippet from my attached demo
%------ PSNR CALCULATION ---------------------
% Now we have our two images and we can calculate the PSNR.
% First, calculate the "square error" image.
% Make sure they're cast to floating point so that we can get negative differences.
% Otherwise two uint8's that should subtract to give a negative number
% would get clipped to zero and not be negative.
squaredErrorImage = (double(grayImage) - double(noisyImage)) .^ 2;
% Display the squared error image.
subplot(2, 2, 3);
imshow(squaredErrorImage, []);
title('Squared Error Image', 'FontSize', fontSize);
% Sum the Squared Image and divide by the number of elements
% to get the Mean Squared Error. It will be a scalar (a single number).
mse = sum(squaredErrorImage(:)) / (rows * columns);
% Calculate PSNR (Peak Signal to Noise Ratio) from the MSE according to the formula.
PSNR = 10 * log10( 256^2 / mse);
% Alert user of the answer.
message = sprintf('The mean square error is %.2f.\nThe PSNR = %.2f', mse, PSNR);
msgbox(message);
Note that there are now built in functions for mse called immse() and PSNR caleld psnr().

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by