How to get jpeg/png image for processing thanks to GUI?

1 次查看(过去 30 天)
Well I need to browse my folder, get an image (basically .jped or .png) and then processing that image (filter, segmentation etc). I already create my GUI
but my problem is how to get this image in my main code. Let's explain better.
I have this callback function:
and then on my main i just have I = browse; ---> Where browse is the name for this GUI but I don't get my image and then I can't process it, so how can I do? I'd like to obtain something like that on my workspace:
Thanks for any help :)
  3 个评论
Giovanni Lo Bocchiaro
It's ok, I get it, but my problem is that i can't process my image (which is called I for example) on my main code, because it doesn't appear on my workspace.
I want to browse for an image, save on my workspace and then work on this image (converto from rgb to gray for example!): how can i get image output fron GUI after browse and select?

请先登录,再进行评论。

回答(2 个)

Image Analyst
Image Analyst 2017-12-17
If you just need to get the image out of an axes in a callback, you can use getimage().

Jan
Jan 2017-12-17
What is "my main" and "my workspace"? Remember, that each function has its own workspace.
You can use e.g. guidata to store a value in the figure (to be exact in the struct called "handles", when you use GUIDE). This can be used to share data between callbacks. It is recommended, not to create a variable ion the base workspace or in another function, because this remote creation of variables is hard to debug and prone to bugs. Prefer to process all data inside the GUI by using callbacks, e.g. a "Process" button. You know this behavior from almost all other programs running on your computer.
Maybe you want the GUI just to be a kind of "open file dialog" called from a main program. Then use an output from the dialog: https://blogs.mathworks.com/videos/2010/02/12/advanced-getting-an-output-from-a-guide-gui/. You can find such links asking your favorite internet search engine for "Matlab GUIDE output".

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by