Saving Image on Axes component to File

Is there a reason why an image that is displayed on an axes1 is not saving to file via:
I=double(getimage(handles.axes1));
class I
figure
imshow(I,[])
imwrite(I,'C:\mtf.bmp')
the class of I is returning char?
Thanks

 採用された回答

Jan
Jan 2015 年 10 月 28 日
編集済み: Jan 2015 年 10 月 28 日

0 投票

class I
is the short form of:
class('I')
so it is the character array containing an uppercase 'I'. Try:
class(I)
Now the problem, that the file is not written. Do you get an error message? Perhaps the one, that you do not have write permissions in C:\ ? Then try to save the file to another folder you have write permissions to.

5 件のコメント

Jason
Jason 2015 年 10 月 28 日
Hi, it saves to disk OK, but its just blank as attached.
<<
>>
Jan
Jan 2015 年 10 月 29 日
Blanks?! It is an image file filled with one single color. Where do you see "blanks" - which are characters. And what do you expect? What does the image contain? Are you sure, that the conversion to double is useful?
Jason
Jason 2015 年 10 月 29 日
This is the picture that 'Im trying to save.
Its a tiff image (uint16), and you are correct I don't need the double.
When I save it as a tif it works, but if I try to save as jpg or bmp it gives the blank image shown earlier.
I was getting an error that to save as jpg or bmp, the data needs to be double. After converting, I still only save an "empty" image as shown previously.
I=double(I);
imwrite(I,'C:\mtf.bmp')
imwrite(I,'C:\mtf.jpg')
Jan
Jan 2015 年 10 月 30 日
The image is not empty, but white - correct? Converting the UINT16 values to doubles means for an image, that all values > 1 are clipped to 1.0, which means a white pixel. Try:
I = double(I/max(I(:)));
or
I = double(I / maxint('uint16'));
Using im2double considers the scaling also.
Jason
Jason 2015 年 11 月 2 日
Hi Jan, only the im2double worked.for the other two:
I = double(I/max(I(:)));
Gave the white image again, and
I = double(I / maxint('uint16'));
Gave an error that no maxint exists. thanks jason

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2015 年 10 月 28 日

コメント済み:

2015 年 11 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by