![]() |
如何在MATLAB中录制来自网络摄像头的视频?
我想知道如何使用网络摄像头在MATLAB中录制视频。
回答: [B]注意:[/B] [I]由于某些较旧的功能已被取代并删除,因此现在已更新此版本以与新版本的MATLAB一起使用。[/I] 如果您已经知道如何[URL="https://stackoverflow.com/q/1467692/52738"]从网络摄像头捕获单个图像[/URL] ,则只需将图像缝合在一起即可。您可以使用[URL="https://www.mathworks.com/help/matlab/ref/videowriter.html"]VideoWriter对象[/URL]打开影片文件,然后使用[URL="https://www.mathworks.com/help/matlab/ref/videowriter.writevideo.html"]writeVideo[/URL]方法添加连续图像。例如: 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文件中,则可能需要使用[URL="https://www.mathworks.com/help/matlab/ref/timer-class.html"]timer[/URL] 。 [url=https://stackoverflow.com/questions/1637589]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 23:14。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.