How to evaluate PSNR values of multiple images by single loop according to the images sequence in directory/folder?

8 ビュー (過去 30 日間)
I have refrence images in seprate folder, and output images in another directory. Now i want to calculate the PSNR values by single loop, the code is given below
Directory = 'input\images';
Directory2 = 'results\images';
% Read images from Images folder
Imgs = dir(Directory);
Imgs2=dir(Directory2);
for j=1:length(Imgs)
thisname = Imgs(j).name;
thisname2 = Imgs2(j).name;
thisfile = fullfile(Directory, thisname);
thisfile2 = fullfile(Directory2, thisname2);
try
Img = imread(thisfile); % try to read image
Img2 = imread(thisfile2);
% %Im = Img(:,:,1);
% % Im2 = Img2(:,:,1);
% figure, imshow(thisfile);
% title(thisname);
% figure, imshow(thisfile2);
% title(thisname2);
% % title(thisname2);
%
[peaksnr, snr] = psnr(Img2, Img);
fprintf('\n The Peak-SNR value is %0.4f', peaksnr);
catch
end
end
my code is running smoothly and calculate me the PSNR values in single loop, but it doest give me the PSNR values in proper ordere. We mean it give us the PSNR values in shuffle order.

採用された回答

Image Analyst
Image Analyst 2019 年 6 月 30 日
Try adding an index so that they go into an array:
[peaksnr(j), snr(j)] = psnr(Img2, Img);
  6 件のコメント
Haseeb Hassan
Haseeb Hassan 2019 年 7 月 2 日
Thankyou sir for always being here.
DIPTI MISHRA
DIPTI MISHRA 2020 年 6 月 9 日
but how to get,,,mean value of all

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by