Matlab codes to find MSE of many images against one

2 ビュー (過去 30 日間)
Abdulmu'min Musa
Abdulmu'min Musa 2019 年 7 月 25 日
編集済み: KALYAN ACHARJYA 2019 年 11 月 12 日
I know how to get the MSE(Mean Square Error) of one image against one image, but how can i do it to get the MSE of many images against one image which serve as the template?
The Matlab code below is the i use to get the MSE of one image against one image, how can i adjust it to solve my problem?
InputImage=imread('7-6.jpg');
ReconstructedImage=imread('7-6a.jpg');
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.2f dB', PSNR);

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 25 日
編集済み: KALYAN ACHARJYA 2019 年 7 月 31 日
MSE_data=[];
PSNR_data=[];;
Images=dir('C:\Complete_path\Input_folder_name\*.png');
%................Input Images, Note on .format...^^
ReconstructedImage=imread('7-6a.jpg');
for i=1:length(Images)
ImgName=strcat('C:\Complete_path\Input_folder_name\',Images(i).name);
InputImage=imread(ImgName);
n=size(InputImage);
M=n(1);
N=n(2);
MSE_data(i)= sum(sum((InputImage-ReconstructedImage).^2))/(M*N);
PSNR_data(i)= 10*log10(256*256/MSE(i));
fprintf('\nMSE: %7.2f ', MSE_data(i));
fprintf('\nPSNR: %9.2f dB', PSNR_data(i));
end
Also, here you are saving MSE and PSNR of all images in arrays, you can acess it later in your code.
  14 件のコメント
simarjit kaur
simarjit kaur 2019 年 11 月 12 日
this code correctly run bt not show any output
plz hlp me sir
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 11 月 12 日
編集済み: KALYAN ACHARJYA 2019 年 11 月 12 日
Please do share (detail).

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by