summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/space.h
blob: a10a913aa9443cdf09724f1e71a186cb7b073b6a (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
65
66
67
68
69
70
#ifndef space_h
#define space_h
// space.h - Space class
// nono - Programme du robot Efrei Robotique I1-I2 2004
// Copyright (C) 2004 Olivier Gaillard

#include <vector>
#include <iostream>

#define POS_ROBOT_ETALONNOGE_X 300

#include "group.h"

struct SETUP_POINT
{
    int x, y;
    int distx, disty;
};


/// Etalonnage des distances et localisation de la balle
class Space
{
    /// tableau d'index des distances
    uint *tabX;
    uint *tabY;

    /// liste des distances etalonnees
    std::vector<SETUP_POINT> setupTab; 

    /// hautdddeur de l'image
    int imgHeight; 

    /// largeur de l'image
    int imgWidth; 

    /// coeff pour l'approximation de la profondeur
    double aY, bY, cY;

    /// coeff pour l'approximation de l'horizontal
    double aX, bX;

  public:

    // Constructeur
    Space (int width, int height);

    // Destructeur
    ~Space ();

    /// Affiche les tables de correspondances de distances
    void ShowTab ();    

    /// Position d'un objet dans le referentiel du robot
    void GetLoc(int locImgX, int locImgY, int &locX, int &locY);

    /// Ajoute un point pour l'etalonnage
    void AddSetupPoint(int x, int y, int distx, int disty);

    /// Etalonnage des distances
    int Setup();
  protected:
    /// Calcul du determinant
    int Determinant(int matrix[][4]);
    
    /// Calcul du determinant caracteristique
    int CaracteristicDeterminant(int matrix[][4], int numRow);
};

#endif // space_h