WebCam#
- class WebCam(url: str, **kwargs: Any)[source]#
Iterate images from an internet web camera
- Parameters:
url (str) – URL of the camera
kwargs – options applied to image frames, see
convert
The resulting object is an iterator over the frames returned from the remote camera. The iterator returns
Imageobjects.Example:
from machinevisiontoolbox import WebCam webcam = WebCam('https://webcam.dartmouth.edu/webcam/image.jpg') for image in webcam: # iterate over frames # process image
alternatively:
img = next(webcam) # get next frame
or using a context manager to ensure the connection is released:
with WebCam('https://webcam.dartmouth.edu/webcam/image.jpg') as webcam: for image in webcam: # process image
Note
Manu webcameras accept a query string in the URL to specify image resolution, image format, codec and other parameters. There is no common standard for this, see the manufacturer’s datasheet for details.
- References:
P. Corke, Robotics, Vision & Control for Python, Springer, 2023, Section 11.1.5.
- Seealso:
Methods
Display images from the source interactively.
Grab frame from web camera
Convert all images from this source into a single 4D PyTorch tensor.
Attributes