WebCam

class machinevisiontoolbox.Sources.WebCam(url, **kwargs)[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 Image objects.

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 = webcam.grab()  # grab next frame
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:
  • Robotics, Vision & Control for Python, Section 11.1.5, P. Corke, Springer 2023.

Seealso:

convert cv2.VideoCapture

__init__(url, **kwargs)[source]

Methods

__init__

grab

Grab frame from web camera