summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/hotelling.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/hotelling.cc')
-rw-r--r--2005/i/robert/src/ovision/see/hotelling.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/2005/i/robert/src/ovision/see/hotelling.cc b/2005/i/robert/src/ovision/see/hotelling.cc
new file mode 100644
index 0000000..b492510
--- /dev/null
+++ b/2005/i/robert/src/ovision/see/hotelling.cc
@@ -0,0 +1,64 @@
+// hotelling.cc - Classe Hotelling
+// robert - Programme du robot APBteam
+// Copyright (C) 2005 Olivier Gaillard
+
+#include <iostream>
+
+#include "hotelling.hh"
+
+/// Constructeur
+Hotelling::Hotelling (const std::vector<uint8_t[2]> &dataList)
+{
+ e1_[0] = 0; e1_[1] = 0; e2_[0] = 0; e2_[1] = 0;
+ oconfig_ = OConfig::getInstance ();
+
+ dataSize_ = dataList.size ();
+ if (dataSize_ == 0)
+ {
+ meanX_ = meanY_ = 0;
+ }
+ else
+ {
+ mean (dataList);
+ data_[0] = new uint8_t[dataSize_];
+ data_[1] = new uint8_t[dataSize_];
+ }
+
+}
+
+/// Destructeur
+Hotelling::~Hotelling (void)
+{
+ delete [] covMatrix_;
+ delete [] data_;
+}
+
+/// Calcul de la matrice de covariance
+uint8_t*
+Hotelling::cov ()
+{
+ uint8_t *tab;
+ return tab;
+}
+
+/// Calcul de la moyenne des deux composantes
+void
+Hotelling::mean (const std::vector<uint8_t[2]> &dataList)
+{
+ meanX_ = meanY_ = 0;
+ for (std::vector<uint8_t[2]>::const_iterator iter = dataList.begin ();
+ iter != dataList.end (); ++iter)
+ {
+ meanX_ += (*iter)[0];
+ meanY_ += (*iter)[1];
+ }
+ meanX_ /= dataSize_;
+ meanY_ /= dataSize_;
+}
+
+/// Calcul des eigenvectors
+void
+Hotelling::eigenVectors ()
+{
+}
+