Tuesday, 27 August 2013

reading multiple images im matlab



k=dir('D:\zzzzzzzz/MATLAB/image processing/*.jpg');

>>if you want  to read an image of jpg extension then 

k=dir('*.jpg*');

k will be created as an structure variable.It will load all the files in the current working directory that has .jpg extension.

>>In genreal it searchs the filenames in the folder that has the string inserted in between * *

>>suppose you want to read more than one image then rename all the images you want to read such that  they contain common string in the name (exp to read all that contain string 'test')

>>k=dir('*test*');

you can access the individual files by ..............

>>k(1).name
ans=test(1).jpg;

you can use as 

img=imread(ans);

No comments:

Post a Comment