OpenCV 5.0.0-pre
Open Source Computer Vision
Loading...
Searching...
No Matches
cv::cuda::NvidiaHWOpticalFlow Class Referenceabstract

Base Interface for optical flow algorithms using NVIDIA Optical Flow SDK. More...

#include <opencv2/cudaoptflow.hpp>

Collaboration diagram for cv::cuda::NvidiaHWOpticalFlow:

Public Member Functions

virtual void calc (InputArray inputImage, InputArray referenceImage, InputOutputArray flow, Stream &stream=Stream::Null(), InputArray hint=cv::noArray(), OutputArray cost=cv::noArray())=0
 Calculates Optical Flow using NVIDIA Optical Flow SDK.
 
virtual void collectGarbage ()=0
 Releases all buffers, contexts and device pointers.
 
virtual int getGridSize () const =0
 Returns grid size of output buffer as per the hardware's capability.
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state.
 
virtual bool empty () const
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage.
 
virtual void save (const String &filename) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
 
void write (FileStorage &fs, const String &name) const
 

Additional Inherited Members

- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

Base Interface for optical flow algorithms using NVIDIA Optical Flow SDK.

Member Function Documentation

◆ calc()

virtual void cv::cuda::NvidiaHWOpticalFlow::calc ( InputArray inputImage,
InputArray referenceImage,
InputOutputArray flow,
Stream & stream = Stream::Null(),
InputArray hint = cv::noArray(),
OutputArray cost = cv::noArray() )
pure virtual

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
inputImageInput image.
referenceImageReference image of the same size and the same type as input image.
flowA buffer consisting of inputImage.Size() / getGridSize() flow vectors in CV_16SC2 format.
streamIt 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;
hintHint buffer if client provides external hints. Must have same size as flow buffer. Caller can provide flow vectors as hints for optical flow calculation.
costCost 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.

◆ collectGarbage()

virtual void cv::cuda::NvidiaHWOpticalFlow::collectGarbage ( )
pure virtual

Releases all buffers, contexts and device pointers.

◆ getGridSize()

virtual int cv::cuda::NvidiaHWOpticalFlow::getGridSize ( ) const
pure virtual

Returns grid size of output buffer as per the hardware's capability.


The documentation for this class was generated from the following file: