How to call a custom functions in GUI? (image processing)
2 views (last 30 days)
Show older comments
badrul hisham
on 26 Apr 2016
Commented: badrul hisham
on 27 Apr 2016
good day everyone,
i have a question regarding GUI. please excuse me if my question is too easy or too foolish. i am still new to matlab, so i hope someone can give me a guidance on this.
i've made a coding that is simplified into several functions. the first task is to select the desired image,(i use imgetfile in this situation). next is to do segmentation process which i saved it as a function. my question is, how do i do the callback so that that image can be read into my segmentation function?
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im im2;
[impath, user_canceled] = imgetfile;
if user_canceled
msgbox(sprintf('Cancelled by user!\nOperation could not be completed'),'error','error');
return;
end
% filename=impath
filename=impath;
setappdata (0,'filename',filename);
a=imread(impath);
% setappdata (a,'FileName',impath)
axes(handles.originalim);
imshow(a);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
a=getappdata(0,'filename');
FileName=a
badrulsegmentation (a);
this is my first time doing GUI, and i dont seem to understand how this works. please help me
0 Comments
Accepted Answer
Image Analyst
on 26 Apr 2016
I think this framework will get you up to speed quickly: <
Description
This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to select a folder of images, select one or more images and display them, to select a series of options, and to individually or batch process one or more images. The user can
Most of the heavy lifting is already done for you. You simply decide which radio buttons and checkboxes you want or don't want (add more or delete existing if you want), and put your segmentation code into the function called AnalyzeSingleImage(). It handles display, batch processing, saving to Excel (if requested), etc.
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!