summaryrefslogtreecommitdiff
path: root/2004/i/nono/src/ovision/testmap.cc
blob: e7675d4f99bd1f70bf5cdbe45798ea56aad17d8b (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
47
48
49
50
51
52
53
54
55
56
#include "image/raw_loader.h"
#include "map.h"
#include "oconfig.h"
#include "group.h"
#include "space.h"
//#include "imgFile.h"
int 
main()
{
    OConfig oconfig("rc/vision.conf");

    //    ImgFile img;
    //    img.ReadRaw("im.jpg");
    //

    Img img;

    //    RawLoader rawLoader("im2000.rgb", 360, 296, ImageLoader::rgb);
    //    img.load(rawLoader);

    Video4Linux::ColorSpace cs;
    cs = Video4Linux::yuv;
    Video4Linux vid ("/dev/video", cs);
    vid.calibrate ();
    int w, h;
    vid.getSize (w, h);
    std::cout << w << ' ' << h << std::endl;
    int s;
    s = vid.getBufSize ();
    unsigned char *buf = new unsigned char[s];
    s = vid.read (buf, s);

    img.RGBtoYUV();
    //    img.WriteRGB("test.rgb");

    Space space(img.width, img.height);
    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);
    
    segmNN.Segm();
    group.JumpPoints(oconfig.groupColor);
   // group.ShowZones();

    map.AddBallsToMap(&group);
//    map.ShowBalls();
}