summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/segmNN.h
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/segmNN.h')
-rw-r--r--2004/i/nono/src/ovision/segmNN.h88
1 files changed, 52 insertions, 36 deletions
diff --git a/2004/i/nono/src/ovision/segmNN.h b/2004/i/nono/src/ovision/segmNN.h
index 3a2bfa2..102eaf2 100644
--- a/2004/i/nono/src/ovision/segmNN.h
+++ b/2004/i/nono/src/ovision/segmNN.h
@@ -1,8 +1,27 @@
+// nono2 - programme du robot 2005
+//
+// Copyright (C) 2004 Olivier Gaillard
+//
+// Robot APB Team/Efrei 2004.
+// 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 segmNN_h
#define segmNN_h
-// segmNN.h - classe Segmentation
-// nono - Programme du robot Efrei Robotique I1-I2 2004
-// Copyright (C) 2004 Olivier Gaillard
#include "img.h"
#include "oconfig.h"
@@ -20,57 +39,54 @@
/// Segmente l'image et cree un tableau contenant des valeurs segmentees, creation du reseau de neurones et apprentissage
class SegmNN
{
- // Classe image
- Img *img;
-
- // Classe config
- OConfig *oconfig;
-
public:
- // tableau avec couleurs segmentees
- unsigned char *tabSegm;
-
- // tableau de poids du NN
- unsigned char *node;
+ /// Constructeur
+ SegmNN (Img *img);
+ /// Destructeur
+ virtual ~SegmNN (void);
+
+ // tableau avec couleurs segmentées
+ unsigned char *tabSegm;
+
// index des couleurs pour melanger (merge) les couleurs
int *index;
- // memorise la popularite des noeuds pour enlever les sorties inefficaces
- unsigned int *freq;
-
- // nb de couleurs a differencier
- int nbOutput;
-
- /// Constructeur
- SegmNN (Img *img);
+ // tableau de poids du NN
+ unsigned char *node;
- /// Destructeur
- ~SegmNN (void);
/// Affiche la valeur des poids du NN
void ShowNodes();
/// Cree le NN
- void BuildNN(int nbOutput, int loadFromFile);
-
- /// Apprentissage du NN
- void TrainNN();
+ void BuildNN (int nbOutput, int loadFromFile = true);
/// Segmentation de l'image
- void Segm();
+ void Segm ();
/// Segmentation de l'image permettant d'isoler une couleur
- void Segm(int numColor);
+ void Segm (int numColor);
- /// Entraine plusieurs reseaux de neurones avec des parametres differents
- void TestNN();
-
/// Renvoie le code la couleur segmentee
- unsigned char FindColorNN(unsigned char *x, bool testUndefined = 0);
-
+ unsigned char FindColorNN(unsigned char *x, bool testOutputMax = false);
+
+ /// Donne la couleur à partir du tableau
+ virtual unsigned char GiveColor (unsigned char *x, bool testOutputMax = false, bool indexProcess = false) = 0;
+
protected:
-
+ // Classe image
+ Img *img;
+
+ // Classe config
+ OConfig *oconfig;
+
+ // nb de couleurs a differencier
+ int nbOutput;
+
+ /// Renvoie la sortie ayant le plus haut niveau
+ int WinnerOutput (unsigned char *x);
+
};
#endif // segmNN_h