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

2 views (last 30 days)
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?

Answers (1)

Monisha Nalluru
Monisha Nalluru on 20 Apr 2021
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!