save image from imshow using imwrite

12 ビュー (過去 30 日間)
Sebastian
Sebastian 2012 年 5 月 5 日
コメント済み: Abu Kalam 2018 年 10 月 26 日
Hi all,
I'm using imshow(a,[]) to edit the intensity of a grayscale picture and plot it. I would like to save this brighter figure using imwrite(). I want this picture to be the same size as the original. I can't get this to work. I can't get imwrite to save the new figure.
I've tried to solve this problem using functions that do more or less the same thing, like mat2gray() and getframe(), but I just want to know how I can save the figure created by imshow() with imwrite() . This is the code:
h = imshow(inputimage,[]);
test = getimage(h);
imwrite(test,'imageoutput.tif');
I really hope someone can help me out.
  1 件のコメント
Abu Kalam
Abu Kalam 2018 年 10 月 26 日
Thank you. Your code works for me as i want. :D

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

回答 (2 件)

Image Analyst
Image Analyst 2012 年 5 月 5 日
imshow() does not allow you to edit the image. You can save the image by using imwrite(inputimage, filename); If you have other, missing code, such as adding annotation or applying a colormap or whatever, then use export_fig() as mentioned in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.

Walter Roberson
Walter Roberson 2012 年 5 月 5 日
The File Exchange contribution http://www.mathworks.com/matlabcentral/fileexchange/7943 will convert the indexed image to truecolor that you can then imwrite()

カテゴリ

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