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 个评论
回答(2 个)
Image Analyst
2017-12-17
See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
If you just need to get the image out of an axes in a callback, you can use getimage().
0 个评论
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".
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!