Table of Contents

Class NvidiaOpticalFlow_1_0

Namespace
Emgu.CV.Cuda
Assembly
Emgu.CV.dll

Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 1.0.

public class NvidiaOpticalFlow_1_0 : SharedPtrObject, IDisposable, INvidiaOpticalFlow, IAlgorithm
Inheritance
NvidiaOpticalFlow_1_0
Implements
Inherited Members
Extension Methods

Constructors

NvidiaOpticalFlow_1_0(Size, PerfLevel, bool, bool, bool, int, Stream, Stream)

Instantiate NVIDIA Optical Flow

public NvidiaOpticalFlow_1_0(Size imageSize, NvidiaOpticalFlow_1_0.PerfLevel perfPreset = PerfLevel.Slow, bool enableTemporalHints = false, bool enableExternalHints = false, bool enableCostBuffer = false, int gpuId = 0, Stream inputStream = null, Stream outputStream = null)

Parameters

imageSize Size

Size of input image in pixels.

perfPreset NvidiaOpticalFlow_1_0.PerfLevel

Optional parameter. Refer https://developer.nvidia.com/opticalflow-sdk for details about presets. Defaults to Slow.

enableTemporalHints bool

Optional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.

enableExternalHints bool

Optional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.

enableCostBuffer bool

Optional Parameter. Flag to enable cost buffer output from calc(). Defaults to false.

gpuId int

Optional parameter to select the GPU ID on which the optical flow should be computed. Useful in multi-GPU systems. Defaults to 0.

inputStream Stream

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 Stream

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

Properties

AlgorithmPtr

Pointer to the algorithm object

public nint AlgorithmPtr { get; }

Property Value

nint

NvidiaOpticalFlowPtr

Pointer to the NvidiaOpticalFlow object

public nint NvidiaOpticalFlowPtr { get; }

Property Value

nint

Methods

DisposeObject()

Release all the unmanaged memory associated with this optical flow solver.

protected override void DisposeObject()

UpSampler(IInputArray, Size, int, IInputOutputArray)

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 void UpSampler(IInputArray flow, Size imageSize, int gridSize, IInputOutputArray upsampledFlow)

Parameters

flow IInputArray

Buffer of type CV_16FC2 containing flow vectors generated by calc().

imageSize Size

Size of the input image in pixels for which these flow vectors were generated.

gridSize int

Granularity of the optical flow vectors returned by calc() function.

upsampledFlow IInputOutputArray

Buffer of type CV_32FC2, containing upsampled flow vectors, each flow vector for 1 pixel, in the pitch-linear layout.