hi, I have around 1000 images which I need to load in to matlab and do some operations on. The problem is that the images have random names without any order. Any suggestions on how I could read them in to matlab? thanks mehdi |
|
Loading many images
Started by ●October 21, 2002
Reply by ●October 21, 20022002-10-21
Hi, You can probably use the dir command in the following way. D = dir; This will return array of structures with the name and other properties of the files like size in the current directory. You can then loop over the structures to read the files using imread(D(i).name); Navan --- wrote: > hi, > > I have around 1000 images which I need to load in to > matlab and do some > operations on. The problem is that the images have > random names without > any order. Any suggestions on how I could read them > in to matlab? > > thanks > mehdi __________________________________________________ |
Reply by ●October 21, 20022002-10-21
Hi, Make a list of the files : File_list = {''dog', 'Cat', 'Giraf',.... ,'Panda'}; % suppose these are the files names Make a calling loop: for n=1:length(File_list) eval(['M' num2str(n) ' = mread(File_list{n},''jpg'');']) % suppose the images are of JPEG type end You will get all the images as M1, M2, ...., M1000 if and only if there is enough memory for that. If you can do the operation on the images one by one than, leave out the num2str(n) token and do the operation within the loop. Joe BSTeX- Equation viewer for Matlab http://www.geocities.com/bstex2001 --- wrote: > hi, > > I have around 1000 images which I need to load in to > matlab and do some > operations on. The problem is that the images have > random names without > any order. Any suggestions on how I could read them > in to matlab? > > thanks > mehdi > __________________________________________________ |
Reply by ●October 21, 20022002-10-21
Mehdi- > I have around 1000 images which I need to load in to matlab and do some > operations on. The problem is that the images have random names without > any order. Any suggestions on how I could read them in to matlab? They are filenames? If so, go to DOS prompt (yep it still works) and type: dir *.jpg > image_list.txt Edit that list as needed with some mass-replace and then read into your MATLAB code or just put into your code directly. From there you're on your own. Jeff Brower DSP sw/hw engineer Signalogic |