How do I compute RMSE for Color Image ??

조회 수: 5 (최근 30일)
Chidiebere Ike
Chidiebere Ike 2018년 11월 16일
댓글: Rik 2018년 11월 19일
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

채택된 답변

Rik
Rik 2018년 11월 17일
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
Image Analyst
Image Analyst 2018년 11월 19일
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
Rik 2018년 11월 19일
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)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by