View Source Evision.CUDACodec.VideoReader (Evision v0.2.9)

Summary

Types

t()

Type that represents an CUDACodec.VideoReader struct.

Functions

Returns information about video file format.

Retrieves the specified property used by the VideoSource.

Returns the specified VideoReader property

Returns the specified VideoReader property

Grabs the next frame from the video source.

Grabs the next frame from the video source.

Grabs, decodes and returns the next video frame.

Grabs, decodes and returns the next video frame.

Grabs, decodes and returns the next video frame and frame luma histogram.

Grabs, decodes and returns the next video frame and frame luma histogram.

Returns the next video frame.

Variant 1:

Returns previously grabbed encoded video data.

Returns previously grabbed encoded video data.

Set the desired ColorFormat for the frame returned by nextFrame()/retrieve().

Sets a property in the VideoReader.

Types

@type t() :: %Evision.CUDACodec.VideoReader{ref: reference()}

Type that represents an CUDACodec.VideoReader struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec format(Keyword.t()) :: any() | {:error, String.t()}
@spec format(Evision.CUDACodec.CUDACodec.VideoReader.t()) ::
  Evision.CUDACodec.FormatInfo.t() | {:error, String.t()}

Returns information about video file format.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Return
  • retval: FormatInfo

Python prototype (for reference only):

format() -> retval
@spec get(Keyword.t()) :: any() | {:error, String.t()}
@spec get(Evision.CUDACodec.CUDACodec.VideoReader.t(), integer()) ::
  number() | false | {:error, String.t()}

Retrieves the specified property used by the VideoSource.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()

  • propertyId: integer().

    Property identifier from cv::VideoCaptureProperties (eg. cv::CAP_PROP_POS_MSEC, cv::CAP_PROP_POS_FRAMES, ...) or one from @ref videoio_flags_others.

Return
  • retval: bool

  • propertyVal: double.

    Value for the specified property.

@return true unless the property is unset set or not supported.

Python prototype (for reference only):

get(propertyId) -> retval, propertyVal
Link to this function

getVideoReaderProps(named_args)

View Source
@spec getVideoReaderProps(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

getVideoReaderProps(self, propertyId)

View Source
@spec getVideoReaderProps(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  Evision.CUDACodec.VideoReaderProps.t()
) :: number() | false | {:error, String.t()}

Returns the specified VideoReader property

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()

  • propertyId: VideoReaderProps.

    Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX, cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, ...).

Keyword Arguments
  • propertyValIn: double.
Return
  • retval: bool
  • propertyValOut: double

@return true unless the property is not supported.

Python prototype (for reference only):

getVideoReaderProps(propertyId[, propertyValIn]) -> retval, propertyValOut
Link to this function

getVideoReaderProps(self, propertyId, opts)

View Source
@spec getVideoReaderProps(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  Evision.CUDACodec.VideoReaderProps.t(),
  [{:propertyValIn, term()}] | nil
) :: number() | false | {:error, String.t()}

Returns the specified VideoReader property

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()

  • propertyId: VideoReaderProps.

    Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX, cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, ...).

Keyword Arguments
  • propertyValIn: double.
Return
  • retval: bool
  • propertyValOut: double

@return true unless the property is not supported.

Python prototype (for reference only):

getVideoReaderProps(propertyId[, propertyValIn]) -> retval, propertyValOut
@spec grab(Keyword.t()) :: any() | {:error, String.t()}
@spec grab(Evision.CUDACodec.CUDACodec.VideoReader.t()) ::
  boolean() | {:error, String.t()}

Grabs the next frame from the video source.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool

@return true (non-zero) in the case of success. The method/function grabs the next frame from video file or camera and returns true (non-zero) in the case of success. The primary use of the function is for reading both the encoded and decoded video data when rawMode is enabled. With rawMode enabled retrieve() can be called following grab() to retrieve all the data associated with the current video source since the last call to grab() or the creation of the VideoReader.

Python prototype (for reference only):

grab([, stream]) -> retval
@spec grab(Evision.CUDACodec.CUDACodec.VideoReader.t(), [{:stream, term()}] | nil) ::
  boolean() | {:error, String.t()}

Grabs the next frame from the video source.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool

@return true (non-zero) in the case of success. The method/function grabs the next frame from video file or camera and returns true (non-zero) in the case of success. The primary use of the function is for reading both the encoded and decoded video data when rawMode is enabled. With rawMode enabled retrieve() can be called following grab() to retrieve all the data associated with the current video source since the last call to grab() or the creation of the VideoReader.

Python prototype (for reference only):

grab([, stream]) -> retval
@spec nextFrame(Keyword.t()) :: any() | {:error, String.t()}
@spec nextFrame(Evision.CUDACodec.CUDACodec.VideoReader.t()) ::
  Evision.CUDA.GpuMat.t() | false | {:error, String.t()}

Grabs, decodes and returns the next video frame.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().

@return false if no frames have been grabbed. If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs.

Python prototype (for reference only):

nextFrame([, frame[, stream]]) -> retval, frame
@spec nextFrame(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  [{:stream, term()}] | nil
) ::
  Evision.CUDA.GpuMat.t() | false | {:error, String.t()}

Grabs, decodes and returns the next video frame.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().

@return false if no frames have been grabbed. If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs.

Python prototype (for reference only):

nextFrame([, frame[, stream]]) -> retval, frame
Link to this function

nextFrameWithHist(named_args)

