How to run m.file in gui?

Hello! I loaded an image and displayed it in the axis box. What I'm trying to do now is to use a function I created and saved as a separate file to enhance the image, which I've just displayed.
So this is my image load code:
% --- Executes on button press in Image_load.
function Image_load_Callback(hObject, eventdata, handles)
% hObject handle to Image_load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%----------> here we load image
global im im2
[path,user_cance]=imgetfile();
if user_cance
msgbox(sprintf('Error'),'Error','Error');
return
end
im=imread(path);
im=im2double(im); %converts to double
im2=im; %for backup process :)
axes(handles.axes1);
imshow(im);
The function created is called "enhancement". And this is where I'm stuck:
% --- Executes on button press in Enhance.
function Enhance_Callback(hObject, eventdata, handles)
% hObject handle to Enhance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% get the image data
B=enhancement(im);
axes(handles.axes1);
imshow(B);

Answers (0)

This question is closed.

Tags

Asked:

on 21 Apr 2015

Closed:

on 23 Apr 2015

Community Treasure Hunt

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

Start Hunting!