Method 1, if the name is irregular, but the format is uniform, you can read the index (as a structure) of the picture in all formats and jpg in the following way, where the name element is the name of the picture. Then you can follow imread to read.
copy code
Method 2, the names are regular, for example, 0001.jpg 0002.jpg 0003.jpg
can construct names by themselves.
copy code
- img_dir = dir ('./ data / *. jpg');
- for i = 1:3
- I = imread(['./data/' img_dir(i).name]);
- end
Method 2, the names are regular, for example, 0001.jpg 0002.jpg 0003.jpg
can construct names by themselves.
- for i =1:3
- I = imread(['./data/' num2str(i,'%04d') '.jpg'] );
- end