How to open image directory in matlab GUI and processed using external functions?

2 ビュー (過去 30 日間)
badrul hisham
badrul hisham 2016 年 5 月 2 日
コメント済み: badrul hisham 2016 年 5 月 3 日
hi, i have a question regarding matlab GUI. how can i open the image directory and then use the image throughout the whole GUI? i have external functions for the segmentation process but the image displayed seems to be outside of the axes.
% --- 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 FileName
axes(handles.axes1);
[im,PathName] = uigetfile('*.jpg','Select the MATLAB code file');
FileName=im;
imshow(FileName);
% SelectFile=funGetpushbutton1(hObject, eventdata, handles);
% --- 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)
global im FileName
FileName=im
b=badrulsegmentation (FileName);
axes(handles.axes1);
as you can see above, my function (badrulsegmentation) is my function for segmentation process. when it comes to the function, all the images were displayed outside of the axes. where did i do wrong? please help me

回答 (1 件)

Image Analyst
Image Analyst 2016 年 5 月 2 日
pushbutton1 will display the chosen image in axes1. Where does pushbutton2 callback and the badrulsegmentation() function display it? When you say "all the images were displayed outside of the axes" then where were they?
  1 件のコメント
badrul hisham
badrul hisham 2016 年 5 月 3 日
sorry, missed out the imshow. but still, the images were displayed outside of the axes. they were displayed just like a normal script. meaning like the multiple figures when using script. image in axes1 remained the same and only that image is inside axes1. Is it because in my segmentation function,i just use figure(1),imshow... and did not declare axes1 in the function

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

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by