summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/testsave.cc
diff options
context:
space:
mode:
Diffstat (limited to '2004/i/nono/src/ovision/testsave.cc')
-rw-r--r--2004/i/nono/src/ovision/testsave.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/2004/i/nono/src/ovision/testsave.cc b/2004/i/nono/src/ovision/testsave.cc
new file mode 100644
index 0000000..8bf5191
--- /dev/null
+++ b/2004/i/nono/src/ovision/testsave.cc
@@ -0,0 +1,59 @@
+
+#include "video4linux/video4linux.h"
+#include "map.h"
+#include "oconfig.h"
+#include "group.h"
+#include "space.h"
+
+int
+main()
+{
+ /////////////////////////////////////////////////////////////////////////////////////////
+ /// Initialisation des classes
+ OConfig oconfig("rc/vision.conf");
+
+ Img img;
+ Video4Linux::ColorSpace cs;
+ cs = Video4Linux::rgb;
+ Video4Linux v4l("/dev/video", cs, 50000);
+ v4l.calibrate ();
+
+ Space space(img.width, img.height, &oconfig);
+ space.AddSetupPoint (109, 36, -150, 900);
+ space.AddSetupPoint (84, 102, -150, 600);
+ space.AddSetupPoint (50, 259, -150, 300);
+ space.Setup ();
+
+ SegmNN segmNN(&img, &oconfig);
+ segmNN.BuildNN(oconfig.nn_NbCouleurs, LOAD_FROM_FILE);
+
+ Group group(&img, &segmNN);
+
+ Map map(&oconfig, &space);
+ /////////////////////////////////////////////////////////////////////////////////////////
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////
+ /// Prends une image a partir de la camera et l'analyse
+ char filename[30];
+ int i = 0;
+ while (1)
+ {
+ std::cout << "-----------------------------------------------------------------" << std::endl;
+ std::cout << "image n°" << i << std::endl;
+ img.load(v4l);
+ sprintf(filename, "test%i.rgb", i);
+ img.WriteRGB(filename);
+ segmNN.Segm();
+ group.JumpPoints(oconfig.groupColor);
+ group.ShowZones();
+ std::cout << "-------------\n" << std::endl;
+ map.AddBallsToMap(&group);
+ map.ShowBalls();
+
+ getchar();
+ i++;
+ }
+ /////////////////////////////////////////////////////////////////////////////////////////
+}
+