reading mutiple images one by one without overwriting

7 ビュー (過去 30 日間)
vetri
vetri 2014 年 9 月 17 日
コメント済み: Michael Haderlein 2014 年 9 月 19 日
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 件のコメント
vetri
vetri 2014 年 9 月 17 日
am getting error as image does not exist
Michael Haderlein
Michael Haderlein 2014 年 9 月 17 日
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.

サインインしてコメントする。

回答 (4 件)

Image Analyst
Image Analyst 2014 年 9 月 17 日
Why would reading a file overwrite it? imread() does not do writing.
  14 件のコメント
Image Analyst
Image Analyst 2014 年 9 月 18 日
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 2014 年 9 月 18 日
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.

サインインしてコメントする。


Michael Haderlein
Michael Haderlein 2014 年 9 月 18 日
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 件のコメント
Image Analyst
Image Analyst 2014 年 9 月 18 日
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 2014 年 9 月 18 日
I gave you code above. I'm not sure why you're re-asking.

サインインしてコメントする。


vetri
vetri 2014 年 9 月 19 日
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 件のコメント
Michael Haderlein
Michael Haderlein 2014 年 9 月 19 日
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 2014 年 9 月 19 日
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);

サインインしてコメントする。


vetri
vetri 2014 年 9 月 19 日
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

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by