How to preview live video in App Designer using videoinput and preview?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 20 Nov 2018
Réponse apportée : MathWorks Support Team
le 9 Jan 2019
I am trying to capture live feed from a camera in App Designer. At the command window I can use "videoinput" and preview to do this, but it's not working in my app. How do I do this?
vid = videoinput('winvideo',1);
preview(vid)
Réponse acceptée
MathWorks Support Team
le 20 Nov 2018
In order to preview the video in your uiaxes, you can create an image and preview the video on that image:
% Image acquisition
vid = videoinput('winvideo',1);
% Create blank image
hImage = image(app.UIAxes,zeros(720,1280,3)); %If image resolution is 1280x720
pause(2)
% These lines set proper aspect ratio
app.UIAxes.XLim = [0,1280];
app.UIAxes.YLim = [0,720];
app.UIAxes.XTick = [];
app.UIAxes.YTick = [];
pbaspect(app.UIAxes,[1280,720,1])
% Preview the image
preview(vid,hImage)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Preview and Device Configuration dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!