use std::os::raw::{c_char, c_void};
use libc::{ptrdiff_t, size_t};
use crate::{Error, Result, core, sys, types};
use crate::core::{_InputArray, _OutputArray};
pub const MOTION_AFFINE: i32 = 2;
pub const MOTION_EUCLIDEAN: i32 = 1;
pub const MOTION_HOMOGRAPHY: i32 = 3;
pub const MOTION_TRANSLATION: i32 = 0;
pub const OPTFLOW_FARNEBACK_GAUSSIAN: i32 = 256;
pub const OPTFLOW_LK_GET_MIN_EIGENVALS: i32 = 8;
pub const OPTFLOW_USE_INITIAL_FLOW: i32 = 4;
pub fn cam_shift(prob_image: &dyn core::ToInputArray, window: &mut core::Rect, criteria: &core::TermCriteria) -> Result<core::RotatedRect> {
input_array_arg!(prob_image);
unsafe { sys::cv_CamShift__InputArray_Rect_TermCriteria(prob_image.as_raw__InputArray(), window, criteria.as_raw_TermCriteria()) }.into_result().map(|ptr| core::RotatedRect { ptr })
}
pub fn build_optical_flow_pyramid(img: &dyn core::ToInputArray, pyramid: &mut dyn core::ToOutputArray, win_size: core::Size, max_level: i32, with_derivatives: bool, pyr_border: i32, deriv_border: i32, try_reuse_input_image: bool) -> Result<i32> {
input_array_arg!(img);
output_array_arg!(pyramid);
unsafe { sys::cv_buildOpticalFlowPyramid__InputArray__OutputArray_Size_int_bool_int_int_bool(img.as_raw__InputArray(), pyramid.as_raw__OutputArray(), win_size, max_level, with_derivatives, pyr_border, deriv_border, try_reuse_input_image) }.into_result()
}
pub fn calc_optical_flow_farneback(prev: &dyn core::ToInputArray, next: &dyn core::ToInputArray, flow: &mut dyn core::ToInputOutputArray, pyr_scale: f64, levels: i32, winsize: i32, iterations: i32, poly_n: i32, poly_sigma: f64, flags: i32) -> Result<()> {
input_array_arg!(prev);
input_array_arg!(next);
input_output_array_arg!(flow);
unsafe { sys::cv_calcOpticalFlowFarneback__InputArray__InputArray__InputOutputArray_double_int_int_int_int_double_int(prev.as_raw__InputArray(), next.as_raw__InputArray(), flow.as_raw__InputOutputArray(), pyr_scale, levels, winsize, iterations, poly_n, poly_sigma, flags) }.into_result()
}
pub fn calc_optical_flow_pyr_lk(prev_img: &dyn core::ToInputArray, next_img: &dyn core::ToInputArray, prev_pts: &dyn core::ToInputArray, next_pts: &mut dyn core::ToInputOutputArray, status: &mut dyn core::ToOutputArray, err: &mut dyn core::ToOutputArray, win_size: core::Size, max_level: i32, criteria: &core::TermCriteria, flags: i32, min_eig_threshold: f64) -> Result<()> {
input_array_arg!(prev_img);
input_array_arg!(next_img);
input_array_arg!(prev_pts);
input_output_array_arg!(next_pts);
output_array_arg!(status);
output_array_arg!(err);
unsafe { sys::cv_calcOpticalFlowPyrLK__InputArray__InputArray__InputArray__InputOutputArray__OutputArray__OutputArray_Size_int_TermCriteria_int_double(prev_img.as_raw__InputArray(), next_img.as_raw__InputArray(), prev_pts.as_raw__InputArray(), next_pts.as_raw__InputOutputArray(), status.as_raw__OutputArray(), err.as_raw__OutputArray(), win_size, max_level, criteria.as_raw_TermCriteria(), flags, min_eig_threshold) }.into_result()
}
pub fn compute_ecc(template_image: &dyn core::ToInputArray, input_image: &dyn core::ToInputArray, input_mask: &dyn core::ToInputArray) -> Result<f64> {
input_array_arg!(template_image);
input_array_arg!(input_image);
input_array_arg!(input_mask);
unsafe { sys::cv_computeECC__InputArray__InputArray__InputArray(template_image.as_raw__InputArray(), input_image.as_raw__InputArray(), input_mask.as_raw__InputArray()) }.into_result()
}
pub fn create_background_subtractor_knn(history: i32, dist2_threshold: f64, detect_shadows: bool) -> Result<types::PtrOfBackgroundSubtractorKNN> {
unsafe { sys::cv_createBackgroundSubtractorKNN_int_double_bool(history, dist2_threshold, detect_shadows) }.into_result().map(|ptr| types::PtrOfBackgroundSubtractorKNN { ptr })
}
pub fn create_background_subtractor_mog2(history: i32, var_threshold: f64, detect_shadows: bool) -> Result<types::PtrOfBackgroundSubtractorMOG2> {
unsafe { sys::cv_createBackgroundSubtractorMOG2_int_double_bool(history, var_threshold, detect_shadows) }.into_result().map(|ptr| types::PtrOfBackgroundSubtractorMOG2 { ptr })
}
pub fn create_opt_flow_dual_tvl1() -> Result<types::PtrOfDualTVL1OpticalFlow> {
unsafe { sys::cv_createOptFlow_DualTVL1() }.into_result().map(|ptr| types::PtrOfDualTVL1OpticalFlow { ptr })
}
pub fn estimate_rigid_transform(src: &dyn core::ToInputArray, dst: &dyn core::ToInputArray, full_affine: bool) -> Result<core::Mat> {
input_array_arg!(src);
input_array_arg!(dst);
unsafe { sys::cv_estimateRigidTransform__InputArray__InputArray_bool(src.as_raw__InputArray(), dst.as_raw__InputArray(), full_affine) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn estimate_rigid_transform_1(src: &dyn core::ToInputArray, dst: &dyn core::ToInputArray, full_affine: bool, ransac_max_iters: i32, ransac_good_ratio: f64, ransac_size0: i32) -> Result<core::Mat> {
input_array_arg!(src);
input_array_arg!(dst);
unsafe { sys::cv_estimateRigidTransform__InputArray__InputArray_bool_int_double_int(src.as_raw__InputArray(), dst.as_raw__InputArray(), full_affine, ransac_max_iters, ransac_good_ratio, ransac_size0) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn find_transform_ecc(template_image: &dyn core::ToInputArray, input_image: &dyn core::ToInputArray, warp_matrix: &mut dyn core::ToInputOutputArray, motion_type: i32, criteria: &core::TermCriteria, input_mask: &dyn core::ToInputArray) -> Result<f64> {
input_array_arg!(template_image);
input_array_arg!(input_image);
input_output_array_arg!(warp_matrix);
input_array_arg!(input_mask);
unsafe { sys::cv_findTransformECC__InputArray__InputArray__InputOutputArray_int_TermCriteria__InputArray(template_image.as_raw__InputArray(), input_image.as_raw__InputArray(), warp_matrix.as_raw__InputOutputArray(), motion_type, criteria.as_raw_TermCriteria(), input_mask.as_raw__InputArray()) }.into_result()
}
pub fn find_transform_ecc_1(template_image: &dyn core::ToInputArray, input_image: &dyn core::ToInputArray, warp_matrix: &mut dyn core::ToInputOutputArray, motion_type: i32, criteria: &core::TermCriteria, input_mask: &dyn core::ToInputArray, gauss_filt_size: i32) -> Result<f64> {
input_array_arg!(template_image);
input_array_arg!(input_image);
input_output_array_arg!(warp_matrix);
input_array_arg!(input_mask);
unsafe { sys::cv_findTransformECC__InputArray__InputArray__InputOutputArray_int_TermCriteria__InputArray_int(template_image.as_raw__InputArray(), input_image.as_raw__InputArray(), warp_matrix.as_raw__InputOutputArray(), motion_type, criteria.as_raw_TermCriteria(), input_mask.as_raw__InputArray(), gauss_filt_size) }.into_result()
}
pub fn mean_shift(prob_image: &dyn core::ToInputArray, window: &mut core::Rect, criteria: &core::TermCriteria) -> Result<i32> {
input_array_arg!(prob_image);
unsafe { sys::cv_meanShift__InputArray_Rect_TermCriteria(prob_image.as_raw__InputArray(), window, criteria.as_raw_TermCriteria()) }.into_result()
}
pub trait BackgroundSubtractor: core::Algorithm {
#[inline(always)] fn as_raw_BackgroundSubtractor(&self) -> *mut c_void;
fn apply(&mut self, image: &dyn core::ToInputArray, fgmask: &mut dyn core::ToOutputArray, learning_rate: f64) -> Result<()> {
input_array_arg!(image);
output_array_arg!(fgmask);
unsafe { sys::cv_BackgroundSubtractor_apply__InputArray__OutputArray_double(self.as_raw_BackgroundSubtractor(), image.as_raw__InputArray(), fgmask.as_raw__OutputArray(), learning_rate) }.into_result()
}
fn get_background_image(&self, background_image: &mut dyn core::ToOutputArray) -> Result<()> {
output_array_arg!(background_image);
unsafe { sys::cv_BackgroundSubtractor_getBackgroundImage_const__OutputArray(self.as_raw_BackgroundSubtractor(), background_image.as_raw__OutputArray()) }.into_result()
}
}
pub trait BackgroundSubtractorKNN: crate::video::BackgroundSubtractor {
#[inline(always)] fn as_raw_BackgroundSubtractorKNN(&self) -> *mut c_void;
fn get_history(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorKNN_getHistory_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_history(&mut self, history: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setHistory_int(self.as_raw_BackgroundSubtractorKNN(), history) }.into_result()
}
fn get_n_samples(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorKNN_getNSamples_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_n_samples(&mut self, _n_n: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setNSamples_int(self.as_raw_BackgroundSubtractorKNN(), _n_n) }.into_result()
}
fn get_dist2_threshold(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorKNN_getDist2Threshold_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_dist2_threshold(&mut self, _dist2_threshold: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setDist2Threshold_double(self.as_raw_BackgroundSubtractorKNN(), _dist2_threshold) }.into_result()
}
fn getk_nn_samples(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorKNN_getkNNSamples_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn setk_nn_samples(&mut self, _nk_nn: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setkNNSamples_int(self.as_raw_BackgroundSubtractorKNN(), _nk_nn) }.into_result()
}
fn get_detect_shadows(&self) -> Result<bool> {
unsafe { sys::cv_BackgroundSubtractorKNN_getDetectShadows_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setDetectShadows_bool(self.as_raw_BackgroundSubtractorKNN(), detect_shadows) }.into_result()
}
fn get_shadow_value(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorKNN_getShadowValue_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_shadow_value(&mut self, value: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setShadowValue_int(self.as_raw_BackgroundSubtractorKNN(), value) }.into_result()
}
fn get_shadow_threshold(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorKNN_getShadowThreshold_const(self.as_raw_BackgroundSubtractorKNN()) }.into_result()
}
fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorKNN_setShadowThreshold_double(self.as_raw_BackgroundSubtractorKNN(), threshold) }.into_result()
}
}
pub trait BackgroundSubtractorMOG2: crate::video::BackgroundSubtractor {
#[inline(always)] fn as_raw_BackgroundSubtractorMOG2(&self) -> *mut c_void;
fn get_history(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getHistory_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_history(&mut self, history: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setHistory_int(self.as_raw_BackgroundSubtractorMOG2(), history) }.into_result()
}
fn get_n_mixtures(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getNMixtures_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_n_mixtures(&mut self, nmixtures: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setNMixtures_int(self.as_raw_BackgroundSubtractorMOG2(), nmixtures) }.into_result()
}
fn get_background_ratio(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getBackgroundRatio_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_background_ratio(&mut self, ratio: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setBackgroundRatio_double(self.as_raw_BackgroundSubtractorMOG2(), ratio) }.into_result()
}
fn get_var_threshold(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getVarThreshold_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_var_threshold(&mut self, var_threshold: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setVarThreshold_double(self.as_raw_BackgroundSubtractorMOG2(), var_threshold) }.into_result()
}
fn get_var_threshold_gen(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getVarThresholdGen_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_var_threshold_gen(&mut self, var_threshold_gen: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setVarThresholdGen_double(self.as_raw_BackgroundSubtractorMOG2(), var_threshold_gen) }.into_result()
}
fn get_var_init(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getVarInit_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_var_init(&mut self, var_init: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setVarInit_double(self.as_raw_BackgroundSubtractorMOG2(), var_init) }.into_result()
}
fn get_var_min(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getVarMin_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_var_min(&mut self, var_min: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setVarMin_double(self.as_raw_BackgroundSubtractorMOG2(), var_min) }.into_result()
}
fn get_var_max(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getVarMax_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_var_max(&mut self, var_max: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setVarMax_double(self.as_raw_BackgroundSubtractorMOG2(), var_max) }.into_result()
}
fn get_complexity_reduction_threshold(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getComplexityReductionThreshold_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_complexity_reduction_threshold(&mut self, ct: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setComplexityReductionThreshold_double(self.as_raw_BackgroundSubtractorMOG2(), ct) }.into_result()
}
fn get_detect_shadows(&self) -> Result<bool> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getDetectShadows_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_detect_shadows(&mut self, detect_shadows: bool) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setDetectShadows_bool(self.as_raw_BackgroundSubtractorMOG2(), detect_shadows) }.into_result()
}
fn get_shadow_value(&self) -> Result<i32> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getShadowValue_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_shadow_value(&mut self, value: i32) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setShadowValue_int(self.as_raw_BackgroundSubtractorMOG2(), value) }.into_result()
}
fn get_shadow_threshold(&self) -> Result<f64> {
unsafe { sys::cv_BackgroundSubtractorMOG2_getShadowThreshold_const(self.as_raw_BackgroundSubtractorMOG2()) }.into_result()
}
fn set_shadow_threshold(&mut self, threshold: f64) -> Result<()> {
unsafe { sys::cv_BackgroundSubtractorMOG2_setShadowThreshold_double(self.as_raw_BackgroundSubtractorMOG2(), threshold) }.into_result()
}
fn apply(&mut self, image: &dyn core::ToInputArray, fgmask: &mut dyn core::ToOutputArray, learning_rate: f64) -> Result<()> {
input_array_arg!(image);
output_array_arg!(fgmask);
unsafe { sys::cv_BackgroundSubtractorMOG2_apply__InputArray__OutputArray_double(self.as_raw_BackgroundSubtractorMOG2(), image.as_raw__InputArray(), fgmask.as_raw__OutputArray(), learning_rate) }.into_result()
}
}
pub trait DenseOpticalFlow: core::Algorithm {
#[inline(always)] fn as_raw_DenseOpticalFlow(&self) -> *mut c_void;
fn calc(&mut self, i0: &dyn core::ToInputArray, i1: &dyn core::ToInputArray, flow: &mut dyn core::ToInputOutputArray) -> Result<()> {
input_array_arg!(i0);
input_array_arg!(i1);
input_output_array_arg!(flow);
unsafe { sys::cv_DenseOpticalFlow_calc__InputArray__InputArray__InputOutputArray(self.as_raw_DenseOpticalFlow(), i0.as_raw__InputArray(), i1.as_raw__InputArray(), flow.as_raw__InputOutputArray()) }.into_result()
}
fn collect_garbage(&mut self) -> Result<()> {
unsafe { sys::cv_DenseOpticalFlow_collectGarbage(self.as_raw_DenseOpticalFlow()) }.into_result()
}
}
pub trait DualTVL1OpticalFlow: crate::video::DenseOpticalFlow {
#[inline(always)] fn as_raw_DualTVL1OpticalFlow(&self) -> *mut c_void;
fn get_tau(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getTau_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_tau(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setTau_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_lambda(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getLambda_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_lambda(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setLambda_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_theta(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getTheta_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_theta(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setTheta_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_gamma(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getGamma_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_gamma(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setGamma_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_scales_number(&self) -> Result<i32> {
unsafe { sys::cv_DualTVL1OpticalFlow_getScalesNumber_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_scales_number(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setScalesNumber_int(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_warpings_number(&self) -> Result<i32> {
unsafe { sys::cv_DualTVL1OpticalFlow_getWarpingsNumber_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_warpings_number(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setWarpingsNumber_int(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_epsilon(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getEpsilon_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_epsilon(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setEpsilon_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_inner_iterations(&self) -> Result<i32> {
unsafe { sys::cv_DualTVL1OpticalFlow_getInnerIterations_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_inner_iterations(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setInnerIterations_int(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_outer_iterations(&self) -> Result<i32> {
unsafe { sys::cv_DualTVL1OpticalFlow_getOuterIterations_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_outer_iterations(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setOuterIterations_int(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_use_initial_flow(&self) -> Result<bool> {
unsafe { sys::cv_DualTVL1OpticalFlow_getUseInitialFlow_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_use_initial_flow(&mut self, val: bool) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setUseInitialFlow_bool(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_scale_step(&self) -> Result<f64> {
unsafe { sys::cv_DualTVL1OpticalFlow_getScaleStep_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_scale_step(&mut self, val: f64) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setScaleStep_double(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
fn get_median_filtering(&self) -> Result<i32> {
unsafe { sys::cv_DualTVL1OpticalFlow_getMedianFiltering_const(self.as_raw_DualTVL1OpticalFlow()) }.into_result()
}
fn set_median_filtering(&mut self, val: i32) -> Result<()> {
unsafe { sys::cv_DualTVL1OpticalFlow_setMedianFiltering_int(self.as_raw_DualTVL1OpticalFlow(), val) }.into_result()
}
}
impl dyn DualTVL1OpticalFlow + '_ {
pub fn create(tau: f64, lambda: f64, theta: f64, nscales: i32, warps: i32, epsilon: f64, innner_iterations: i32, outer_iterations: i32, scale_step: f64, gamma: f64, median_filtering: i32, use_initial_flow: bool) -> Result<types::PtrOfDualTVL1OpticalFlow> {
unsafe { sys::cv_DualTVL1OpticalFlow_create_double_double_double_int_int_double_int_int_double_double_int_bool(tau, lambda, theta, nscales, warps, epsilon, innner_iterations, outer_iterations, scale_step, gamma, median_filtering, use_initial_flow) }.into_result().map(|ptr| types::PtrOfDualTVL1OpticalFlow { ptr })
}
}
pub trait FarnebackOpticalFlow: crate::video::DenseOpticalFlow {
#[inline(always)] fn as_raw_FarnebackOpticalFlow(&self) -> *mut c_void;
fn get_num_levels(&self) -> Result<i32> {
unsafe { sys::cv_FarnebackOpticalFlow_getNumLevels_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_num_levels(&mut self, num_levels: i32) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setNumLevels_int(self.as_raw_FarnebackOpticalFlow(), num_levels) }.into_result()
}
fn get_pyr_scale(&self) -> Result<f64> {
unsafe { sys::cv_FarnebackOpticalFlow_getPyrScale_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_pyr_scale(&mut self, pyr_scale: f64) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setPyrScale_double(self.as_raw_FarnebackOpticalFlow(), pyr_scale) }.into_result()
}
fn get_fast_pyramids(&self) -> Result<bool> {
unsafe { sys::cv_FarnebackOpticalFlow_getFastPyramids_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_fast_pyramids(&mut self, fast_pyramids: bool) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setFastPyramids_bool(self.as_raw_FarnebackOpticalFlow(), fast_pyramids) }.into_result()
}
fn get_win_size(&self) -> Result<i32> {
unsafe { sys::cv_FarnebackOpticalFlow_getWinSize_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_win_size(&mut self, win_size: i32) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setWinSize_int(self.as_raw_FarnebackOpticalFlow(), win_size) }.into_result()
}
fn get_num_iters(&self) -> Result<i32> {
unsafe { sys::cv_FarnebackOpticalFlow_getNumIters_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_num_iters(&mut self, num_iters: i32) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setNumIters_int(self.as_raw_FarnebackOpticalFlow(), num_iters) }.into_result()
}
fn get_poly_n(&self) -> Result<i32> {
unsafe { sys::cv_FarnebackOpticalFlow_getPolyN_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_poly_n(&mut self, poly_n: i32) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setPolyN_int(self.as_raw_FarnebackOpticalFlow(), poly_n) }.into_result()
}
fn get_poly_sigma(&self) -> Result<f64> {
unsafe { sys::cv_FarnebackOpticalFlow_getPolySigma_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_poly_sigma(&mut self, poly_sigma: f64) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setPolySigma_double(self.as_raw_FarnebackOpticalFlow(), poly_sigma) }.into_result()
}
fn get_flags(&self) -> Result<i32> {
unsafe { sys::cv_FarnebackOpticalFlow_getFlags_const(self.as_raw_FarnebackOpticalFlow()) }.into_result()
}
fn set_flags(&mut self, flags: i32) -> Result<()> {
unsafe { sys::cv_FarnebackOpticalFlow_setFlags_int(self.as_raw_FarnebackOpticalFlow(), flags) }.into_result()
}
}
impl dyn FarnebackOpticalFlow + '_ {
pub fn create(num_levels: i32, pyr_scale: f64, fast_pyramids: bool, win_size: i32, num_iters: i32, poly_n: i32, poly_sigma: f64, flags: i32) -> Result<types::PtrOfFarnebackOpticalFlow> {
unsafe { sys::cv_FarnebackOpticalFlow_create_int_double_bool_int_int_int_double_int(num_levels, pyr_scale, fast_pyramids, win_size, num_iters, poly_n, poly_sigma, flags) }.into_result().map(|ptr| types::PtrOfFarnebackOpticalFlow { ptr })
}
}
pub struct KalmanFilter {
#[doc(hidden)] pub(crate) ptr: *mut c_void
}
impl Drop for crate::video::KalmanFilter {
fn drop(&mut self) {
unsafe { sys::cv_KalmanFilter_delete(self.ptr) };
}
}
impl crate::video::KalmanFilter {
#[inline(always)] pub fn as_raw_KalmanFilter(&self) -> *mut c_void { self.ptr }
pub unsafe fn from_raw_ptr(ptr: *mut c_void) -> Self {
Self { ptr }
}
}
unsafe impl Send for KalmanFilter {}
impl KalmanFilter {
pub fn state_pre(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_statePre(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_state_pre(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_statePre_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn state_post(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_statePost(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_state_post(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_statePost_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn transition_matrix(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_transitionMatrix(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_transition_matrix(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_transitionMatrix_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn control_matrix(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_controlMatrix(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_control_matrix(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_controlMatrix_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn measurement_matrix(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_measurementMatrix(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_measurement_matrix(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_measurementMatrix_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn process_noise_cov(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_processNoiseCov(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_process_noise_cov(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_processNoiseCov_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn measurement_noise_cov(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_measurementNoiseCov(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_measurement_noise_cov(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_measurementNoiseCov_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn error_cov_pre(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_errorCovPre(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_error_cov_pre(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_errorCovPre_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn gain(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_gain(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_gain(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_gain_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn error_cov_post(&mut self) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_errorCovPost(self.as_raw_KalmanFilter()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn set_error_cov_post(&mut self, val: core::Mat) -> Result<()> {
unsafe { sys::cv_KalmanFilter_set_errorCovPost_Mat(self.as_raw_KalmanFilter(), val.as_raw_Mat()) }.into_result()
}
pub fn default() -> Result<crate::video::KalmanFilter> {
unsafe { sys::cv_KalmanFilter_KalmanFilter() }.into_result().map(|ptr| crate::video::KalmanFilter { ptr })
}
pub fn new(dynam_params: i32, measure_params: i32, control_params: i32, _type: i32) -> Result<crate::video::KalmanFilter> {
unsafe { sys::cv_KalmanFilter_KalmanFilter_int_int_int_int(dynam_params, measure_params, control_params, _type) }.into_result().map(|ptr| crate::video::KalmanFilter { ptr })
}
pub fn init(&mut self, dynam_params: i32, measure_params: i32, control_params: i32, _type: i32) -> Result<()> {
unsafe { sys::cv_KalmanFilter_init_int_int_int_int(self.as_raw_KalmanFilter(), dynam_params, measure_params, control_params, _type) }.into_result()
}
pub fn predict(&mut self, control: &core::Mat) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_predict_Mat(self.as_raw_KalmanFilter(), control.as_raw_Mat()) }.into_result().map(|ptr| core::Mat { ptr })
}
pub fn correct(&mut self, measurement: &core::Mat) -> Result<core::Mat> {
unsafe { sys::cv_KalmanFilter_correct_Mat(self.as_raw_KalmanFilter(), measurement.as_raw_Mat()) }.into_result().map(|ptr| core::Mat { ptr })
}
}
pub trait SparseOpticalFlow: core::Algorithm {
#[inline(always)] fn as_raw_SparseOpticalFlow(&self) -> *mut c_void;
fn calc(&mut self, prev_img: &dyn core::ToInputArray, next_img: &dyn core::ToInputArray, prev_pts: &dyn core::ToInputArray, next_pts: &mut dyn core::ToInputOutputArray, status: &mut dyn core::ToOutputArray, err: &mut dyn core::ToOutputArray) -> Result<()> {
input_array_arg!(prev_img);
input_array_arg!(next_img);
input_array_arg!(prev_pts);
input_output_array_arg!(next_pts);
output_array_arg!(status);
output_array_arg!(err);
unsafe { sys::cv_SparseOpticalFlow_calc__InputArray__InputArray__InputArray__InputOutputArray__OutputArray__OutputArray(self.as_raw_SparseOpticalFlow(), prev_img.as_raw__InputArray(), next_img.as_raw__InputArray(), prev_pts.as_raw__InputArray(), next_pts.as_raw__InputOutputArray(), status.as_raw__OutputArray(), err.as_raw__OutputArray()) }.into_result()
}
}
pub trait SparsePyrLKOpticalFlow: crate::video::SparseOpticalFlow {
#[inline(always)] fn as_raw_SparsePyrLKOpticalFlow(&self) -> *mut c_void;
fn get_win_size(&self) -> Result<core::Size> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_getWinSize_const(self.as_raw_SparsePyrLKOpticalFlow()) }.into_result()
}
fn set_win_size(&mut self, win_size: core::Size) -> Result<()> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_setWinSize_Size(self.as_raw_SparsePyrLKOpticalFlow(), win_size) }.into_result()
}
fn get_max_level(&self) -> Result<i32> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_getMaxLevel_const(self.as_raw_SparsePyrLKOpticalFlow()) }.into_result()
}
fn set_max_level(&mut self, max_level: i32) -> Result<()> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_setMaxLevel_int(self.as_raw_SparsePyrLKOpticalFlow(), max_level) }.into_result()
}
fn get_term_criteria(&self) -> Result<core::TermCriteria> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_getTermCriteria_const(self.as_raw_SparsePyrLKOpticalFlow()) }.into_result().map(|ptr| core::TermCriteria { ptr })
}
fn set_term_criteria(&mut self, crit: &mut core::TermCriteria) -> Result<()> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_setTermCriteria_TermCriteria(self.as_raw_SparsePyrLKOpticalFlow(), crit.as_raw_TermCriteria()) }.into_result()
}
fn get_flags(&self) -> Result<i32> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_getFlags_const(self.as_raw_SparsePyrLKOpticalFlow()) }.into_result()
}
fn set_flags(&mut self, flags: i32) -> Result<()> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_setFlags_int(self.as_raw_SparsePyrLKOpticalFlow(), flags) }.into_result()
}
fn get_min_eig_threshold(&self) -> Result<f64> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_getMinEigThreshold_const(self.as_raw_SparsePyrLKOpticalFlow()) }.into_result()
}
fn set_min_eig_threshold(&mut self, min_eig_threshold: f64) -> Result<()> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_setMinEigThreshold_double(self.as_raw_SparsePyrLKOpticalFlow(), min_eig_threshold) }.into_result()
}
}
impl dyn SparsePyrLKOpticalFlow + '_ {
pub fn create(win_size: core::Size, max_level: i32, crit: &core::TermCriteria, flags: i32, min_eig_threshold: f64) -> Result<types::PtrOfSparsePyrLKOpticalFlow> {
unsafe { sys::cv_SparsePyrLKOpticalFlow_create_Size_int_TermCriteria_int_double(win_size, max_level, crit.as_raw_TermCriteria(), flags, min_eig_threshold) }.into_result().map(|ptr| types::PtrOfSparsePyrLKOpticalFlow { ptr })
}
}