summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/hotelling.hh
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/hotelling.hh')
-rw-r--r--2005/i/robert/src/ovision/see/hotelling.hh65
1 files changed, 65 insertions, 0 deletions
diff --git a/2005/i/robert/src/ovision/see/hotelling.hh b/2005/i/robert/src/ovision/see/hotelling.hh
new file mode 100644
index 0000000..e3ac8bb
--- /dev/null
+++ b/2005/i/robert/src/ovision/see/hotelling.hh
@@ -0,0 +1,65 @@
+// robert - programme du robot 2005
+//
+// Copyright (C) 2005 Olivier Gaillard
+//
+// Robot APB Team/Efrei 2005.
+// Web: http://assos.efrei.fr/robot/
+// Email: robot AT efrei DOT fr
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef hotelling_h
+#define hotelling_h
+
+#include <vector>
+
+#include "oconfig.hh"
+
+/// Detecte l'orientation principale d'une masse de données
+class Hotelling
+{
+ /// Classe oconfig
+ OConfig *oconfig_;
+ /// Matrice de covariance
+ uint8_t covMatrix_[2][2];
+ /// Données à traitées ajustées
+ uint8_t *data_[2];
+ /// Nombre d'échantillons de données
+ unsigned dataSize_;
+ /// Moyenne de la première et deuxième composante
+ int meanX_, meanY_;
+ /// EigenVectors
+ uint8_t e1_[2], e2_[2];
+
+ public:
+ /// Constructeur
+ Hotelling (const std::vector<uint8_t[2]> &dataList);
+ /// Destructeur
+ ~Hotelling (void);
+ /// Accessors
+ void getEigenVectors (uint8_t* &e1, uint8_t* &e2)
+ {e1 = e1_; e2 = e2_;}
+ void getPCA (uint8_t* &pca) {pca = e1_;}
+
+ private:
+ /// Calcul de la matrice de covariance
+ uint8_t* cov ();
+ /// Calcul de la moyenne
+ void mean (const std::vector<uint8_t[2]> &dataList);
+ /// Calcul des eigenvectors
+ void eigenVectors ();
+};
+
+#endif // hotelling_h