How to access multiple images in a single code ?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hello Mathworks,
My question might sound a little bit odd but what I meant to say was if I have a group of 25 images in a single folder and if I have to calculate say max pixel or min pixel of every image then do I need to write min(x1) min(x2) ..... min(x25) or is there anyway with which I could write a code once and repeat it for other 24 images ?
I have had this doubt for quite a long time so now I am waiting to see some interesting facts :)
Thanks All
採用された回答
Sean de Wolski
2011 年 5 月 26 日
10 件のコメント
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
That was super fast Sean.
Thanks for the help :)
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
I took the example code from the link and when I ran it I found this error
??? Conversion to cell from uint8 is not possible.
jpegFiles = dir('*.jpg');
numfiles = length(jpegFiles);
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = imread(jpegFiles(k).name);
end
Sean de Wolski
2011 年 5 月 26 日
What line was the error on? I don't see anything here that would throw that error.
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
Line 6
mydata(k) = imread(jpegFiles(k).name);
Sean de Wolski
2011 年 5 月 26 日
Where's Waldo MATLAB Style:
Look for the subtle but lethal difference between the line in the previous comment and your comment before!
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
Yep I figured it now.But how do I convert it into gray ???rgb2gray() doesn't work on 'cell' class ?
Sean de Wolski
2011 年 5 月 26 日
mygraydata = cellfun(@(x)rgb2gray(x),mydata,'uni',false);
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
Sean you are an awesome guy :) How do you know all these ???
Harsha Vardhan Rao Avunoori
2011 年 5 月 26 日
Okay now since I have loaded all my gray 22 images into one single variable.I got another question. How do I access each of them ? As mygraydata is 1 x 22 cell and each cell contains an image of size 408 x 704. I have tried converting this cell to matrix using cell2mat() but still I cannot call single image to find it's maximum value.
Sean de Wolski
2011 年 5 月 26 日
gray3Dimage = cell2mat(reshape(mygraydata(:),[1 1 22]));
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Blocked Images についてさらに検索
参考
2011 年 5 月 26 日
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
