Struct opencv::video::DISOpticalFlow

source ·
pub struct DISOpticalFlow { /* private fields */ }
Expand description

DIS optical flow algorithm.

This class implements the Dense Inverse Search (DIS) optical flow algorithm. More details about the algorithm can be found at Kroeger2016 . Includes three presets with preselected parameters to provide reasonable trade-off between speed and quality. However, even the slowest preset is still relatively fast, use DeepFlow if you need better quality and don’t care about speed.

This implementation includes several additional features compared to the algorithm described in the paper, including spatial propagation of flow vectors ([getUseSpatialPropagation]), as well as an option to utilize an initial flow approximation passed to [calc] (which is, essentially, temporal propagation, if the previous frame’s flow field is passed).

Implementations§

source§

impl DISOpticalFlow

source

pub fn create(preset: i32) -> Result<Ptr<DISOpticalFlow>>

Creates an instance of DISOpticalFlow

§Parameters
  • preset: one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM
§C++ default parameters
  • preset: DISOpticalFlow::PRESET_FAST
source

pub fn create_def() -> Result<Ptr<DISOpticalFlow>>

Creates an instance of DISOpticalFlow

§Parameters
  • preset: one of PRESET_ULTRAFAST, PRESET_FAST and PRESET_MEDIUM
§Note

This alternative version of DISOpticalFlow::create function uses the following default values for its arguments:

  • preset: DISOpticalFlow::PRESET_FAST

Trait Implementations§

source§

impl AlgorithmTrait for DISOpticalFlow

source§

fn as_raw_mut_Algorithm(&mut self) -> *mut c_void

source§

fn clear(&mut self) -> Result<()>

Clears the algorithm state
source§

fn read(&mut self, fn_: &impl FileNodeTraitConst) -> Result<()>

Reads algorithm parameters from a file storage
source§

impl AlgorithmTraitConst for DISOpticalFlow

source§

fn as_raw_Algorithm(&self) -> *const c_void

source§

fn write(&self, fs: &mut impl FileStorageTrait) -> Result<()>

Stores algorithm parameters in a file storage
source§

fn write_1(&self, fs: &mut impl FileStorageTrait, name: &str) -> Result<()>

Stores algorithm parameters in a file storage Read more
source§

fn write_with_name(&self, fs: &Ptr<FileStorage>, name: &str) -> Result<()>

@deprecated Read more
source§

fn write_with_name_def(&self, fs: &Ptr<FileStorage>) -> Result<()>

👎Deprecated:

§Note

Deprecated: ## Note This alternative version of AlgorithmTraitConst::write_with_name function uses the following default values for its arguments: Read more
source§

fn empty(&self) -> Result<bool>

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
source§

fn save(&self, filename: &str) -> Result<()>

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).
source§

fn get_default_name(&self) -> Result<String>

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
source§

impl Boxed for DISOpticalFlow

source§

unsafe fn from_raw( ptr: <DISOpticalFlow as OpenCVFromExtern>::ExternReceive ) -> Self

Wrap the specified raw pointer Read more
source§

fn into_raw( self ) -> <DISOpticalFlow as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying raw pointer while consuming this wrapper. Read more
source§

fn as_raw(&self) -> <DISOpticalFlow as OpenCVTypeExternContainer>::ExternSend

Return the underlying raw pointer. Read more
source§

fn as_raw_mut( &mut self ) -> <DISOpticalFlow as OpenCVTypeExternContainer>::ExternSendMut

Return the underlying mutable raw pointer Read more
source§

impl DISOpticalFlowTrait for DISOpticalFlow

source§

fn as_raw_mut_DISOpticalFlow(&mut self) -> *mut c_void

source§

fn set_finest_scale(&mut self, val: i32) -> Result<()>

Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution). The final flow is obtained by bilinear upscaling. Read more
source§

fn set_patch_size(&mut self, val: i32) -> Result<()>

Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well enough in most cases. Read more
source§

fn set_patch_stride(&mut self, val: i32) -> Result<()>

Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. Read more
source§

fn set_gradient_descent_iterations(&mut self, val: i32) -> Result<()>

Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. Read more
source§

fn set_variational_refinement_iterations(&mut self, val: i32) -> Result<()>

Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. Read more
source§

fn set_variational_refinement_alpha(&mut self, val: f32) -> Result<()>

Weight of the smoothness term Read more
source§

fn set_variational_refinement_delta(&mut self, val: f32) -> Result<()>

Weight of the color constancy term Read more
source§

