pub trait PCATrait: PCATraitConst {
    fn as_raw_mut_PCA(&mut self) -> *mut c_void;

    fn set_eigenvectors(&mut self, val: Mat) { ... }
    fn set_eigenvalues(&mut self, val: Mat) { ... }
    fn set_mean(&mut self, val: Mat) { ... }
    fn apply(
        &mut self,
        data: &dyn ToInputArray,
        mean: &dyn ToInputArray,
        flags: i32,
        max_components: i32
    ) -> Result<PCA> { ... } fn apply_1(
        &mut self,
        data: &dyn ToInputArray,
        mean: &dyn ToInputArray,
        flags: i32,
        retained_variance: f64
    ) -> Result<PCA> { ... } fn read(&mut self, fn_: &FileNode) -> Result<()> { ... } }

Required Methods§

Provided Methods§

eigenvectors of the covariation matrix

eigenvalues of the covariation matrix

mean value subtracted before the projection and added after the back projection

performs %PCA

The operator performs %PCA of the supplied dataset. It is safe to reuse the same PCA structure for multiple datasets. That is, if the structure has been previously used with another dataset, the existing internal data is reclaimed and the new @ref eigenvalues, @ref eigenvectors and @ref mean are allocated and computed.

The computed @ref eigenvalues are sorted from the largest to the smallest and the corresponding @ref eigenvectors are stored as eigenvectors rows.

Parameters
  • data: input samples stored as the matrix rows or as the matrix columns.
  • mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
  • flags: operation flags; currently the parameter is only used to specify the data layout. (Flags)
  • maxComponents: maximum number of components that PCA should retain; by default, all the components are retained.
C++ default parameters
  • max_components: 0

performs %PCA

The operator performs %PCA of the supplied dataset. It is safe to reuse the same PCA structure for multiple datasets. That is, if the structure has been previously used with another dataset, the existing internal data is reclaimed and the new @ref eigenvalues, @ref eigenvectors and @ref mean are allocated and computed.

The computed @ref eigenvalues are sorted from the largest to the smallest and the corresponding @ref eigenvectors are stored as eigenvectors rows.

Parameters
  • data: input samples stored as the matrix rows or as the matrix columns.
  • mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
  • flags: operation flags; currently the parameter is only used to specify the data layout. (Flags)
  • maxComponents: maximum number of components that PCA should retain; by default, all the components are retained.
Overloaded parameters
  • data: input samples stored as the matrix rows or as the matrix columns.
  • mean: optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.
  • flags: operation flags; currently the parameter is only used to specify the data layout. (PCA::Flags)
  • retainedVariance: Percentage of variance that %PCA should retain. Using this parameter will let the %PCA decided how many components to retain but it will always keep at least 2.

load PCA objects

Loads @ref eigenvalues @ref eigenvectors and @ref mean from specified FileNode

Implementors§