How can I save a image from imshow into a cell array ?

2 ビュー (過去 30 日間)
Lee Willy
Lee Willy 2020 年 1 月 7 日
回答済み: Image Analyst 2020 年 1 月 7 日
Hi ,I used (dd = [128 48] ;) doubles array to do mat2gray() , then doing the imshow to save image in a cell array (like dat{i,1}=imshow(mat2gray(dd));)
But when the image update , those data can't save at the cell array.
i wanna save these data in cell arrat that me can simply take data to training my CNN .and i have no idea.
Have anyone can save me ,plz
  2 件のコメント
Stephen23
Stephen23 2020 年 1 月 7 日
編集済み: Stephen23 2020 年 1 月 7 日
"...then doing the imshow to save image in a cell array ... dat{i,1}=imshow(...)"
As the imshow documentation clearly states, its output is not an image, it is a handle to an image object:
If you do not know what graphics objects are, then read this and its child pages:
Rather than storing the handles in a cell array, I strongly recommend that graphics object handles be stored in a graphics object array:
If you really want to store the image data (i.e. the objects' CData), then use a cell array.
Lee Willy
Lee Willy 2020 年 1 月 7 日
Sincerely appreciate your answer , i will try graphics object array to do my object. Thank you!!

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

採用された回答

Ridwan Alam
Ridwan Alam 2020 年 1 月 7 日
編集済み: Ridwan Alam 2020 年 1 月 7 日
I don't think you need the imshow(). imshow() is only used to show the image, and it returns an image object, which is not normally used in CNN training..
dat{i,1} = mat2gray(dd);
should store the grayscale image dd to dat cell array. If you want to show it later, just use imshow(dat{i,1}).
  2 件のコメント
Stephen23
Stephen23 2020 年 1 月 7 日
"imshow() ... returns a figure handle"
imshow does not return a handle to a figure object. It returns a handle to an image object.
Lee Willy
Lee Willy 2020 年 1 月 7 日
Sincerely appreciate your answer .
i don't know why my imageinput can't use gray data.
just wanna try this method if it can work.
so now i let data saveas picture to do my object.
hope it can work.

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2020 年 1 月 7 日
I don't know why you're trying to store anything in a cell array. If you have tons of training images, you may not even have enough memory. Why not use the way that the Mathworks recommends, which is to use an imageDatastore object?

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by