From 2f7c926670775fabf887e748f06a198369268aa8 Mon Sep 17 00:00:00 2001 From: berak Date: Tue, 8 Sep 2015 14:45:13 +0200 Subject: [PATCH] remove usage of obsolete _dataAsRows flag --- modules/core/include/opencv2/core.hpp | 10 +++++----- modules/core/src/lda.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/core/include/opencv2/core.hpp b/modules/core/include/opencv2/core.hpp index d7289a627f..40d6782067 100644 --- a/modules/core/include/opencv2/core.hpp +++ b/modules/core/include/opencv2/core.hpp @@ -2381,8 +2381,7 @@ class CV_EXPORTS LDA { public: /** @brief constructor - Initializes a LDA with num_components (default 0) and specifies how - samples are aligned (default dataAsRow=true). + Initializes a LDA with num_components (default 0). */ explicit LDA(int num_components = 0); @@ -2413,15 +2412,17 @@ public: */ ~LDA(); - /** Compute the discriminants for data in src and labels. + /** Compute the discriminants for data in src (row aligned) and labels. */ void compute(InputArrayOfArrays src, InputArray labels); /** Projects samples into the LDA subspace. + src may be one or more row aligned samples. */ Mat project(InputArray src); /** Reconstructs projections from the LDA subspace. + src may be one or more row aligned projections. */ Mat reconstruct(InputArray src); @@ -2437,11 +2438,10 @@ public: static Mat subspaceReconstruct(InputArray W, InputArray mean, InputArray src); protected: - bool _dataAsRow; + bool _dataAsRow; // unused, but needed for 3.0 ABI compatibility. int _num_components; Mat _eigenvectors; Mat _eigenvalues; - void lda(InputArrayOfArrays src, InputArray labels); }; diff --git a/modules/core/src/lda.cpp b/modules/core/src/lda.cpp index 5e20b5e6a1..76e8db29a1 100644 --- a/modules/core/src/lda.cpp +++ b/modules/core/src/lda.cpp @@ -937,9 +937,9 @@ public: // Linear Discriminant Analysis implementation //------------------------------------------------------------------------------ -LDA::LDA(int num_components) : _num_components(num_components) { } +LDA::LDA(int num_components) : _dataAsRow(true), _num_components(num_components) { } -LDA::LDA(InputArrayOfArrays src, InputArray labels, int num_components) : _num_components(num_components) +LDA::LDA(InputArrayOfArrays src, InputArray labels, int num_components) : _dataAsRow(true), _num_components(num_components) { this->compute(src, labels); //! compute eigenvectors and eigenvalues } @@ -1106,14 +1106,14 @@ void LDA::compute(InputArrayOfArrays _src, InputArray _lbls) { } } -// Projects samples into the LDA subspace. +// Projects one or more row aligned samples into the LDA subspace. Mat LDA::project(InputArray src) { - return subspaceProject(_eigenvectors, Mat(), _dataAsRow ? src : src.getMat().t()); + return subspaceProject(_eigenvectors, Mat(), src); } -// Reconstructs projections from the LDA subspace. +// Reconstructs projections from the LDA subspace from one or more row aligned samples. Mat LDA::reconstruct(InputArray src) { - return subspaceReconstruct(_eigenvectors, Mat(), _dataAsRow ? src : src.getMat().t()); + return subspaceReconstruct(_eigenvectors, Mat(), src); } }