source: proiecte/pmake3d/segment/segment.cpp @ 77

Last change on this file since 77 was 77, checked in by (none), 14 years ago

Added parallelized code

File size: 1.6 KB
Line 
1/*
2Copyright (C) 2006 Pedro Felzenszwalb
3
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, 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
26int 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
37  gettimeofday(&start, NULL);   
38
39  printf("loading input image.\n");
40  //image<rgb> *input = loadPPM(argv[4]);
41  image *input = loadPPM(argv[4]);
42       
43  printf("processing\n");
44  int num_ccs; 
45  //image<rgb> *seg = segment_image(input, sigma, k, min_size, &num_ccs);
46  image *seg = segment_image(input, sigma, k, min_size, &num_ccs); 
47  savePPM(seg, argv[5]);
48
49  printf("got %d components\n", num_ccs);
50  printf("done! uff...thats hard work.\n");
51
52  return 0;
53}
54
Note: See TracBrowser for help on using the repository browser.