Why is getsnapshot on videoinput object much slower than vid.snapshot on webcam object?

15 views (last 30 days)
When I call "getsnapshot" on a "videoinput" object, why is it much slower than calling "vid.snapshot" on a "webcam" object?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 23 Dec 2023
Edited: MathWorks Support Team on 24 Dec 2023
"webcam" and "videoinput" have different design and implementation. When using "webcam" the camera starts streaming video as soon as the object is created. The "snapshot" function only grabs the latest frame from the stream. The camera will continue streaming until "webcam clear" is called.
When using "videoinput" the camera does not start streaming when the "videoinput" object is created. If the camera is not already streaming video "getsnapshot" will start it and then grab the latest frame. The timing overhead is due to the camera start taking additional time.
If you are looking for a low latency version of the "getsnapshot" function, can configure the "videoinput" in manual trigger mode and then start (or preview) the camera.
Please see this example for more information on how to accomplish this workflow:

More Answers (0)

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!