Table of Contents

Method Compute

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Compute(InputArray, InputArray, Flags, int)

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 Compute(InputArray data, InputArray mean, PCA.Flags flags, int maxComponents = 0)

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. (Flags)

maxComponents int

maximum number of components that PCA should retain; by default, all the components are retained.

Returns

PCA