#include "image/raw_loader.h" #include "map.h" #include "oconfig.h" #include "group.h" #include "space.h" #include "segmTable.h" #include "segmLearn.h" #include #include #include #include static struct timeval _tstart, _tend; static struct timezone tz; void tstart(void) { gettimeofday(&_tstart, &tz); } void tend(void) { gettimeofday(&_tend,&tz); } double tval() { double t1, t2; t1 = (double)_tstart.tv_sec + (double)_tstart.tv_usec/(1000*1000); t2 = (double)_tend.tv_sec + (double)_tend.tv_usec/(1000*1000); return t2-t1; } int main() { ///////////////////////////////////////////////////////////////////////////////////////// /// Initialisation des classes tstart (); OConfig oconfig("rc/vision.conf"); Img img; RawLoader rawLoader("../src/ovision/test.rgb", 360, 296, ImageLoader::rgb); img.load(rawLoader); Space space(img.width, img.height); space.AddSetupPoint (356, 23, 300, 300); space.AddSetupPoint (283, 171, 600, 600); space.AddSetupPoint (253, 234, 1000, 900); space.Setup (0.00603759, 0.593767, 291.474); SegmTable segmNN(&img); segmNN.BuildNN(oconfig.nn_NbCouleurs, LOAD_FROM_FILE); segmNN.DoColorTable (); Group group(&img, &segmNN); Map map(&space); tend (); std::cout << "Initialisation:\t" << tval () << std::endl; ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////// /// Prends une image a partir de la camera et l'analyse tstart (); //segmNN.Segm(); tend (); std::cout << "Segmentation:\t" << tval () << std::endl; tstart (); group.JumpPoints(oconfig.groupColor); tend (); std::cout << "Find Group:\t" << tval () << std::endl; group.ShowZones (); tstart (); if (group.zoneListBall) { int x,y; x = group.zoneListBall->centerx; y = img.height - group.zoneListBall->centery; space.GetLoc(x, y, x, y); tend (); std::cout << "Map:\t\t" << tval () << std::endl; } ///////////////////////////////////////////////////////////////////////////////////////// }