我写了这段代码:
InputImage=imread('ground truth 1.jpg');
ReconstructedImage=imread('final1.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.7f dB', PSNR);
如何修改编码以提示用户从文件夹中选择InputImage
图像OutputImage
?我以前尝试过这样的事情
[InFile, InPath] = uigetfile('*.jpg', 'Import image file:');
if ~ischar(InFile)
disp('User aborted file import');
return;
end
[OutFile, OutPath] = uigetfile('*.jpg', 'Export image file:', InPath);
if ~ischar(OutFile)
disp('User aborted file export');
return;
end
InFile = fullfile(InPath, InFile);
OutFile = fullfile(OutPath, OutFile);
但我得到一个错误:
Matirx dimension not agree error