필터 지우기
필터 지우기

my code can't preview webcam

조회 수: 2 (최근 30일)
Adisorn Phanukthong
Adisorn Phanukthong 2017년 5월 9일
댓글: Walter Roberson 2017년 5월 9일
% Create video input object.
vid = videoinput('winvideo',2, 'I420_1504x832');
% Set video input object properties for this application.
vid.TriggerRepeat = 100;
vid.FrameGrabInterval = 5;
% Set value of a video source object property.
vid_src = getselectedsource(vid);
vid_src.Tag = 'motion detection setup';
% Create a figure window.
figure
% Start acquiring frames.
start(vid)
% Calculate difference image and display it.
while(vid.FramesAvailable >= 2)
data = getdata(vid,2);
diff_im = imabsdiff(data(:,:,:,1),data(:,:,:,2));
imshow(diff_im);
drawnow % update figure window
end
stop(vid)
please check in my code
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 5월 9일
That code looks reasonable for the situation in which you want to acquire 100 frames first and then process them when you have all 100.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by