summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/comm.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/comm.cc')
-rw-r--r--2004/i/nono/src/ovision/comm.cc59
1 files changed, 45 insertions, 14 deletions
diff --git a/2004/i/nono/src/ovision/comm.cc b/2004/i/nono/src/ovision/comm.cc
index 116b7d8..a47bc02 100644
--- a/2004/i/nono/src/ovision/comm.cc
+++ b/2004/i/nono/src/ovision/comm.cc
@@ -12,15 +12,12 @@ using namespace std;
#include "comm.h"
#include "adjust.h"
-#include <IL/il.h>
+#include "ovision/convertImg.h"
/// Constructeur
/// @param *filename nom de l'image a utiliser
Comm::Comm(char *filename)
{
- // Initialisation de IL
- ilInit();
-
// Copie du nom de l'image courante
strcpy(fname, filename);
@@ -65,7 +62,7 @@ Comm::Comm(char *filename)
data[i] = new unsigned char[img.nbPixels*3];
// Initialisation de la segmentation
- segm = new SegmNN(&img);
+ segm = new SegmLearn (&img);
segm->BuildNN(oconfig->nn_NbCouleurs, LOAD_FROM_FILE);
group = new Group(&img, segm);
@@ -83,9 +80,6 @@ Comm::Comm(char *filename)
/// Destructeur
Comm::~Comm()
{
- // Fermeture de DevIL
- ilShutDown();
-
// Liberation de la memoire
delete oconfig;
delete segm;
@@ -110,17 +104,22 @@ Comm::SegmAndGroup()
{
segm->Segm();
- // Creation de l'image segmentee
- img.DoImg(segm->tabSegm , data[0]);
-
// Creation des groupes
if (group) delete group;
group = new Group(&img, segm);
group->JumpPoints(oconfig->groupColor, oconfig->goalColor);
+ group->ShowZones ();
group->TabOut();
+ group->TabOut(GOAL, false);
+// img.WriteSegm ("out.rgb", group->tabOut);
img.DoImg(group->tabOut, data[1]);
+ // Creation de l'image segmentee
+ img.AddGroupToDisplay (segm->tabSegm, group);
+ img.DoImg(segm->tabSegm , data[0]);
+
+
tex[2] = LoadImage(img.width, img.height, data[0], tex[2]);
tex[5] = LoadImage(img.width, img.height, data[1], tex[5]);
}
@@ -330,7 +329,9 @@ Comm::ExecuteUiCmds(char *buffer)
tex[0] = LoadImage(img.width, img.height, imgLeft[0], tex[0]);
// Conversion en YUV et stockage
- img.RGBtoYUV();
+ ConvertImg convert;
+ convert.RGBtoYUV (img);
+
tex[3] = LoadImage(img.width, img.height, img.tabData, tex[3]);
// NN oconfigure en RGB ou YUV ?
@@ -404,8 +405,16 @@ Comm::ExecuteUiCmds(char *buffer)
cout << img.yuv << endl;
// Conversion en YUV et stockage
img.LoadRGB(fname, 0, 360, 296);
- if (yuvSwitch%3 == 1) img.YUVtoRGB();
- else if (yuvSwitch%3 == 2) img.RGBtoYUV();
+ if (yuvSwitch%3 == 1)
+ {
+ ConvertImg convert;
+ convert.YUVtoRGB (img);
+ }
+ else if (yuvSwitch%3 == 2)
+ {
+ ConvertImg convert;
+ convert.RGBtoYUV (img);
+ }
delete[] imgLeft[1];
imgLeft[1] = new unsigned char[img.nbPixels*3];
memcpy(imgLeft[1], img.tabData, sizeof(char)*img.nbPixels*3);
@@ -416,6 +425,28 @@ Comm::ExecuteUiCmds(char *buffer)
case 'z':
group->ShowZones();
break;
+
+ case 'f':
+ {
+ char buf[20];
+ ZONE *pCur = group->zoneListBall;
+ write (fifo, "Groupes balles:\n", 20);
+ while(pCur) {
+ sprintf(buf, "%u %i %i %i %i\n", pCur->idColor, pCur->xmin, pCur->xmax, pCur->ymin, pCur->ymax);
+ write (fifo, buf, 20);
+ pCur = pCur->next;
+ }
+
+ pCur = group->zoneListGoal;
+ write (fifo, "Groupes poteaux:\n", 20);
+ while(pCur) {
+ sprintf(buf, "%u %i %i %i %i\n", pCur->idColor, pCur->xmin, pCur->xmax, pCur->ymin, pCur->ymax);
+ write (fifo, buf, 20);
+ pCur = pCur->next;
+ }
+ write (fifo, "end\n", 20);
+ }
+ break;
}
DrawGLScene();