Watch preview while recording snapshots?
Mostrar comentarios más antiguos
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)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Video capture and display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!