reading mutiple images one by one without overwriting

1 view (last 30 days)
to read multiple images one by one from folder without overwriting.i was new to matlab so plz provide me coding to read image1,image2...image89
  11 Comments
Michael Haderlein
Michael Haderlein on 17 Sep 2014
I believe the files are just not in the current folder. You can get the path of the current folder by
pwd
Also, these files must appear in the current folder window. I suppose they don't. Either copy the files into this folder or construct the full file name as Image Analyst has suggested.

Sign in to comment.

Answers (4)

Image Analyst
Image Analyst on 17 Sep 2014
Why would reading a file overwrite it? imread() does not do writing.
  14 Comments
Image Analyst
Image Analyst on 18 Sep 2014
My guess is that he didn't have any gif files called images*.gif in the desktop folder. My guess is that there was probably a folder called "images" on the desktop, so he was missing a slash between the images and the asterisk. If so, figs would be empty since it did not find the files . I put that / in and then used fullfile() to be more robust and explicit.
Michael Haderlein
Michael Haderlein on 18 Sep 2014
Ah, I see. I always thought 'image' would be part of the file name. Thanks for pointing me on that. I seriously became doubtful about my Matlab skills.

Sign in to comment.


Michael Haderlein
Michael Haderlein on 18 Sep 2014
Because you have to tell imread where to find the file.
figs=dir('C:\Users\swathi\Desktop\image*.gif');
for cnt=1:length(figs)
image=imread(['C:\Users\swathi\Desktop\' figs(cnt).name]);
subplot(1,length(figs),cnt)
imshow(image)
end
  15 Comments
Image Analyst
Image Analyst on 18 Sep 2014
vetri's "Answer" moved here since it's not an "Answer" to his question but actually just a follow up (and duplicate) question:
i want to read 1st image perform some operation and store in an array and then next and next .what to do?
Image Analyst
Image Analyst on 18 Sep 2014
I gave you code above. I'm not sure why you're re-asking.

Sign in to comment.


vetri
vetri on 19 Sep 2014
I want to read all images and perform some operation and all image result must be store in an array..but in this it is storing last image value only.
  4 Comments
Michael Haderlein
Michael Haderlein on 19 Sep 2014
Ok, please: Write exactly what you want. This thread now has 4 answers and in total 44 comments (this one here not included). At least 3 people have tried to help including Image Analyst who is one of the most experienced users here in this forum. Most likely, it's not complicated what you want to do. But we're struggling to understand what you want.
"after performing some operation the value of each image should be stored in array..how to code for that"
"but I have to show the result for all images at a time"
Do you want to store the result or do you want to show it? If you want to show it, where? In the command window? In the title of each image? Inside each image? In a separate figure? We cannot know that.
Michael Haderlein
Michael Haderlein on 19 Sep 2014
vetri's answer on the comment above:
"after performing some operation i want to store the result of each image in an array.but in my coding for one image result is store in an array...thank u very much for your helps"
That is exactly what Image Analyst's code does: http://www.mathworks.com/matlabcentral/answers/155155#comment_237898
In his code, there is the comment
% Code to read images: imread(), etc.
You need to replace this line by the lines which read the image. See all the codes before. There is no need to create a second loop.
Then, you need to do this operation on the image which was abbreviated by
theseResults = AnalyzeSingleImage(theImage);

Sign in to comment.


vetri
vetri on 19 Sep 2014
after performing some operation i want to store the result of each image in an array.but in my coding for one image result is store in an array...thank u very much for your helps

Categories

Find more on Image Processing Toolbox 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!