Saving Image on Axes component to File
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Jan
on 28 Oct 2015
Edited: Jan
on 28 Oct 2015
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 Comments
Jan
on 30 Oct 2015
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.
More Answers (0)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!