reading mutiple images one by one without overwriting

7 Ansichten (letzte 30 Tage)
vetri
vetri am 17 Sep. 2014
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 Kommentare
vetri
vetri am 17 Sep. 2014
am getting error as image does not exist
Michael Haderlein
Michael Haderlein am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (4)

Image Analyst
Image Analyst am 17 Sep. 2014
Why would reading a file overwrite it? imread() does not do writing.
  14 Kommentare
Image Analyst
Image Analyst am 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 am 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.

Melden Sie sich an, um zu kommentieren.


Michael Haderlein
Michael Haderlein am 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 Kommentare
Image Analyst
Image Analyst am 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 am 18 Sep. 2014
I gave you code above. I'm not sure why you're re-asking.

Melden Sie sich an, um zu kommentieren.


vetri
vetri am 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 Kommentare
Michael Haderlein
Michael Haderlein am 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 am 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);

Melden Sie sich an, um zu kommentieren.


vetri
vetri am 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

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by