MATLAB: Is getsnapshot on videoinput object much slower than vid.snapshot on webcam object

Image Acquisition Toolbox

When I call "getsnapshot" on a "videoinput" object, why is it much slower than calling "vid.snapshot" on a "webcam" object?

Best Answer

"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: