I am new to matlab. When i run my code, the output is printed multiple times with different values. What's wrong with this code?
InputImage=imread("img1.png");
ReconstructedImage=imread("img2.png");
n=size(InputImage);
M=n(1);
N=n(2);
MSE = sum(sum((InputImage-ReconstructedImage).^2))/(M*N);
PSNR = 10*log10(256*256/MSE);
fprintf('\nMSE: %7.2f ', MSE);
fprintf('\nPSNR: %9.7f dB', PSNR);
Output:
MSE: 0.70
MSE: 0.61
MSE: 0.99
PSNR: 49.7147717 dB
PSNR: 50.3459133 dB
PSNR: 48.1905858 dB

 채택된 답변

Star Strider
Star Strider 2020년 1월 1일

0 개 추천

The .png image is an (MxNx3) matrix, so the calculations occur for each ‘page’ in the third dimension.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

태그

질문:

2020년 1월 1일

답변:

2020년 1월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by