Search code examples
matlabthreshold

Root Mean Square Error with Matlab


I have an image.How can I do RMSE?

I = imread('cameraman.tif');

Solution

  • If you want to get a single number that represents the RMSE of the whole image, try rmse = sqrt(mean((I(:)-A(:)).^2)) that gives you a single number.

    If you're looking to plot RMSE for each pixel, then there's no need to take the mean. Moreover, you need to convert A and I to a float matrix so sqrt doesn't return an error. Try sqrt((double(I-A)).^2).