如何在MATLAB中录制来自网络摄像头的视频? [英] How do I record video from a webcam in MATLAB?
本文介绍了如何在MATLAB中录制来自网络摄像头的视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使用网络摄像头在MATLAB中录制视频.
I would like to know how I can record a video in MATLAB with my webcam.
推荐答案
注意: 由于某些旧功能已被取代,因此现已更新,可与新版本的MATLAB一起使用.并删除.
如果您已经知道如何从网络摄像头捕获单个图像,那么这应该只是缝合问题图像一起变成电影.您可以使用 VideoWriter
对象打开电影文件,然后然后使用 writeVideo
方法添加顺序图像.例如:
If you already know how to capture a single image from a webcam, then it should just be a matter of stitching the images together into a movie. You can use a VideoWriter
object to open a movie file and then add sequential images using the writeVideo
method. For example:
aviObject = VideoWriter('myVideo.avi'); % Create a new AVI file
for iImage = 1:100 % Capture 100 frames
% ...
% You would capture a single image I from your webcam here
% ...
writeVideo(aviObject, I); % Add the image to the AVI file
end
close(aviObject); % Close the AVI file
I just used a for loop as a simple example, but you may want to use a timer
if you instead want to capture images and add them to the AVI file at regular time intervals.
这篇关于如何在MATLAB中录制来自网络摄像头的视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文