我想知道如何使用网络摄像头在MATLAB中录制视频。
回答:
注意: 由于某些较旧的功能已被取代并删除,因此现在已更新此版本以与新版本的MATLAB一起使用。
如果您已经知道如何
从网络摄像头捕获单个图像 ,则只需将图像缝合在一起即可。您可以使用
VideoWriter对象打开影片文件,然后使用
writeVideo方法添加连续图像。例如:
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 我只是使用了for循环作为简单示例,但是如果您想捕获图像并将其以固定的时间间隔添加到AVI文件中,则可能需要使用
timer 。
更多&回答...