资源简介
本代码在visual c++上运行,实现了基于图的图像分割。
代码片段和文件信息
/*
Copyright (C) 2006 Pedro Felzenszwalb
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.
This program is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not write to the Free Software
Foundation Inc. 59 Temple Place Suite 330 Boston MA 02111-1307 USA
*/
#include
#include
#include
#include
#include
#include “segment-image.h“
int main(int argc char **argv) {
if (argc != 6) {
fprintf(stderr “usage: %s sigma k min input(ppm) output(ppm)\n“ argv[0]);
return 1;
}
float sigma = atof(argv[1]);
float k = atof(argv[2]);
int min_size = atoi(argv[3]);
printf(“loading input image.\n“);
image *input = loadPPM(argv[4]);
printf(“processing\n“);
int num_ccs;
image *seg = segment_image(input sigma k min_size &num_ccs);
savePPM(seg argv[5]);
printf(“got %d components\n“ num_ccs);
printf(“done! uff...thats hard work.\n“);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1940 2006-12-28 12:10 segment\convolve.h
文件 17987 2006-12-28 12:09 segment\COPYING
文件 1857 2006-12-28 12:10 segment\disjoint-set.h
文件 2973 2006-12-28 12:10 segment\filter.h
文件 2294 2006-12-28 12:10 segment\image.h
文件 4926 2006-12-28 12:10 segment\imconv.h
文件 1648 2006-12-28 12:10 segment\imutil.h
文件 338 2005-02-23 13:16 segment\Makefile
文件 1731 2006-12-28 12:10 segment\misc.h
文件 5253 2006-12-28 12:10 segment\pnmfile.h
文件 782 2005-02-23 16:39 segment\README
文件 2191 2006-12-28 12:10 segment\segment-graph.h
文件 4304 2007-03-21 15:59 segment\segment-image.h
文件 1460 2006-12-28 12:10 segment\segment.cpp
目录 0 2007-03-21 16:01 segment
----------- --------- ---------- ----- ----
49684 15
- 上一篇:OpenGL窗口背景绘制
- 下一篇:cc++项目视频.txt
评论
共有 条评论