summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/vision/test_vision.cc
blob: 91a5f7fc4e0123a9fb121dce382834e24e3dc166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// test_vision.cc
// buzz - Programme du robot Efrei Robotique I1-I2 2003
// Copyright (C) 2003 Nicolas Schodet
//
#include "image.h"

#include <unistd.h>
extern "C" {
#include <ppm.h>
};

int
main (int argc, char **argv)
{
    Image *i;
    Camera *c;
    Thresholds *t;
    ppm_init (&argc, argv);
    try
      {
	t = new Thresholds ("rc/vision/palets.rgb");
	c = new Camera ();
	i = new Image (c, t);
	for (int j = 0; j < 5; ++j)
	  {
	    if (i->reread ())
	      {
		char s[256];
		i->dumpGroups ();
		sprintf (s, "dump%d.ppm", j);
		i->dump (s);
	      }
	    sleep (1);
	  }
	delete i;
	delete c;
	delete t;
      }
    catch (const char *s)
      {
	fprintf (stderr, "test_vision: %s\n", s);
	return 1;
      }
    return 0;
}