You can open or close the webcam preview window any time after creating the webcam
object.
Find the name of your camera using the webcamlist
function to ensure that MATLAB® is discovering your camera(s).
ans = 2×1 cell array
{'Logitech Webcam 250' }
{'Microsoft® LifeCam Cinema(TM)'}
Use the webcam
function with the name of the camera as the input argument to create the object and connect it to the camera with that name. You can use the exact name from the output of webcamlist
, which is 'Logitech Webcam 250'
in this example. Or you can also use a shortened version of the name, for example, the brand of the camera, which in this case is 'Logitech'
. Use cam
as the name of the object.
It creates the object and connects it to the Logitech® webcam.
Preview the image from the webcam.
The preview window opens and displays live video stream from your camera. The preview dynamically updates, so if you change a property while previewing, the image changes to reflect the property change.
Close the preview.
The preview window closes.
After you preview the image, the next steps are optionally changing any properties you need to set, and then acquiring images using the snapshot
function. For more information on these steps, see the topics listed below.