source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/Superpixels/SourceCode/segment/segment.cpp @ 86

Last change on this file since 86 was 37, checked in by (none), 15 years ago

Added original make3d

File size: 1.4 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  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
Note: See TracBrowser for help on using the repository browser.