Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes
pcl::segmentation::grabcut::BoykovKolmogorov Class Reference

#include <grabcut.h>

List of all members.

Public Types

typedef double edge_capacity_type
typedef int vertex_descriptor

Public Member Functions

void addConstant (double c)
 add constant flow to graph
void addEdge (int u, int v, double cap_uv, double cap_vu=0.0)
int addNodes (std::size_t n=1)
 add nodes to the graph (returns the id of the first node added)
void addSourceEdge (int u, double cap)
 add edge from s to nodeId
void addTargetEdge (int u, double cap)
 add edge from nodeId to t
 BoykovKolmogorov (std::size_t max_nodes=0)
 construct a maxflow/mincut problem with estimated max_nodes
void clear ()
 clear the graph and internal datastructures
bool inSinkTree (int u) const
 return true if u is in the t-set after calling solve
bool inSourceTree (int u) const
 return true if u is in the s-set after calling solve.
size_t numNodes () const
 get number of nodes in the graph
double operator() (int u, int v) const
 returns the residual capacity for an edge (use -1 for terminal (-1,-1) is the current flow
void reset ()
 reset all edge capacities to zero (but don't free the graph)
double solve ()
 solve the max-flow problem and return the flow
virtual ~BoykovKolmogorov ()
 destructor

Protected Types

typedef std::map< int, double > capacitated_edge
 capacitated edge
typedef std::pair
< capacitated_edge::iterator,
capacitated_edge::iterator > 
edge_pair
 edge pair
enum  nodestate { FREE = 0x00, SOURCE = 0x01, TARGET = 0x02 }
 tree states More...

Protected Member Functions

void adoptOrphans (std::deque< int > &orphans)
 adopt orphaned subtrees
void augmentPath (const std::pair< int, int > &path, std::deque< int > &orphans)
 augment the path found by expandTrees; return orphaned subtrees
void clearActive ()
 clear active set
std::pair< int, int > expandTrees ()
 expand trees until a path is found (or no path (-1, -1))
void initializeTrees ()
 initialize trees from source and target
bool isActive (int u) const
 active if head or previous node is not the terminal
bool isActiveSetEmpty () const
void markActive (int u)
 mark vertex as active
void markInactive (int u)
 mark vertex as inactive
void preAugmentPaths ()
 pre-augment s-u-t and s-u-v-t paths

Protected Attributes

std::vector< unsigned char > cut_
 identifies which side of the cut a node falls
double flow_value_
 current flow value (includes constant)
std::vector< capacitated_edgenodes_
 nodes and their outgoing internal edges
std::vector< double > source_edges_
 edges leaving the source
std::vector< double > target_edges_
 edges entering the target

Private Attributes

int active_head_
std::vector< std::pair< int,
int > > 
active_list_
 doubly-linked list (prev, next)
int active_tail_
std::vector< std::pair< int,
edge_pair > > 
parents_
 search tree (also uses cut_)

Static Private Attributes

static const int TERMINAL = -1
 parents_ flag for terminal state

Detailed Description

boost implementation of Boykov and Kolmogorov's maxflow algorithm doesn't support negative flows which makes it inappropriate for this conext. This implementation of Boykov and Kolmogorov's maxflow algorithm by Stephen Gould <stephen.gould@anu.edu.au> in DARWIN under BSD does the trick however solwer than original implementation.

Definition at line 61 of file grabcut.h.


Member Typedef Documentation

typedef std::map<int, double> pcl::segmentation::grabcut::BoykovKolmogorov::capacitated_edge [protected]

capacitated edge

Definition at line 113 of file grabcut.h.

Definition at line 65 of file grabcut.h.

typedef std::pair<capacitated_edge::iterator, capacitated_edge::iterator> pcl::segmentation::grabcut::BoykovKolmogorov::edge_pair [protected]

edge pair

Definition at line 115 of file grabcut.h.

Definition at line 64 of file grabcut.h.


Member Enumeration Documentation

tree states

Enumerator:
FREE 
SOURCE 
TARGET 

Definition at line 111 of file grabcut.h.


Constructor & Destructor Documentation

construct a maxflow/mincut problem with estimated max_nodes

Definition at line 48 of file grabcut.cpp.

destructor

Definition at line 70 of file grabcut.h.


Member Function Documentation

add constant flow to graph

Definition at line 85 of file grabcut.h.

void pcl::segmentation::grabcut::BoykovKolmogorov::addEdge ( int  u,
int  v,
double  cap_uv,
double  cap_vu = 0.0 
)

add edge from u to v and edge from v to u (requires cap_uv + cap_vu >= 0)

Definition at line 147 of file grabcut.cpp.

add nodes to the graph (returns the id of the first node added)

Definition at line 103 of file grabcut.cpp.

add edge from s to nodeId

Definition at line 121 of file grabcut.cpp.

add edge from nodeId to t

Definition at line 134 of file grabcut.cpp.

void pcl::segmentation::grabcut::BoykovKolmogorov::adoptOrphans ( std::deque< int > &  orphans) [protected]

adopt orphaned subtrees

Definition at line 431 of file grabcut.cpp.

void pcl::segmentation::grabcut::BoykovKolmogorov::augmentPath ( const std::pair< int, int > &  path,
std::deque< int > &  orphans 
) [protected]

augment the path found by expandTrees; return orphaned subtrees

Definition at line 356 of file grabcut.cpp.

clear the graph and internal datastructures

Definition at line 229 of file grabcut.cpp.

clear active set

Definition at line 495 of file grabcut.cpp.

std::pair< int, int > pcl::segmentation::grabcut::BoykovKolmogorov::expandTrees ( ) [protected]

expand trees until a path is found (or no path (-1, -1))

Definition at line 294 of file grabcut.cpp.

initialize trees from source and target

Definition at line 270 of file grabcut.cpp.

return true if u is in the t-set after calling solve

Definition at line 104 of file grabcut.h.

return true if u is in the s-set after calling solve.

Definition at line 101 of file grabcut.h.

bool pcl::segmentation::grabcut::BoykovKolmogorov::isActive ( int  u) const [inline, protected]

active if head or previous node is not the terminal

Definition at line 138 of file grabcut.h.

Returns:
true if active set is empty

Definition at line 135 of file grabcut.h.

mark vertex as active

Definition at line 503 of file grabcut.cpp.

mark vertex as inactive

Definition at line 517 of file grabcut.cpp.

get number of nodes in the graph

Definition at line 73 of file grabcut.h.

double pcl::segmentation::grabcut::BoykovKolmogorov::operator() ( int  u,
int  v 
) const

returns the residual capacity for an edge (use -1 for terminal (-1,-1) is the current flow

Definition at line 60 of file grabcut.cpp.

pre-augment s-u-t and s-u-v-t paths

Definition at line 71 of file grabcut.cpp.

reset all edge capacities to zero (but don't free the graph)

Definition at line 211 of file grabcut.cpp.

solve the max-flow problem and return the flow

Definition at line 241 of file grabcut.cpp.


Member Data Documentation

Definition at line 163 of file grabcut.h.

std::vector<std::pair<int, int> > pcl::segmentation::grabcut::BoykovKolmogorov::active_list_ [private]

doubly-linked list (prev, next)

Definition at line 162 of file grabcut.h.

Definition at line 163 of file grabcut.h.

std::vector<unsigned char> pcl::segmentation::grabcut::BoykovKolmogorov::cut_ [protected]

identifies which side of the cut a node falls

Definition at line 154 of file grabcut.h.

current flow value (includes constant)

Definition at line 152 of file grabcut.h.

nodes and their outgoing internal edges

Definition at line 150 of file grabcut.h.

std::vector<std::pair<int, edge_pair> > pcl::segmentation::grabcut::BoykovKolmogorov::parents_ [private]

search tree (also uses cut_)

Definition at line 160 of file grabcut.h.

edges leaving the source

Definition at line 146 of file grabcut.h.

edges entering the target

Definition at line 148 of file grabcut.h.

parents_ flag for terminal state

Definition at line 158 of file grabcut.h.


The documentation for this class was generated from the following files:


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:47:04