Table of Contents

Method ComputeVar

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

ComputeVar(InputArray, InputArray, Flags, double)

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.

public PCA ComputeVar(InputArray data, InputArray mean, PCA.Flags flags, double retainedVariance)

Parameters

data InputArray

input samples stored as the matrix rows or as the matrix columns.

mean InputArray

optional mean value; if the matrix is empty (noArray()), the mean is computed from the data.

flags PCA.Flags

operation flags; currently the parameter is only used to specify the data layout. (PCA::Flags)

retainedVariance double

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.

Returns

PCA