segmentation
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
Functions
Data Structures
Data Structures
Class Hierarchy
Data Fields
All
g
q
r
s
v
x
y
Functions
g
q
r
s
v
Variables
Files
File List
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
graphBased
segment
segment.cpp
1
/*
2
Copyright (C) 2006 Pedro Felzenszwalb
3
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*/
18
19
#include <cstdio>
20
#include <cstdlib>
21
#include <image.h>
22
#include <misc.h>
23
#include <pnmfile.h>
24
#include "segment-image.h"
25
26
int
main(
int
argc,
char
**argv) {
27
if
(argc != 6) {
28
fprintf(stderr,
"usage: %s sigma k min input(ppm) output(ppm)\n"
, argv[0]);
29
return
1;
30
}
31
32
float
sigma = atof(argv[1]);
33
float
k = atof(argv[2]);
34
int
min_size = atoi(argv[3]);
35
36
printf(
"loading input image.\n"
);
37
image<rgb> *input = loadPPM(argv[4]);
38
39
printf(
"processing\n"
);
40
int
num_ccs;
41
image<rgb> *seg = segment_image(input, sigma, k, min_size, &num_ccs);
42
savePPM(seg, argv[5]);
43
44
printf(
"got %d components\n"
, num_ccs);
45
printf(
"done! uff...thats hard work.\n"
);
46
47
return
0;
48
}
49
Generated by
1.9.1