ruaa
ruaa

Reputation: 29

reading and writing mulltiple images automatically in matlab?

i have 250 images stored at

E:\HandVein_DataSet

these 250 images belong to 50 person , this mean each one has 5 images

these pictures are arranged as following

0001hv1-0001hv2-0001hv3-0001hv4-0001hv5 ....0002hv1-0002hv2-0002hv3-0002hv4-0002hv5 until 0050hv1-0050hv2-0050hv3-0050hv4-0050hv5

I want to read all these images and processing them according my steps and then saved the resultant images after preproceesing in a specific file,for example at E:\final result.

How can i do this in matlab?

Upvotes: 1

Views: 780

Answers (1)

dantswain
dantswain

Reputation: 5467

I'm assuming that the filenames are, e.g., 0001hv1.jpg (you can change the extension as necessary). You don't say what the output is; I'm assuming it's a modified version of the input image and that you want to use the same naming scheme.

in_dir = 'E:/Hand/Vein_DataSet';
out_dir = 'E:/final\ result';

for px = 1 : 50,
    for hx = 1 : 5,
      fname = sprintf('%04dhv%d.jpg', px, hx);  
      current_image = imread(fullfile(in_dir, fname));

      % do processing
      out_image = some_function(current_image);

      % save output
      imwrite(out_image, fullfile(out_dir, fname));
    end
end

Upvotes: 1

Related Questions