matlab呼叫攝像頭並儲存成幀的形式

sannianyihoushuma發表於2018-11-18

% function camera
vid = videoinput('winvideo',1, 'YUY2_1920x1080');
set(vid,'ReturnedColorSpace','rgb');
preview(vid);
tic;
i = 1;
while 1
    frame = getsnapshot(vid);
    imshow(frame);
    imwrite(frame,strcat(num2str(i),'.jpg'),'jpg');
    i = i+1;
    if i >= 101
        break;
    end
end
toc;

相關文章