I would like to perform the same operation on many images in the same folder stored in C drive of my computer. How to do the same with respect to the code attached ??

1 view (last 30 days)
This is my code for detecting black spot. Well, I would like to perform the same operation on many images in the same folder stored in C drive of my computer. How to do the same with respect to the code attached ??

Accepted Answer

Adam
Adam on 12 Jan 2015
s = dir( folder );
folderFiles = s( ~[s.isdir] );
filenames = { filderFiles.name };
will give you a list of filenames in the directory. You can interrogate these using fileparts and/or string-based functions such as strcmp to get rid of those that don't have the correct extension or are hidden files or some other type of file you do not want.
Then just loop over the rest with your code.
  2 Comments
vinith
vinith on 12 Jan 2015
thnaks a lot sir ! but it would be helpful if you could please get me the exact code for the given file since it has basefilename references to me made use of.
Adam
Adam on 12 Jan 2015
Edited: Adam on 12 Jan 2015
You haven't explained anything about a base filename and how it should be used with respect to other files in the same directory. I can see it in your code, but that doesn't imply anything about using this base filename for anything else.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 12 Jan 2015
Put that code into a function, and then call that function from inside a "for" loop like in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

Categories

Find more on Convert Image Type 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!