Пример #1
0
 /// <summary>
 /// Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 2.0.
 /// </summary>
 /// <param name="imageSize">Size of input image in pixels.</param>
 /// <param name="perfPreset">Optional parameter. Refer https://developer.nvidia.com/opticalflow-sdk for details about presets. Defaults to Slow.</param>
 /// <param name="outputGridSize">Optional parameter. Refer https://developer.nvidia.com/opticalflow-sdk for details about presets.</param>
 /// <param name="hintGridSize">Optional parameter. Refer https://developer.nvidia.com/opticalflow-sdk for details about presets.</param>
 /// <param name="enableTemporalHints">Optional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.</param>
 /// <param name="enableExternalHints">Optional Parameter. Flag to enable passing external hints buffer to calc(). Defaults to false.</param>
 /// <param name="enableCostBuffer">Optional Parameter. Flag to enable cost buffer output from calc(). Defaults to false.</param>
 /// <param name="gpuId">Optional parameter to select the GPU ID on which the optical flow should be computed. Useful in multi-GPU systems. Defaults to 0.</param>
 /// <param name="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</param>
 /// <param name="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</param>
 public NvidiaOpticalFlow_2_0(
     Size imageSize,
     NvidiaOpticalFlow_2_0.PerfLevel perfPreset = PerfLevel.Slow,
     NvidiaOpticalFlow_2_0.OutputVectorGridSize outputGridSize = OutputVectorGridSize.Size1,
     NvidiaOpticalFlow_2_0.HintVectorGridSize hintGridSize     = HintVectorGridSize.Size1,
     bool enableTemporalHints = false,
     bool enableExternalHints = false,
     bool enableCostBuffer    = false,
     int gpuId           = 0,
     Stream inputStream  = null,
     Stream outputStream = null)
 {
     _ptr = CudaInvoke.cudaNvidiaOpticalFlow_2_0_Create(
         ref imageSize,
         perfPreset,
         outputGridSize,
         hintGridSize,
         enableTemporalHints,
         enableExternalHints,
         enableCostBuffer,
         gpuId,
         inputStream,
         outputStream,
         ref _nvidiaHWOpticalFlow,
         ref _algorithm,
         ref _sharedPtr);
 }
Пример #2
0
 internal static extern IntPtr cudaNvidiaOpticalFlow_2_0_Create(
     ref Size imageSize,
     NvidiaOpticalFlow_2_0.PerfLevel perfPreset,
     NvidiaOpticalFlow_2_0.OutputVectorGridSize outputVectorGridSize,
     NvidiaOpticalFlow_2_0.HintVectorGridSize hintVectorGridSize,
     [MarshalAs(CvInvoke.BoolMarshalType)]
     bool enableTemporalHints,
     [MarshalAs(CvInvoke.BoolMarshalType)]
     bool enableExternalHints,
     [MarshalAs(CvInvoke.BoolMarshalType)]
     bool enableCostBuffer,
     int gpuId,
     IntPtr inputStream,
     IntPtr outputStream,
     ref IntPtr nHWOpticalFlow,
     ref IntPtr algorithm,
     ref IntPtr sharedPtr);