function uipushtool1_ClickedCallback(hObject,eventdata,handles) %open the image file
filename = uigetfile('*.jpg', 'Select an image file');
im = imread(filename);
imagesc(im);
handles.im = im; %define im in handles
%Update
guidata(hObject, handles);
function pushbutton1_Callback(hObject, eventdata, handles) %call the function
im = handles.im; %get im from handles
findBallFunction(im);