필터 지우기
필터 지우기

Real-time video capture with frame by frame comparsion

조회 수: 1 (최근 30일)
David
David 2013년 3월 18일
Hello, I would like to capture video using a computer camera (usb) and compare consecutive frames (i.e. get diff).
I got the real time capture using videoinput functions and objects
vid = videoinput('winvideo', 1);
and the timer function to capture frames from the video stream.
TimerData=timer('TimerFcn', {@FrameRateDisplay,vid},'Period',1/NumberFrameDisplayPerSecond,'ExecutionMode','fixedRate','BusyMode','drop');
the function FrameRateDisplay just displays the image captured and some stats on it.
However, I cannot figure out a way to save the last frame captured, to compare it to the next run of the timer function. I think fundamentally I'm confused about how to get a return value from the callbackfunction @FrameRateDisplay.
thank you for your time,
dave

채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 18일
Those kinds of callback functions cannot return values. Not many callback functions can.
  댓글 수: 1
David
David 2013년 3월 19일
yea, from my research i've seem to run into your conclusion (and that linke as well).
As a work around, I'm sampling at a slower rate, and within the FrameRateDisplay function I'm calling the trigger() and getdata() twice with a pause inbetween. it gets the job done, I just feel it's not very clean.
I'll search that wiki you sent for a solution, it's just a little confusing give it's got a lot of GUI discussion, which I'm not using.
thank you for your rapid response.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by