summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/hotelling.cc
blob: b4925106c3e84f87465038dc1b419929efa1a663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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 ()
{
}