How do I compute RMSE for Color Image ??
5 views (last 30 days)
Show older comments
I wish to compute RMSE for color images and I applied the code below was to compute RMSE for grayscale image.
Please will this same code be applicable to (RGB) color image ??
% RMSE for Grayscale Images
data = imread('woman_GT[1-Original].bmp'); % Read real data
estimate = imread('woman_GT[8-Our Method].bmp'); % Read predicted data
rmseResults=RMSE(data,estimate); % Compute RMSE
% Alert user of the answer.
message = sprintf('The Root mean square error is %.3f.', rmseResults);
msgbox(message);
Thanks
0 Comments
Accepted Answer
Rik
on 17 Nov 2018
If the function you are using is from this FEX submission, then yes, it will work. The interpretation of the RMSE might be more difficult, or it might not even make sense.
The root mean square error is just that: sqrt(mean(err^2)), so as long as you modify that to support vectors or matrices, it should work.
3 Comments
Image Analyst
on 19 Nov 2018
Which would mean adding a dot before the caret
r = sqrt(mean(err .^ 2))
Or you could use the built-in functions immse() and psnr().
Rik
on 19 Nov 2018
I agree with the use of built-in functions whenever you have access to them, you never know where Mathworks engineers were able to put some tricks to increase performance (now or in a future release).
However, the code here will only yield the expected result for vector input, because mean will return an array with one dimension less than the input, so a 2D input will become a vector. (of course for a scalar input, the output will not be 0 dimensions)
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!