how can i get screenshot continuously by pressing key?

1 vue (au cours des 30 derniers jours)
a.s
a.s le 7 Sep 2020
Modifié(e) : a.s le 8 Sep 2020
This is my program that I can take a screenshot only once.
i want to take screenshot continuously in video by pressing key.
Can I do this by adding an index?
thanks before.
a = imaqhwinfo;
vid = videoinput('winvideo',1);
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;
start(vid)
while(vid.FramesAcquired<=200)
Key=get(gcf,'CurrentKey');
if Key =='s'
img1 = getsnapshot(vid);
break;
end
  2 commentaires
KSSV
KSSV le 7 Sep 2020
You need to remove break and use strcmp instead of ==
a.s
a.s le 7 Sep 2020
data = getsnapshot(vid);

Connectez-vous pour commenter.

Réponses (1)

KSSV
KSSV le 7 Sep 2020
a = imaqhwinfo;
vid = videoinput('winvideo',1);
set(vid, 'FramesPerTrigger', Inf);
set(vid, 'ReturnedColorspace', 'rgb')
vid.FrameGrabInterval = 5;
start(vid)
while(vid.FramesAcquired<=200)
Key=get(gcf,'CurrentKey');
if strcmp(Key,'s')
img1 = getsnapshot(vid);
end
end
  1 commentaire
a.s
a.s le 8 Sep 2020
Modifié(e) : a.s le 8 Sep 2020
thank you so much.....Now I want it to show me the frames every time I press the button. For example, I pressed the button 4 times.How can I see these 4 frames?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown 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!

Translated by