Trait CUDA_NvidiaHWOpticalFlowTrait

Source
pub trait CUDA_NvidiaHWOpticalFlowTrait: AlgorithmTrait + CUDA_NvidiaHWOpticalFlowTraitConst {
    // Required method
    fn as_raw_mut_CUDA_NvidiaHWOpticalFlow(&mut self) -> *mut c_void;

    // Provided methods
    fn calc(
        &mut self,
        input_image: &impl ToInputArray,
        reference_image: &impl ToInputArray,
        flow: &mut impl ToInputOutputArray,
        stream: &mut impl StreamTrait,
        hint: &impl ToInputArray,
        cost: &mut impl ToOutputArray,
    ) -> Result<()> { ... }
    fn calc_def(
        &mut self,
        input_image: &impl ToInputArray,
        reference_image: &impl ToInputArray,
        flow: &mut impl ToInputOutputArray,
    ) -> Result<()> { ... }
    fn collect_garbage(&mut self) -> Result<()> { ... }
}
Expand description

Required Methods§

Provided Methods§

Source

fn calc( &mut self, input_image: &impl ToInputArray, reference_image: &impl ToInputArray, flow: &mut impl ToInputOutputArray, stream: &mut impl StreamTrait, hint: &impl ToInputArray, cost: &mut impl ToOutputArray, ) -> Result<()>

Calculates Optical Flow using NVIDIA Optical Flow SDK.

  • NVIDIA GPUs starting with Turing contain a dedicated hardware accelerator for computing optical flow vectors between pairs of images.
  • The optical flow hardware accelerator generates block-based optical flow vectors.
  • The size of the block depends on hardware in use, and can be queried using the function getGridSize().
  • The block-based flow vectors generated by the hardware can be converted to dense representation (i.e. per-pixel flow vectors) using upSampler() helper function, if needed.
  • The flow vectors are stored in CV_16SC2 format with x and y components of each flow vector in 16-bit signed fixed point representation S10.5.
§Parameters
  • inputImage: Input image.
  • referenceImage: Reference image of the same size and the same type as input image.
  • flow: A buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.
  • stream: It is highly recommended that CUDA streams for pre and post processing of optical flow vectors should be set once per session in create() function as a part of optical flow session creation. This parameter is left here for backward compatibility and may be removed in the future. Default value is NULL stream;
  • hint: Hint buffer if client provides external hints. Must have same size as flow buffer. Caller can provide flow vectors as hints for optical flow calculation.
  • cost: Cost buffer contains numbers indicating the confidence associated with each of the generated flow vectors. Higher the cost, lower the confidence. Cost buffer is of type CV_32SC1.

Note:

  • Client must use critical sections around each calc() function if calling it from multiple threads.
§C++ default parameters
  • stream: Stream::Null()
  • hint: cv::noArray()
  • cost: cv::noArray()
Source

fn calc_def( &mut self, input_image: &impl ToInputArray, reference_image: &impl ToInputArray, flow: &mut impl ToInputOutputArray, ) -> Result<()>

Calculates Optical Flow using NVIDIA Optical Flow SDK.

  • NVIDIA GPUs starting with Turing contain a dedicated hardware accelerator for computing optical flow vectors between pairs of images.
  • The optical flow hardware accelerator generates block-based optical flow vectors.
  • The size of the block depends on hardware in use, and can be queried using the function getGridSize().
  • The block-based flow vectors generated by the hardware can be converted to dense representation (i.e. per-pixel flow vectors) using upSampler() helper function, if needed.
  • The flow vectors are stored in CV_16SC2 format with x and y components of each flow vector in 16-bit signed fixed point representation S10.5.
§Parameters
  • inputImage: Input image.
  • referenceImage: Reference image of the same size and the same type as input image.
  • flow: A buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.
  • stream: It is highly recommended that CUDA streams for pre and post processing of optical flow vectors should be set once per session in create() function as a part of optical flow session creation. This parameter is left here for backward compatibility and may be removed in the future. Default value is NULL stream;
  • hint: Hint buffer if client provides external hints. Must have same size as flow buffer. Caller can provide flow vectors as hints for optical flow calculation.
  • cost: Cost buffer contains numbers indicating the confidence associated with each of the generated flow vectors. Higher the cost, lower the confidence. Cost buffer is of type CV_32SC1.

Note:

  • Client must use critical sections around each calc() function if calling it from multiple threads.
§Note

This alternative version of CUDA_NvidiaHWOpticalFlowTrait::calc function uses the following default values for its arguments:

  • stream: Stream::Null()
  • hint: cv::noArray()
  • cost: cv::noArray()
Source

fn collect_garbage(&mut self) -> Result<()>

Releases all buffers, contexts and device pointers.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§