OpenCV
Open Source Computer Vision
|
Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 1.0. More...
#include <opencv2/cudaoptflow.hpp>
Public Types | |
enum | NVIDIA_OF_PERF_LEVEL { NV_OF_PERF_LEVEL_UNDEFINED , NV_OF_PERF_LEVEL_SLOW = 5 , NV_OF_PERF_LEVEL_MEDIUM = 10 , NV_OF_PERF_LEVEL_FAST = 20 , NV_OF_PERF_LEVEL_MAX } |
Public Member Functions | |
virtual void | upSampler (InputArray flow, cv::Size imageSize, int gridSize, InputOutputArray upsampledFlow)=0 |
The NVIDIA optical flow hardware generates flow vectors at granularity gridSize, which can be queried via function getGridSize(). Upsampler() helper function converts the hardware-generated flow vectors to dense representation (1 flow vector for each pixel) using nearest neighbour upsampling method. | |
Public Member Functions inherited from cv::cuda::NvidiaHWOpticalFlow | |
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 |
Static Public Member Functions | |
static Ptr< NvidiaOpticalFlow_1_0 > | create (cv::Size imageSize, cv::cuda::NvidiaOpticalFlow_1_0::NVIDIA_OF_PERF_LEVEL perfPreset=cv::cuda::NvidiaOpticalFlow_1_0::NV_OF_PERF_LEVEL_SLOW, bool enableTemporalHints=false, bool enableExternalHints=false, bool enableCostBuffer=false, int gpuId=0, Stream &inputStream=Stream::Null(), Stream &outputStream=Stream::Null()) |
Instantiate NVIDIA Optical Flow. | |
Static Public Member Functions inherited from cv::Algorithm | |
template<typename _Tp > | |
static Ptr< _Tp > | load (const String &filename, const String &objname=String()) |
Loads algorithm from the file. | |
template<typename _Tp > | |
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String()) |
Loads algorithm from a String. | |
template<typename _Tp > | |
static Ptr< _Tp > | read (const FileNode &fn) |
Reads algorithm from the file node. | |
Additional Inherited Members | |
Protected Member Functions inherited from cv::Algorithm | |
void | writeFormat (FileStorage &fs) const |
Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 1.0.
Supported optical flow performance levels.
|
static |
Instantiate NVIDIA Optical Flow.
imageSize | Size of input image in pixels. |
perfPreset | Optional parameter. Refer NV OF SDK documentation for details about presets. Defaults to NV_OF_PERF_LEVEL_SLOW. |
enableTemporalHints | Optional parameter. Flag to enable temporal hints. When set to true, the hardware uses the flow vectors generated in previous call to calc() as internal hints for the current call to calc(). Useful when computing flow vectors between successive video frames. Defaults to false. |
enableExternalHints | Optional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false. |
enableCostBuffer | Optional Parameter. Flag to enable cost buffer output from calc(). Defaults to false. |
gpuId | Optional parameter to select the GPU ID on which the optical flow should be computed. Useful in multi-GPU systems. Defaults to 0. |
inputStream | Optical flow algorithm may optionally involve cuda preprocessing on the input buffers. The input cuda stream can be used to pipeline and synchronize the cuda preprocessing tasks with OF HW engine. If input stream is not set, the execute function will use default stream which is NULL stream; |
outputStream | Optical flow algorithm may optionally involve cuda post processing on the output flow vectors. The output cuda stream can be used to pipeline and synchronize the cuda post processing tasks with OF HW engine. If output stream is not set, the execute function will use default stream which is NULL stream; |
|
pure virtual |
The NVIDIA optical flow hardware generates flow vectors at granularity gridSize, which can be queried via function getGridSize(). Upsampler() helper function converts the hardware-generated flow vectors to dense representation (1 flow vector for each pixel) using nearest neighbour upsampling method.
flow | Buffer of type CV_16FC2 containing flow vectors generated by calc(). |
imageSize | Size of the input image in pixels for which these flow vectors were generated. |
gridSize | Granularity of the optical flow vectors returned by calc() function. Can be queried using getGridSize(). |
upsampledFlow | Buffer of type CV_32FC2, containing upsampled flow vectors, each flow vector for 1 pixel, in the pitch-linear layout. |