Trait opencv::prelude::CUDA_NvidiaOpticalFlow_2_0
source · pub trait CUDA_NvidiaOpticalFlow_2_0: CUDA_NvidiaHWOpticalFlow + CUDA_NvidiaOpticalFlow_2_0Const {
// Required method
fn as_raw_mut_CUDA_NvidiaOpticalFlow_2_0(&mut self) -> *mut c_void;
// Provided method
fn convert_to_float(
&mut self,
flow: &dyn ToInputArray,
float_flow: &mut dyn ToInputOutputArray
) -> Result<()> { ... }
}
Expand description
Class for computing the optical flow vectors between two images using NVIDIA Optical Flow hardware and Optical Flow SDK 2.0.
Note:
- A sample application demonstrating the use of NVIDIA Optical Flow can be found at opencv_contrib_source_code/modules/cudaoptflow/samples/nvidia_optical_flow.cpp
- An example application comparing accuracy and performance of NVIDIA Optical Flow with other optical flow algorithms in OpenCV can be found at opencv_contrib_source_code/modules/cudaoptflow/samples/optical_flow.cpp
Required Methods§
fn as_raw_mut_CUDA_NvidiaOpticalFlow_2_0(&mut self) -> *mut c_void
Provided Methods§
sourcefn convert_to_float(
&mut self,
flow: &dyn ToInputArray,
float_flow: &mut dyn ToInputOutputArray
) -> Result<()>
fn convert_to_float( &mut self, flow: &dyn ToInputArray, float_flow: &mut dyn ToInputOutputArray ) -> Result<()>
convertToFloat() helper function converts the hardware-generated flow vectors to floating point representation (1 flow vector for gridSize). gridSize can be queried via function getGridSize().
Parameters
- flow: Buffer of type CV_16FC2 containing flow vectors generated by calc().
- floatFlow: Buffer of type CV_32FC2, containing flow vectors in floating point representation, each flow vector for 1 pixel per gridSize, in the pitch-linear layout.
Implementations§
source§impl dyn CUDA_NvidiaOpticalFlow_2_0 + '_
impl dyn CUDA_NvidiaOpticalFlow_2_0 + '_
sourcepub fn create(
image_size: Size,
perf_preset: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_PERF_LEVEL,
output_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_OUTPUT_VECTOR_GRID_SIZE,
hint_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_HINT_VECTOR_GRID_SIZE,
enable_temporal_hints: bool,
enable_external_hints: bool,
enable_cost_buffer: bool,
gpu_id: i32,
input_stream: &mut Stream,
output_stream: &mut Stream
) -> Result<Ptr<dyn CUDA_NvidiaOpticalFlow_2_0>>
pub fn create( image_size: Size, perf_preset: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_PERF_LEVEL, output_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_OUTPUT_VECTOR_GRID_SIZE, hint_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_HINT_VECTOR_GRID_SIZE, enable_temporal_hints: bool, enable_external_hints: bool, enable_cost_buffer: bool, gpu_id: i32, input_stream: &mut Stream, output_stream: &mut Stream ) -> Result<Ptr<dyn CUDA_NvidiaOpticalFlow_2_0>>
Instantiate NVIDIA Optical Flow
Parameters
- 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.
- outputGridSize: Optional parameter. Refer NV OF SDK documentation for details about output grid sizes. Defaults to NV_OF_OUTPUT_VECTOR_GRID_SIZE_1.
- hintGridSize: Optional parameter. Refer NV OF SDK documentation for details about hint grid sizes. Defaults to NV_OF_HINT_VECTOR_GRID_SIZE_1.
- 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;
C++ default parameters
- perf_preset: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_PERF_LEVEL_SLOW
- output_grid_size: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_OUTPUT_VECTOR_GRID_SIZE_1
- hint_grid_size: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_HINT_VECTOR_GRID_SIZE_1
- enable_temporal_hints: false
- enable_external_hints: false
- enable_cost_buffer: false
- gpu_id: 0
- input_stream: Stream::Null()
- output_stream: Stream::Null()
sourcepub fn create_1(
image_size: Size,
roi_data: Vector<Rect>,
perf_preset: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_PERF_LEVEL,
output_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_OUTPUT_VECTOR_GRID_SIZE,
hint_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_HINT_VECTOR_GRID_SIZE,
enable_temporal_hints: bool,
enable_external_hints: bool,
enable_cost_buffer: bool,
gpu_id: i32,
input_stream: &mut Stream,
output_stream: &mut Stream
) -> Result<Ptr<dyn CUDA_NvidiaOpticalFlow_2_0>>
pub fn create_1( image_size: Size, roi_data: Vector<Rect>, perf_preset: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_PERF_LEVEL, output_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_OUTPUT_VECTOR_GRID_SIZE, hint_grid_size: CUDA_NvidiaOpticalFlow_2_0_NVIDIA_OF_HINT_VECTOR_GRID_SIZE, enable_temporal_hints: bool, enable_external_hints: bool, enable_cost_buffer: bool, gpu_id: i32, input_stream: &mut Stream, output_stream: &mut Stream ) -> Result<Ptr<dyn CUDA_NvidiaOpticalFlow_2_0>>
Instantiate NVIDIA Optical Flow with ROI Feature
Parameters
- imageSize: Size of input image in pixels.
- roiData: Pointer to ROI data.
- perfPreset: Optional parameter. Refer NV OF SDK documentation for details about presets. Defaults to NV_OF_PERF_LEVEL_SLOW.
- outputGridSize: Optional parameter. Refer NV OF SDK documentation for details about output grid sizes. Defaults to NV_OF_OUTPUT_VECTOR_GRID_SIZE_1.
- hintGridSize: Optional parameter. Refer NV OF SDK documentation for details about hint grid sizes. Defaults to NV_OF_HINT_VECTOR_GRID_SIZE_1.
- 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;
C++ default parameters
- perf_preset: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_PERF_LEVEL_SLOW
- output_grid_size: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_OUTPUT_VECTOR_GRID_SIZE_1
- hint_grid_size: cv::cuda::NvidiaOpticalFlow_2_0::NV_OF_HINT_VECTOR_GRID_SIZE_1
- enable_temporal_hints: false
- enable_external_hints: false
- enable_cost_buffer: false
- gpu_id: 0
- input_stream: Stream::Null()
- output_stream: Stream::Null()