How to set Frames Per second
5 views (last 30 days)
Show older comments
Hello,
I used the "getsnapshot" function to capture a frame using my external webcam to analyze an image.
How do i loop it such that my camera will repeat the program infinately for
XXXX frames/second
would this be slower compared to the "real-time video streaming triggering technique?"
1 Comment
Walter Roberson
on 25 Feb 2011
You could use a timer function to trigger the snapshot. I don't know what accuracy you would be able to obtain.
I am not familiar with the triggering technique you reference, so I cannot advise on that.
Answers (2)
David Tarkowski
on 25 Feb 2011
If you are using the getsnapshot command, please see the Acquiring Single Images in A Loop for tips on how to optimize the performance of the getsnapshot command. If your camera is running at a higher frame rate than what you desire for capture, you can use pause or a timer, as Walter suggests, to capture at a slower rate.
In general webcams don't have a guaranteed consistent frame rate so whatever frame rate you are seeing in normal use might not be exactly sustainable over long periods of time. Using start and getdata as David Young suggests will probably be more efficient, but that is hard to say for sure without more details on exactly what you are trying to accomplish.
David Young
on 25 Feb 2011
I do not think getsnapshot is suitable for working with a video stream - it's really for getting a single image at a random time.
You are much better off using the techniques described in the chapters "Acquiring Image Data", "Working with Acquired Image Data" and "Using Events and Callbacks" in the user manual.
Callback functions are especially useful. You can set the camera to any frame rate that it supports, and once you've started the video object you don't have to worry about timing or triggering any more. The callback function can process each image in any way you like, provided it completes in time, and you can check whether it is keeping up. I suspect the overhead is far lower than for repeated calls to getsnapshot.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!