How to save and view the calculated psnr, mse and snr values of multiple images using array?

조회 수: 17(최근 30일)
MINO GEORGE
MINO GEORGE 2021년 4월 14일
답변: Monisha Nalluru 2021년 4월 20일
This is my code
[peaksnr, snr] = psnr(m, g);
MSE=mean2((m-g).^2);
how to display these measures in excel or in any other formats?

답변(1개)

Monisha Nalluru
Monisha Nalluru 2021년 4월 20일
From my understanding you wanted to save the result of psnr, mse, snr in excel file.
If all the images filename is stored in array then you for loop to calculate psnr, mse, snr
imagesname = ['image1','image2']; % all images names
refimg = imread('referenceimage');
finalpsnr = []; % store psnr of each image
finalsnr = [];
finalmse = [];
for i=1:length(imagesname)
img = imread(imagesname(i));
[psnr,snr] = psnr(img, refimg);
mse = mean2((img - refimg).^2);
finalpsnr(i) = psnr;
finalsnr(i) = snr;
finalmse(i) = mse;
end
% store whole calculations result in table
t = table(finalpsnr,finalsnr,finalmse);
% use writetable to write content to required file format
writetable(t,'cal.xlsx');

Community Treasure Hunt

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

Start Hunting!

Translated by