opencv::video

Struct KalmanFilter

Source
pub struct KalmanFilter { /* private fields */ }
Expand description

Kalman filter class.

The class implements a standard Kalman filter http://en.wikipedia.org/wiki/Kalman_filter, Welch95 . However, you can modify transitionMatrix, controlMatrix, and measurementMatrix to get an extended Kalman filter functionality.

Note: In C API when CvKalman* kalmanFilter structure is not needed anymore, it should be released with cvReleaseKalman(&kalmanFilter)

Implementations§

Source§

impl KalmanFilter

Source

pub fn default() -> Result<KalmanFilter>

Source

pub fn new( dynam_params: i32, measure_params: i32, control_params: i32, typ: i32, ) -> Result<KalmanFilter>

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

§Parameters
  • dynamParams: Dimensionality of the state.
  • measureParams: Dimensionality of the measurement.
  • controlParams: Dimensionality of the control vector.
  • type: Type of the created matrices that should be CV_32F or CV_64F.
§C++ default parameters
  • control_params: 0
  • typ: CV_32F
Source

pub fn new_def(dynam_params: i32, measure_params: i32) -> Result<KalmanFilter>

@overload

§Parameters
  • dynamParams: Dimensionality of the state.
  • measureParams: Dimensionality of the measurement.
  • controlParams: Dimensionality of the control vector.
  • type: Type of the created matrices that should be CV_32F or CV_64F.
§Note

This alternative version of [new] function uses the following default values for its arguments:

  • control_params: 0
  • typ: CV_32F

Trait Implementations§

Source§

impl Boxed for KalmanFilter

Source§

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

Wrap the specified raw pointer Read more
Source§

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

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

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

Return the underlying raw pointer. Read more
Source§

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

Return the underlying mutable raw pointer Read more
Source§

impl Debug for KalmanFilter

Source§

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

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

impl Drop for KalmanFilter

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl KalmanFilterTrait for KalmanFilter

Source§

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

Source§

fn set_state_pre(&mut self, val: Mat)

predicted state (x’(k)): x(k)=Ax(k-1)+Bu(k)
Source§

fn set_state_post(&mut self, val: Mat)

corrected state (x(k)): x(k)=x’(k)+K(k)(z(k)-Hx’(k))
Source§

fn set_transition_matrix(&mut self, val: Mat)

state transition matrix (A)
Source§

fn set_control_matrix(&mut self, val: Mat)

control matrix (B) (not used if there is no control)
Source§

fn set_measurement_matrix(&mut self, val: Mat)

measurement matrix (H)
Source§

fn set_process_noise_cov(&mut self, val: Mat)

process noise covariance matrix (Q)
Source§

fn set_measurement_noise_cov(&mut self, val: Mat)

measurement noise covariance matrix (R)
Source§

fn set_error_cov_pre(&mut self, val: Mat)

priori error estimate covariance matrix (P’(k)): P’(k)=A*P(k-1)*At + Q)
Source§

fn set_gain(&mut self, val: Mat)

Kalman gain matrix (K(k)): K(k)=P’(k)Htinv(H*P’(k)*Ht+R)
Source§

fn set_error_cov_post(&mut self, val: Mat)

posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P’(k)
Source§

fn set_temp1(&mut self, val: Mat)

Source§

fn set_temp2(&mut self, val: Mat)

Source§

fn set_temp3(&mut self, val: Mat)

Source§

fn set_temp4(&mut self, val: Mat)

Source§

fn set_temp5(&mut self, val: Mat)

Source§

fn init( &mut self, dynam_params: i32, measure_params: i32, control_params: i32, typ: i32, ) -> Result<()>

Re-initializes Kalman filter. The previous content is destroyed. Read more
Source§

fn init_def(&mut self, dynam_params: i32, measure_params: i32) -> Result<()>

Re-initializes Kalman filter. The previous content is destroyed. Read more
Source§

fn predict(&mut self, control: &impl MatTraitConst) -> Result<Mat>

Computes a predicted state. Read more
Source§

fn predict_def(&mut self) -> Result<Mat>

Computes a predicted state. Read more
Source§

fn correct(&mut self, measurement: &impl MatTraitConst) -> Result<Mat>

Updates the predicted state from the measurement. Read more
Source§

impl KalmanFilterTraitConst for KalmanFilter

Source§

fn as_raw_KalmanFilter(&self) -> *const c_void

Source§

fn state_pre(&self) -> Mat

predicted state (x’(k)): x(k)=Ax(k-1)+Bu(k)
Source§

fn state_post(&self) -> Mat

corrected state (x(k)): x(k)=x’(k)+K(k)(z(k)-Hx’(k))
Source§

fn transition_matrix(&self) -> Mat

state transition matrix (A)
Source§

fn control_matrix(&self) -> Mat

control matrix (B) (not used if there is no control)
Source§

fn measurement_matrix(&self) -> Mat

measurement matrix (H)
Source§

fn process_noise_cov(&self) -> Mat

process noise covariance matrix (Q)
Source§

fn measurement_noise_cov(&self) -> Mat

measurement noise covariance matrix (R)
Source§

fn error_cov_pre(&self) -> Mat

priori error estimate covariance matrix (P’(k)): P’(k)=A*P(k-1)*At + Q)
Source§

fn gain(&self) -> Mat

Kalman gain matrix (K(k)): K(k)=P’(k)Htinv(H*P’(k)*Ht+R)
Source§

fn error_cov_post(&self) -> Mat

posteriori error estimate covariance matrix (P(k)): P(k)=(I-K(k)*H)*P’(k)
Source§

fn temp1(&self) -> Mat

Source§

fn temp2(&self) -> Mat

Source§

fn temp3(&self) -> Mat

Source§

fn temp4(&self) -> Mat

Source§

fn temp5(&self) -> Mat

Source§

impl Send for KalmanFilter

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 unsafe in a general case as it leads to having non-exclusive mutable access to the internal data, but it can 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>,

Source§

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>,

Source§

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.