summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/segmNN.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/segmNN.cc')
-rw-r--r--2004/i/nono/src/ovision/segmNN.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/2004/i/nono/src/ovision/segmNN.cc b/2004/i/nono/src/ovision/segmNN.cc
index c1d1b75..9d24922 100644
--- a/2004/i/nono/src/ovision/segmNN.cc
+++ b/2004/i/nono/src/ovision/segmNN.cc
@@ -24,6 +24,7 @@ SegmNN::SegmNN(Img *img, OConfig *config) {
node = NULL;
index = NULL;
+ freq = NULL;
tabSegm = NULL;
}
@@ -60,8 +61,15 @@ void SegmNN::BuildNN(int nbOutput, int loadFromFile) {
}
else {
// Charge les poids du NN et l'index des couleurs
- node = config->node;
- index = config->index;
+ delete [] node;
+ node = new unsigned char[nbOutput*3];
+ for (int i = 0; i<nbOutput*3; i++)
+ node[i] = config->node[i];
+ delete [] index;
+ index = new int[nbOutput];
+ for (int i = 0; i<nbOutput; i++)
+ index[i] = config->index[i];
+ freq = new unsigned int[nbOutput];
}
return;
}
@@ -70,11 +78,11 @@ void SegmNN::BuildNN(int nbOutput, int loadFromFile) {
srand((unsigned)time(0));
// Initialisation des noeuds du NN
- if (node) delete [] node;
+ delete [] node;
node = new unsigned char[nbOutput*3];
- if (index) delete [] index;
+ delete [] index;
index = new int[nbOutput];
- if (freq) delete [] freq;
+ delete [] freq;
freq = new unsigned int[nbOutput];
@@ -89,6 +97,7 @@ void SegmNN::BuildNN(int nbOutput, int loadFromFile) {
else if (node[i*3+j] > 220) node[i*3+j] = 220;
}
}
+ cout << "oooooo\n";
}