cv3.video.VideoInterface

class cv3.video.VideoInterface[source]

Bases: object

Base class for video operations.

This class provides common functionality for both VideoCapture and VideoWriter classes. It implements context manager support and basic video stream operations.

stream

The underlying OpenCV video stream.

width

Width of the video frames.

Type:

int

height

Height of the video frames.

Type:

int

stream = None
width = None
height = None
isOpened()[source]

Check if the video stream is opened.

Returns:

True if the stream is opened, False otherwise.

Return type:

bool

property is_opened

Check if the video stream is opened (property version).

Type:

bool

release()[source]

Release the video stream and free associated resources.

Note

If the stream has not been started, a warning will be issued.

property shape

Shape of the video frames as (width, height).

Type:

tuple

__enter__()[source]

Enter the runtime context for the video stream.

Returns:

This video interface instance.

Return type:

VideoInterface

__exit__(exc_type, exc_val, exc_tb)[source]

Exit the runtime context for the video stream.

This method ensures the video stream is released when exiting the context manager.

close()

Alias for release().