pub trait VideoReaderConst {
    fn as_raw_VideoReader(&self) -> *const c_void;

    fn format(&self) -> Result<FormatInfo> { ... }
    fn retrieve(&self, frame: &mut dyn ToOutputArray, idx: size_t) -> Result<bool> { ... }
    fn retrieve_1(&self, frame: &mut Mat, idx: size_t) -> Result<bool> { ... }
    fn retrieve_2(&self, frame: &mut GpuMat) -> Result<bool> { ... }
    fn get(
        &self,
        property_id: VideoReaderProps,
        property_val: &mut f64
    ) -> Result<bool> { ... } fn get_video_reader_props(
        &self,
        property_id: VideoReaderProps,
        property_val_out: &mut f64,
        property_val_in: f64
    ) -> Result<bool> { ... } fn get_1(&self, property_id: i32, property_val: &mut f64) -> Result<bool> { ... } }
Expand description

Video reader interface.

Note:

  • An example on how to use the videoReader class can be found at opencv_source_code/samples/gpu/video_reader.cpp

Required Methods

Provided Methods

Returns information about video file format.

Returns previously grabbed video data.

Parameters
  • frame:[out] The returned data which depends on the provided idx.
  • idx: Determines the returned data inside image. The returned data can be the:
  • Decoded frame, idx = get(PROP_DECODED_FRAME_IDX).
  • Extra data if available, idx = get(PROP_EXTRA_DATA_INDEX).
  • Raw encoded data package. To retrieve package i, idx = get(PROP_RAW_PACKAGES_BASE_INDEX) + i with i < get(PROP_NUMBER_OF_RAW_PACKAGES_SINCE_LAST_GRAB)
Returns

false if no frames have been grabbed

The method returns data associated with the current video source since the last call to grab() or the creation of the VideoReader. If no data is present the method returns false and the function returns an empty image.

C++ default parameters
  • idx: static_cast<size_t>(VideoReaderProps::PROP_DECODED_FRAME_IDX)

Returns previously grabbed encoded video data.

Parameters
  • frame:[out] The encoded video data.
  • idx: Determines the returned data inside image. The returned data can be the:
  • Extra data if available, idx = get(PROP_EXTRA_DATA_INDEX).
  • Raw encoded data package. To retrieve package i, idx = get(PROP_RAW_PACKAGES_BASE_INDEX) + i with i < get(PROP_NUMBER_OF_RAW_PACKAGES_SINCE_LAST_GRAB)
Returns

false if no frames have been grabbed

The method returns data associated with the current video source since the last call to grab() or the creation of the VideoReader. If no data is present the method returns false and the function returns an empty image.

Returns the next video frame.

Parameters
  • frame:[out] The video frame. If grab() has not been called then this will be empty().
Returns

false if no frames have been grabbed

The method returns data associated with the current video source since the last call to grab(). If no data is present the method returns false and the function returns an empty image.

Returns the specified VideoReader property

Parameters
  • propertyId: Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX, cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, …).
  • propertyVal:
  • In: Optional value required for querying specific propertyId’s, e.g. the index of the raw package to be checked for a key frame (cv::cudacodec::VideoReaderProps::PROP_LRF_HAS_KEY_FRAME).
  • Out: Value of the property.
Returns

true unless the property is not supported.

C++ default parameters
  • property_val_in: 0

Retrieves the specified property used by the VideoSource.

Parameters
  • propertyId: Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, …) or one from @ref videoio_flags_others.
  • propertyVal: Value for the specified property.
Returns

true unless the property is unset set or not supported.

Implementors