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?
Show older comments
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 Comments
Khaled Al-Faleh
on 9 May 2017
try this to allow user to select image from his device
[filename,path]=uigetfile('*.png','file selector');
Image=strcat(path,filename);
Img=imread(Image);
Answers (1)
Jan
on 9 May 2017
[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 Comment
jolene kuan
on 9 May 2017
Edited: jolene kuan
on 9 May 2017
Categories
Find more on Get Started with Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!