How to request for user input for the following code? How do I modify the matlab code below to prompt user to choose images from folder for InputImage and OutputImage?
이전 댓글 표시
InputImage=imread('a.jpg');
OutputImage=imread('b.jpg'); whos
n=size(InputImage);
M=n(1);
N=n(2);
MSE = sum(sum((InputImage-OutputImage).^2))/(M*N);
PSNR = 10*log10(255*255/MSE);
fprintf('\nMSE: %7.2f ', MSE);
fprintf('\nPSNR: %9.7f dB', PSNR);
댓글 수: 2
Khaled Al-Faleh
2017년 5월 9일
try this to allow user to select image from his device
[filename,path]=uigetfile('*.png','file selector');
Image=strcat(path,filename);
Img=imread(Image);
답변 (1개)
Jan
2017년 5월 9일
[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);
댓글 수: 1
jolene kuan
2017년 5월 9일
편집: jolene kuan
2017년 5월 9일
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!