summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/n2ml.cc
blob: 4b61852b461c3cf058ea1a3aed672bc80e96cd6a (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
// n2ml.cc 
// robert - Programme du robot APBteam
// Copyright (C) 2005 Olivier Gaillard
#include <iostream>
#include <vector>
#include <string>

#include "imgInterface.hh"
#include "segmLearn.hh"
#include "oconfig.hh"


int main(int argc, char **argv) 
{
    // Usage
    if (argc < 4)
      {
	std::cout << "Usage : n2ml <output number> {rgb| yuv} <file list>" << std::endl;
	return 1;
      }
    int nbOutput = atoi(argv[1]);
    // Parse de la ligne de commande
    std::string *str = new std::string (argv[2]);
    Image::PixelFormat pf;
    if (*str == "rgb") pf = Image::rgb;
    else if (*str == "yuv") pf = Image::yuv;
    else std::cerr << "Wrong pixelformat\n";
    std::vector<std::string> list;
    while (argc-- > 3)
      {
	delete str;
	str = new std::string (argv[argc]);
	list.push_back(*str);
      }
    // Initialisation des classes
    OConfig oconfig;
    Img img;
    img.loadMultipeRaw (list, pf, oconfig.width, oconfig.height);
    SegmLearn segm;
    segm.buildNN (nbOutput, Segm::generate);
    segm.trainNN (&img);
    segm.save ();
}