% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ax = handle.axes1;
url = ipcam('http://192.168.43.1:8080/video');
framesAcquired = 0;
h = ancestor(ax, 'figure');
imh = image(ax, []);
prevheader = 'classifying, previous was:';
this_title = {prevheader, 'unknown', 'score unavailable'};
while ishandle(h)
im = snapshot(url);
framesAcquired = framesAcquired + 1;
set(imh, 'CData', im);
this_title{1} = prevheader;
title(ax, this_title);
drawnow();
im = imresize(im,[227,227]);
[label,score] = classify(net,im);
this_title = {'classified!', char(label), num2str(max(score),2)};
title(ax, this_title)
drawnow();
end