fn set_variational_refinement_gamma(&mut self, val: f32) -> Result<()>

Weight of the gradient constancy term Read more
source§

fn set_use_mean_normalization(&mut self, val: bool) -> Result<()>

Whether to use mean-normalization of patches when computing patch distance. It is turned on by default as it typically provides a noticeable quality boost because of increased robustness to illumination variations. Turn it off if you are certain that your sequence doesn’t contain any changes in illumination. Read more
source§

fn set_use_spatial_propagation(&mut self, val: bool) -> Result<()>

Whether to use spatial propagation of good optical flow vectors. This option is turned on by default, as it tends to work better on average and can sometimes help recover from major errors introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this option off can make the output flow field a bit smoother, however. Read more
source§

impl DISOpticalFlowTraitConst for DISOpticalFlow

source§

fn as_raw_DISOpticalFlow(&self) -> *const c_void

source§

fn get_finest_scale(&self) -> Result<i32>

Finest level of the Gaussian pyramid on which the flow is computed (zero level corresponds to the original image resolution). The final flow is obtained by bilinear upscaling. Read more
source§

fn get_patch_size(&self) -> Result<i32>

Size of an image patch for matching (in pixels). Normally, default 8x8 patches work well enough in most cases. Read more
source§

fn get_patch_stride(&self) -> Result<i32>

Stride between neighbor patches. Must be less than patch size. Lower values correspond to higher flow quality. Read more
source§

fn get_gradient_descent_iterations(&self) -> Result<i32>

Maximum number of gradient descent iterations in the patch inverse search stage. Higher values may improve quality in some cases. Read more
source§

fn get_variational_refinement_iterations(&self) -> Result<i32>

Number of fixed point iterations of variational refinement per scale. Set to zero to disable variational refinement completely. Higher values will typically result in more smooth and high-quality flow. Read more
source§

fn get_variational_refinement_alpha(&self) -> Result<f32>

Weight of the smoothness term Read more
source§

fn get_variational_refinement_delta(&self) -> Result<f32>

Weight of the color constancy term Read more
source§

fn get_variational_refinement_gamma(&self) -> Result<f32>

Weight of the gradient constancy term Read more
source§

fn get_use_mean_normalization(&self) -> Result<bool>

Whether to use mean-normalization of patches when computing patch distance. It is turned on by default as it typically provides a noticeable quality boost because of increased robustness to illumination variations. Turn it off if you are certain that your sequence doesn’t contain any changes in illumination. Read more
source§

fn get_use_spatial_propagation(&self) -> Result<bool>

Whether to use spatial propagation of good optical flow vectors. This option is turned on by default, as it tends to work better on average and can sometimes help recover from major errors introduced by the coarse-to-fine scheme employed by the DIS optical flow algorithm. Turning this option off can make the output flow field a bit smoother, however. Read more
source§

impl Debug for DISOpticalFlow

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl DenseOpticalFlowTrait for DISOpticalFlow

source§

fn as_raw_mut_DenseOpticalFlow(&mut self) -> *mut c_void

source§

fn calc( &mut self, i0: &impl ToInputArray, i1: &impl ToInputArray, flow: &mut impl ToInputOutputArray ) -> Result<()>

Calculates an optical flow. Read more
source§

fn collect_garbage(&mut self) -> Result<()>

Releases all inner buffers.
source§

impl DenseOpticalFlowTraitConst for DISOpticalFlow

source§

impl Drop for DISOpticalFlow

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<DISOpticalFlow> for Algorithm

source§

fn from(s: DISOpticalFlow) -> Self

Converts to this type from the input type.
source§

impl From<DISOpticalFlow> for DenseOpticalFlow

source§

fn from(s: DISOpticalFlow) -> Self

Converts to this type from the input type.
source§

impl TryFrom<DenseOpticalFlow> for DISOpticalFlow

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(s: DenseOpticalFlow) -> Result<Self>

Performs the conversion.
source§

impl Send for DISOpticalFlow

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Mat> ModifyInplace for Mat
where Mat: Boxed,

source§

unsafe fn modify_inplace<Res>( &mut self, f: impl FnOnce(&Mat, &mut Mat) -> Res ) -> Res

Helper function to call OpenCV functions that allow in-place modification of a Mat or another similar object. By passing a mutable reference to the Mat to this function your closure will get called with the read reference and a write references to the same Mat. This is of course unsafe as it breaks the Rust aliasing rules, but it might be useful for some performance sensitive operations. One example of an OpenCV function that allows such in-place modification is imgproc::threshold. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.