[其他] Webcam以被使用

看板MATLAB作者 (風飆揚)時間11年前 (2014/10/03 10:43), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
最近在嘗試用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

10/04 19:22, , 1F
close all
10/04 19:22, 1F
文章代碼(AID): #1KBWrVEt (MATLAB)
文章代碼(AID): #1KBWrVEt (MATLAB)