🌍 Become a marimo ambassador!

Apply
54 / 103
WebcamCapture

WebcamCapture

by marimo team

Capture images from the webcam.

About this notebook

This notebook captures images from your webcam inside marimo. It uses the WebcamCapture widget from the wigglystuff library. It wraps that widget with mo.ui.anywidget so marimo can read its state. The notebook also uses mohtml to build the page layout and to load Tailwind CSS. There is no fixed dataset. The data comes from your own camera feed.

The widget starts with an interval of 1000 milliseconds. When you display the widget, it shows a live camera view. The widget captures a new frame at each interval. The notebook reads the latest frame from the widget as a base64 string. It places that image inside a rounded panel with a light gray background. So the reader sees the captured picture update as the camera runs.

The last cell calls widget.get_pil() to return the current frame as a PIL image object. This lets you pass the frame to other Python code that works with images. The captured image stays in the browser and in the marimo kernel. The notebook does not send the frame to any external service.

Related notebooks