Watch preview while recording snapshots?
Afficher commentaires plus anciens
Hello! I am trying to watch a video from my IP camera live while also recording the output. My code, below, is successful at showing the first frame, and will record for my specified duration. I have just removed the IP address out of caution. The preview screen and recording will end when I hit the quit key.
Is this watching the preview and recording snapshots in real time possible? How would I implement this?
Thanks!
cam = ipcam('http://<URL>','USER','PASS'); % calls the camera, obscured for privacy :)
KbName('UnifyKeyNames');
quit = KbName('q');
preview(cam) % how to continue viewing live footage until closePreview?
frames = 200;
videoRecord = VideoWriter('camera_test', 'MPEG-4');
open(videoRecord)
for i =1:frames
img = snapshot(cam);
writeVideo(videoRecord,img)
[keyIsDown,~,keyCode]=KbCheck(-1);
if (keyIsDown==1 && keyCode(quit))
KbReleaseWait();
break
end
frames = frames+1;
end
closePreview(cam);
close(videoRecord)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Video capture and display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!