how to fed all the images to an array from a folder and from that array fed one by one image to a function?
    2 views (last 30 days)
  
       Show older comments
    
        function [features]=feature_extractor_2d(im2)
         %this function zones the input image and extracts features for each zone.
        srcFiles = dir('C:\Users\Omm\Desktop\thesis\multicharacterrec\*.png');  % the folder in which ur images exists
        for i = 1 : length(srcFiles)
                filename = strcat('C:\Users\Omm\Desktop\thesis\multicharacterrec\',srcFiles(i).name);
        im = imread(filename); 
        %selecting the universe of discourse
        im2=discourser(im);
    end
this function is replacing all the previous images to a new image and taking last one as a input but i want to get the features of all the image one by one please guide me how to do it in matlab?
6 Comments
  Walter Roberson
      
      
 on 14 Jul 2016
				          image = imread(filename);
is still using "image" as the name of a variable.
Accepted Answer
  Walter Roberson
      
      
 on 14 Jul 2016
        Also please use fullfile() instead of strcat() to build your names.
projectdir = 'C:\Users\Omm\Desktop\thesis\multicharacterrec';
srcFiles = dir(projectdir, '*.png');
numfiles = length(srcFiles);
outputs = cell(numfiles, 1);
for i = 1 : numfiles
   filename = fullfile(projectdir, srcFiles(i).name);
   thisimage = imread(filename); 
     %selecting the universe of discourse
     outputs{i} = discourser(thisimage);
   end
1 Comment
  Walter Roberson
      
      
 on 14 Jul 2016
				
      Edited: Walter Roberson
      
      
 on 15 Jul 2016
  
			projectdir = 'C:\Users\Omm\Desktop\thesis\multicharacterrec';
srcFiles = dir(projectdir, '*.png');
numfiles = length(srcFiles);
outputs = cell(numfiles, 1);
saved_images = cell(numfiles, 1);
for i = 1 : numfiles
   filename = fullfile(projectdir, srcFiles(i).name);
   thisimage = imread(filename);
   saved_images{i} = thisimage;
     %selecting the universe of discourse
     outputs{i} = discourser(thisimage);
   end
More Answers (0)
See Also
Categories
				Find more on Read, Write, and Modify Image in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!