Using the Image Acquisition Toolbox, you can log images directly to an AVI file. If a large number of frames will be acquired, it is more practical to log the images to disk rather than to memory. You are now ready to record and play with video using the getdata command ( peekdata is also helpful), however. Numframes = floor(capturetime * framerate / interval) To determine how many frames to acquire in total, calculate the total number of frames that would be acquired at the device's frame rate, and then divide by the FrameGrabInterval. Using the framerate, determine how often you want to get frames set(vid,'FrameGrabInterval',10) For instance, if we set it to 5, then only 1 in 5 frames is kept - the other 4 frames will be discarded. The FrameGrabInterval property specifies how often frames are stored from the video stream. % Calculate frame rate by averaging difference between each frame's timestamp = getdata(vid, get(vid,'FramesAvailable')) % Retrieve the frames and timestamps for each frame. You'll then want to determine your frame rate (more on this here): set(vid,'FramesPerTrigger',100) The following makes the first webcam into an object a=imaqhwinfo('winvideo',1)įind the list of supported video formats with a.SupportedFormats To find a list of webcam devices (and other things besides) use: imaqhwinfo You'll need to adjust the last bit for your webcam. First construct a video input interface vid = videoinput('winvideo',1,'RGB24_400x300')
0 Comments
Leave a Reply. |