pub trait VideoCaptureTraitConst {
    fn as_raw_VideoCapture(&self) -> *const c_void;

    fn is_opened(&self) -> Result<bool> { ... }
    fn get(&self, prop_id: i32) -> Result<f64> { ... }
    fn get_backend_name(&self) -> Result<String> { ... }
}
Expand description

Class for video capturing from video files, image sequences or cameras.

The class provides C++ API for capturing video from cameras or for reading video files and image sequences.

Here is how the class can be used: @include samples/cpp/videocapture_basic.cpp

Note: In @ref videoio_c “C API” the black-box structure CvCapture is used instead of %VideoCapture.

Note:

  • (C++) A basic sample on using the %VideoCapture interface can be found at OPENCV_SOURCE_CODE/samples/cpp/videocapture_starter.cpp
  • (Python) A basic sample on using the %VideoCapture interface can be found at OPENCV_SOURCE_CODE/samples/python/video.py
  • (Python) A multi threaded video processing sample can be found at OPENCV_SOURCE_CODE/samples/python/video_threaded.py
  • (Python) %VideoCapture sample showcasing some features of the Video4Linux2 backend OPENCV_SOURCE_CODE/samples/python/video_v4l2.py

Required Methods

Provided Methods

Returns true if video capturing has been initialized already.

If the previous call to VideoCapture constructor or VideoCapture::open() succeeded, the method returns true.

Returns the specified VideoCapture property

Parameters
  • propId: Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, …) or one from @ref videoio_flags_others
Returns

Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoCapture instance.

Note: Reading / writing properties involves many layers. Some unexpected result might happens along this chain.

VideoCapture -> API Backend -> Operating System -> Device Driver -> Device Hardware

The returned value might be different from what really used by the device or it could be encoded using device dependent rules (eg. steps or percentage). Effective behaviour depends from device driver and API Backend

Returns used backend API name

Note: Stream should be opened.

Implementors