How to add a stream screen in gui
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Niculai Traian
am 8 Mai 2019
Bearbeitet: Walter Roberson
am 8 Mai 2019
Hello, i need to add a live stream screen in a gui application. For streaming i am using a http link. From gui i need to acces it and it should be a video and not just a frame. For normal script i use this code:
url = ipcam('http://192.168.43.1:8080/video');
framesAcquired = 0;
h = figure;
while ishandle(h)
im = snapshot(url);
image(im)
im = imresize(im,[227,227]);
[label,score] = classify(net,im);
title({char(label), num2str(max(score),2)});
drawnow
end;
In gui i tried to add axes screen and then add my code to generated code by gui but didn't work.
% --- 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)
axes1(handle.axes1);
url = ipcam('http://192.168.43.1:8080/video');
framesAcquired = 0;
h = figure;
while ishandle(h)
im = snapshot(url);
image(im)
im = imresize(im,[227,227]);
[label,score] = classify(net,im);
title({char(label), num2str(max(score),2)});
drawnow
end;
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Mai 2019
Bearbeitet: Walter Roberson
am 8 Mai 2019
% --- 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
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!