Class NvidiaOpticalFlow_1_0
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
SizeSize of input image in pixels.
perfPreset
NvidiaOpticalFlow_1_0.PerfLevelOptional parameter. Refer https://developer.nvidia.com/opticalflow-sdk for details about presets. Defaults to Slow.
enableTemporalHints
boolOptional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.
enableExternalHints
boolOptional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.
enableCostBuffer
boolOptional Parameter. Flag to enable cost buffer output from calc(). Defaults to false.
gpuId
intOptional parameter to select the GPU ID on which the optical flow should be computed. Useful in multi-GPU systems. Defaults to 0.
inputStream
StreamOptical 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
StreamOptical 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
NvidiaOpticalFlowPtr
Pointer to the NvidiaOpticalFlow object
public nint NvidiaOpticalFlowPtr { get; }
Property Value
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
IInputArrayBuffer of type CV_16FC2 containing flow vectors generated by calc().
imageSize
SizeSize of the input image in pixels for which these flow vectors were generated.
gridSize
intGranularity of the optical flow vectors returned by calc() function.
upsampledFlow
IInputOutputArrayBuffer of type CV_32FC2, containing upsampled flow vectors, each flow vector for 1 pixel, in the pitch-linear layout.