Skip to content

[Feature Suggestion] cv2::stream, a live stream module for real time media feed #3977

@CodeHotel

Description

@CodeHotel

Describe the feature and motivation

Overview

Introduce a new cv2::stream API to support real-time streaming of image or video data from any source—such as cameras, capture boards, 3D sensors, and custom pipelines—directly within OpenCV. This allows live preview of processed or raw frames in various development and production environments, especially when data is not readily available or highly variable.

Motivation

OpenCV is often used to process static image or video files. However, it is also increasingly being used as part of a pipeline to process live feed, such as from cameras or screens. A native streaming feature in OpenCV would have many applications in such context, especially in robotics, reinforcement learning (RL), and experimental or iterative computer vision pipelines. It enables real-time feedback and visualization for development, debugging, and demonstration purposes, which is currently extremely cumbersome without resorting to external servers or manual solutions.

Proposed Implementation

The feature would support streaming over web protocols. When used in remote development setups (e.g., via SSH with Jupyter Notebook), the stream object could output an HTML embed to display the live feed directly in the notebook output cell, rather than just static images(which is often done so when using opencv in conjunction with matplotlib). Integration with web UIs would also be possible.
The implementation would avoid introducing additional heavy dependencies or frameworks, instead leveraging either well-defined modules in OpenCV or existing packages that are already available in many distributions.
Basic token authentication may also be included if it is recommended to do so.

Additional Context

If the maintainers are open to such an implementation, me and my team will start working on this feature immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions