PCAComputeAsync function

Future<(Mat, Mat, Mat)> PCAComputeAsync(
  1. InputArray data,
  2. InputOutputArray mean, {
  3. int maxComponents = 0,
})

PCACompute performs PCA.

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

Note: Calling with maxComponents == 0 (opencv default) will cause all components to be retained.

For further details, please see: https://docs.opencv.org/4.x/d2/de8/group__core__array.html#ga27a565b31d820b05dcbcd47112176b6e

Implementation

Future<(Mat mean, Mat eigenvalues, Mat eigenvectors)> PCAComputeAsync(
  InputArray data,
  InputOutputArray mean, {
  int maxComponents = 0,
}) async =>
    cvRunAsync2((callback) => cffi.core_PCACompute_Async(data.ref, mean.ref, maxComponents, callback),
        (completer, p, p1) {
      completer.complete(
        (
          mean,
          Mat.fromPointer(p.cast<cvg.Mat>()),
          Mat.fromPointer(p1.cast<cvg.Mat>()),
        ),
      );
    });