%Function to access image from different folder using MATLAB
function [H0 H1 H2]=Test1()
%To choose the first folder
[c,d]=uigetfile
r=fullfile(d,'*.pgm');
file=dir(r);
%To choose second folder
[c1,d1]=uigetfile
r1=fullfile(d1,'*.tiff');
files=dir(r1);
%Reading image from different folder
% r=randperm(7,1); %i=randperm(50,1); this option can be used to access randomly
r=1; i=7; %to access image with index 1 and 7 in first and second folder
%Reading image files
s=imread(fullfile(d,file(i,1).name));
iw=imread(fullfile(d1,files(r,1).name));
figure, imshow(s);
figure, imshow(iw);
end
function [H0 H1 H2]=Test1()
%To choose the first folder
[c,d]=uigetfile
r=fullfile(d,'*.pgm');
file=dir(r);
%To choose second folder
[c1,d1]=uigetfile
r1=fullfile(d1,'*.tiff');
files=dir(r1);
%Reading image from different folder
% r=randperm(7,1); %i=randperm(50,1); this option can be used to access randomly
r=1; i=7; %to access image with index 1 and 7 in first and second folder
%Reading image files
s=imread(fullfile(d,file(i,1).name));
iw=imread(fullfile(d1,files(r,1).name));
figure, imshow(s);
figure, imshow(iw);
end
Comments
Post a Comment