看板 MATLAB 關於我們 聯絡資訊
最近在嘗試用MATLAB來使用Webcam來錄製影片 但是在跑MATLAB網站上的程式碼 clear all; clc; vid = videoinput('winvideo',1, 'YUY2_320x240'); set(vid, 'FramesPerTrigger', Inf); set(vid, 'ReturnedColorspace', 'rgb'); vid.FrameGrabInterval = 1; start(vid) aviObject = VideoWriter('myVideo.avi'); % Create a new AVI file for iFrame = 1:100 % Capture 100 frames I=getsnapshot(vid); F = im2frame(I); % Convert I to a movie frame aviObject = addframe(aviObject,F); % Add the frame to the AVI file end aviObject = close(aviObject); % Close the AVI file stop(vid); 在跑這個程式碼時,會出現下面這個錯誤 winvideo: The device associated with device ID 1 is already in use. A new videoinput object cannot be created for this device while it is in use. 想請問這要怎麼解決? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 134.139.169.120 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1412304223.A.3B7.html
x46824682x: close all 10/04 19:22