Capturing Video From a WebcamΒΆ

The WebcamVideoStream class enables an attached camera to capture video. The video stream can be started in the following way:

with edgeiq.WebcamVideoStream(cam=0) as video_stream:

The cam parameter is the camera index of the webcam to use, where 0 is often the default camera. For IP cameras, provide a string of the URL as the cam parameter. The most recent frame can be read by using the read() function in the next code block:

frame =

Note that frames that become outdated are dropped to enable real-time analysis. The camera connection is automatically cleaned up upon exiting the code block.