View Source
@spec nextFrameWithHist(Keyword.t()) :: any() | {:error, String.t()}
@spec nextFrameWithHist(Evision.CUDACodec.CUDACodec.VideoReader.t()) ::
  {Evision.CUDA.GpuMat.t(), Evision.CUDA.GpuMat.t()}
  | false
  | {:error, String.t()}

Grabs, decodes and returns the next video frame and frame luma histogram.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().
  • histogram: Evision.CUDA.GpuMat.t().

@return false if no frames have been grabbed. If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs. Note: Histogram data is collected by NVDEC during the decoding process resulting in zero performance penalty. NVDEC computes the histogram data for only the luma component of decoded output, not on post-processed frame(i.e. when scaling, cropping, etc. applied). If the source is encoded using a limited range of luma values (FormatInfo::videoFullRangeFlag == false) then the histogram bin values will correspond to to this limited range of values and will need to be mapped to contain the same output as cuda::calcHist(). The MapHist() utility function can be used to perform this mapping on the host if required.

Python prototype (for reference only):

nextFrameWithHist([, frame[, histogram[, stream]]]) -> retval, frame, histogram
Link to this function

nextFrameWithHist(self, opts)

View Source
@spec nextFrameWithHist(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  [{:stream, term()}] | nil
) ::
  {Evision.CUDA.GpuMat.t(), Evision.CUDA.GpuMat.t()}
  | false
  | {:error, String.t()}

Grabs, decodes and returns the next video frame and frame luma histogram.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Keyword Arguments
  • stream: cuda_Stream.

    Stream for the asynchronous version.

Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().
  • histogram: Evision.CUDA.GpuMat.t().

@return false if no frames have been grabbed. If no frames have been grabbed (there are no more frames in video file), the methods return false. The method throws an Exception if error occurs. Note: Histogram data is collected by NVDEC during the decoding process resulting in zero performance penalty. NVDEC computes the histogram data for only the luma component of decoded output, not on post-processed frame(i.e. when scaling, cropping, etc. applied). If the source is encoded using a limited range of luma values (FormatInfo::videoFullRangeFlag == false) then the histogram bin values will correspond to to this limited range of values and will need to be mapped to contain the same output as cuda::calcHist(). The MapHist() utility function can be used to perform this mapping on the host if required.

Python prototype (for reference only):

nextFrameWithHist([, frame[, histogram[, stream]]]) -> retval, frame, histogram
@spec retrieve(Keyword.t()) :: any() | {:error, String.t()}
@spec retrieve(Evision.CUDACodec.CUDACodec.VideoReader.t()) ::
  Evision.CUDA.GpuMat.t() | false | {:error, String.t()}

Returns the next video frame.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().

@return 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.

Python prototype (for reference only):

retrieve([, frame]) -> retval, frame
@spec retrieve(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  [{atom(), term()}, ...] | nil
) ::
  Evision.CUDA.GpuMat.t() | false | {:error, String.t()}
@spec retrieve(Evision.CUDACodec.CUDACodec.VideoReader.t(), integer()) ::
  Evision.Mat.t() | false | {:error, String.t()}

Variant 1:

Returns previously grabbed encoded video data.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
  • idx: size_t.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)
Return
  • retval: bool
  • frame: Evision.Mat.t().

@return 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.

Python prototype (for reference only):

retrieve(idx[, frame]) -> retval, frame

Variant 2:

Returns the next video frame.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
Return
  • retval: bool
  • frame: Evision.CUDA.GpuMat.t().

@return 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.

Python prototype (for reference only):

retrieve([, frame]) -> retval, frame
Link to this function

retrieve(self, idx, opts)

View Source
@spec retrieve(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  integer(),
  [{atom(), term()}, ...] | nil
) ::
  Evision.Mat.t() | false | {:error, String.t()}

Returns previously grabbed encoded video data.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()
  • idx: size_t.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)
Return
  • retval: bool
  • frame: Evision.Mat.t().

@return 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.

Python prototype (for reference only):

retrieve(idx[, frame]) -> retval, frame
@spec set(Keyword.t()) :: any() | {:error, String.t()}
@spec set(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  Evision.CUDACodec.ColorFormat.t()
) ::
  boolean() | {:error, String.t()}

Set the desired ColorFormat for the frame returned by nextFrame()/retrieve().

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()

  • colorFormat: ColorFormat.

    Value of the ColorFormat.

Return
  • retval: bool

@return true unless the colorFormat is not supported.

Python prototype (for reference only):

set(colorFormat) -> retval
Link to this function

setVideoReaderProps(named_args)

View Source
@spec setVideoReaderProps(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setVideoReaderProps(self, propertyId, propertyVal)

View Source
@spec setVideoReaderProps(
  Evision.CUDACodec.CUDACodec.VideoReader.t(),
  Evision.CUDACodec.VideoReaderProps.t(),
  number()
) :: boolean() | {:error, String.t()}

Sets a property in the VideoReader.

Positional Arguments
  • self: Evision.CUDACodec.VideoReader.t()

  • propertyId: VideoReaderProps.

    Property identifier from cv::cudacodec::VideoReaderProps (eg. cv::cudacodec::VideoReaderProps::PROP_DECODED_FRAME_IDX, cv::cudacodec::VideoReaderProps::PROP_EXTRA_DATA_INDEX, ...).

  • propertyVal: double.

    Value of the property.

Return
  • retval: bool

@return true if the property has been set.

Python prototype (for reference only):

setVideoReaderProps(propertyId, propertyVal) -> retval