how to save image in axes gui?

1 次查看(过去 30 天)
hello..
i'm have a image in axes1 gui
how to save the image with uiputfile button..

采纳的回答

Image Analyst
Image Analyst 2012-6-3
  1. Call uigetfile() to get the input filename.
  2. Call imread() to read the input image from the disk into a variable in memory.
  3. Process the image in whatever way you want.
  4. Call imshow() to display the image in the axes.
  5. Call uiputfile() to get an output filename.
  6. Call imwrite() to save the image to disk.
If your image has annotation in the overlay (arrows, text, etc.) then use export_fig() - see the File Exchange. It's the first one you see on the File Exchange screen because it's the most downloaded function of all.

更多回答(1 个)

Alex Taylor
Alex Taylor 2012-6-4
Image Analyst's answer is great. I would only add that if the image in your GUIDE GUI has been somehow modified from the version originally read from the file, or if the 'cdata' of your image is stored in the .fig file of your GUI and you don't have access to the original file that the image came from, you would use the following modification to Image Analyst's steps:
  1. Execute "hIm = findall(hAx,'type','image')", you'll need to change hAx to the actual variable name of your axes handle.
  2. Execute get(hIm,'CData') to read the image data in axes1 into a variable in memory
  3. Process the image in whatever way you want.
  4. Call imshow() to display the image in the axes.
  5. Call uiputfile() to get an output filename.
  6. Call imwrite() to save the image to disk.
  1 个评论
Ahmed Ali
Ahmed Ali 2021-8-5
Thank you so much Alex, it worked perfectly!! you saved my brain from being exploded!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Title 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by