-2

I have a folder which contains multiple images,I want to load all those images and process in individually...How can i do it using matlab? I tried using the following piece of code, It says "Unable to read xyz.jpg. No such file or directory found"...xyz is the first file in that folder.

imagefiles = dir('F:\SIFT_Yantao\demo-data\*.jpg');      
nfiles = length(imagefiles);    % Number of files found
 for i=1:nfiles
 currentfilename=imagefiles(i).name;
 I2 = imread(currentfilename);
 [pathstr, name, ext] = fileparts(currentfilename);
 textfilename = [name '.mat'];
fulltxtfilename = [pathstr textfilename];
load(fulltxtfilename);
descr2 = des2;
frames2 = loc2;
do_match(I1, descr1, frames1, I2, descr2, frames2) ;
end
Twinkal
  • 424
  • 2
  • 7
  • 19

1 Answers1

0

You can easily load multiple image with same type as follow:

imgPath = 'Here Insert folder that contain images'; dCell = dir([imgPath '.png']); % NOTE: CHANGE FILETYPE AS APPROPRIATE FOR EACH SEQUENCE (.png, *.bmp, or *.jpg)

for d = 1:length(dCell) Seq{d} = imread([imgPath dCell(d).name]); end

Ehsan
  • 144
  • 3
  • Well this works...but i now want to extract its filename how can i do that?? – Twinkal Mar 27 '13 at 12:36
  • if all the images have same type,you don't need to know their file names. after loading all images, you can access to them in matlab. – Ehsan Jun 06 '13 at 13:41