summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/test_group.cc
blob: a9b4d944eb99fc0a78752d7d6a17c2da7cad2cf9 (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
// test_group.cc
// robert - Programme du robot APBteam
// Copyright (C) 2005 Olivier Gaillard

#include <iostream>
#include <vector>
#include <string>

#include "segmLearn.hh"
#include "segmTable.hh"
#include "colorTable.hh"
#include "oconfig.hh"
#include "group.hh"
#include "imgInterface.hh"

int 
main(int argc, char **argv) 
{
    /////////////////////////////////////////////////////////////////////////////////////////
    /// Initialisation des classes
    OConfig *oconfig_;
    try
      {
	oconfig_ = new OConfig;
      }
    catch (std::string &e)
      {
	std::cerr << e << std::endl;
	return 1;
      }
    ImgInterface img;
    img.loadRaw ("../runtime/shots/test.rgb", Image::rgb, 360, 296);
    SegmLearn segm;
    segm.buildNN (oconfig_->nnNbColor, Segm::loadFromFile);
    Group group(&img, &segm);
    /////////////////////////////////////////////////////////////////////////////////////////
    /// Initialise les couleurs � chercher 
    std::vector<ObjectColor> colorList;
    ObjectColor tmp;
    tmp.label = "ball";
    tmp.color = 4;
    colorList.push_back (tmp);
    /////////////////////////////////////////////////////////////////////////////////////////
    /// Cherche les groupes
    group.jumpPoints(colorList);
    group.showZones();
    ////////////////////////////////////////////////////////////////////////////////////////
    /// Cr�e une image pour afficher les groups 
    group.jumpPoints(colorList);
    std::vector<Zone> &test = group.getZoneList ();
    img.doGroupImg (test);
    img.doImg (img.getTabSegm ());
    img.writeRaw ("../runtime/shots/group.rgb", img.getTabOut ());
}