00001 /* 00002 * Copyright (C) 2006 Pedro Felzenszwalb 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 00019 /* 00020 * 05/27/2007 00021 * Edited by pthoren@cs.uml.edu: 00022 * Moved source code into a source file. 00023 * Just reorganizing the code a bit in here. 00024 * Formating to my own crazy standards. 00025 */ 00026 00027 #ifndef SEGMENT_GRAPH 00028 #define SEGMENT_GRAPH 00029 00030 #include <algorithm> 00031 #include <cmath> 00032 #include "disjoint-set.h" 00033 00034 // threshold function 00035 #define THRESHOLD(size, c) (c/size) 00036 00037 typedef struct { 00038 float w; 00039 int a, b; 00040 } edge; 00041 00042 bool operator<(const edge &a, const edge &b); 00043 00044 /* 00045 * Segment a graph 00046 * 00047 * Returns a disjoint-set forest representing the segmentation. 00048 * 00049 * num_vertices: number of vertices in graph. 00050 * num_edges: number of edges in graph 00051 * edges: array of edges. 00052 * c: constant for treshold function. 00053 */ 00054 universe *segment_graph(int num_vertices, 00055 int num_edges, 00056 edge *edges, 00057 float c); 00058 #endif
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |