我试图从笔记本电脑中的网络摄像头捕捉帧,但我得到的输出是红色的,绿色的。我使用了以下代码。
vid = videoinput('winvideo',1,'YUY2_320x240');
set(vid,'TriggerRepeat',Inf);
vid.FrameGrabInterval = 5;
vid_src = getselectedsource(vid);
set(vid_src,'Tag','motion detection setup');
figure;
start(vid)
while(vid.FramesAcquired<=100)
data = getdata(vid,1);
imshow(data);
end
stop(vid)