// 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 #include "img.h" #include "oconfig.h" // Constantes #define MIN 0 #define MAX 1 #define UNDEFINED 254 /// Constantes pour la creation du NN #define LOAD_FROM_FILE 1 #define GENERATE 0 /// Segmente l'image et cree un tableau contenant des valeurs segmentees, creation du reseau de neurones et apprentissage class SegmNN { public: /// 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; // tableau de poids du NN unsigned char *node; /// Affiche la valeur des poids du NN void ShowNodes(); /// Cree le NN void BuildNN (int nbOutput, int loadFromFile = true); /// Segmentation de l'image void Segm (); /// Segmentation de l'image permettant d'isoler une couleur void Segm (int numColor); /// Renvoie le code la couleur segmentee 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