From 72ca04b30f0f87af1118659d74e59b32978902d0 Mon Sep 17 00:00:00 2001 From: Peter Corke Date: Sat, 3 Oct 2026 18:11:08 -0400 Subject: [PATCH] docs: note how to use a phone as a camera in WebCam and VideoCamera VideoCamera already mentions Continuity Camera. Add the other half: WebCam passes its url to cv2.VideoCapture, so a phone running an IP-camera app that publishes an MJPEG/RTSP stream can be used by URL. Cross-reference the two classes, and fix a typo ('Manu webcameras'). Co-Authored-By: Claude Sonnet 5.5 --- src/machinevisiontoolbox/Sources.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/machinevisiontoolbox/Sources.py b/src/machinevisiontoolbox/Sources.py index 7b05484f..efe1366a 100644 --- a/src/machinevisiontoolbox/Sources.py +++ b/src/machinevisiontoolbox/Sources.py @@ -602,7 +602,8 @@ class VideoCamera(ImageSource): attached video camera. On a Mac running 13.0 (Ventura) or later and an iPhone with iOS 16 or later, the Continuity Camera feature allows the phone camera to be used as a local video camera, and it will - appear as a separate camera with its own ID. + appear as a separate camera with its own ID. Other phones, and cameras + on the network, can be used through :class:`WebCam`. OpenCV does not expose a portable API for mapping integer ``id`` values to human-readable camera names. Use :meth:`list` to @@ -612,7 +613,7 @@ class VideoCamera(ImageSource): :references: - |RVC3|, Section 11.1.3. - :seealso: :meth:`list` :func:`~machinevisiontoolbox.base.imageio.convert` + :seealso: :meth:`list` :class:`WebCam` :func:`~machinevisiontoolbox.base.imageio.convert` `cv2.VideoCapture `_ """ @@ -1729,15 +1730,24 @@ class WebCam(ImageSource): pass - .. note:: Manu webcameras accept a query string in the URL to specify + .. note:: Many 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. + .. note:: The ``url`` is passed to ``cv2.VideoCapture``, so it can be + anything that OpenCV can open, for example a still-image URL, a + live HTTP (MJPEG) stream or an RTSP stream. A phone can be used as a + networked camera in this way: many IP-camera apps for iOS and Android + publish a live stream at a URL. Which stream types and URL formats are + supported depends on the app and on how your OpenCV was built. On a Mac + with an iPhone, Continuity Camera makes the phone appear as a local + camera instead, see :class:`VideoCamera`. + :references: - |RVC3|, Section 11.1.5. - :seealso: :func:`~machinevisiontoolbox.base.imageio.convert` + :seealso: :class:`VideoCamera` :func:`~machinevisiontoolbox.base.imageio.convert` `cv2.VideoCapture `_ """