public class GraphCut extends Object
Constructor and Description 

GraphCut(int numNodes,
int numEdges)
Initialises the graph cut implementation and allocates the memory needed
for the given number of nodes and edges.

Modifier and Type  Method and Description 

float 
computeMaximumFlow(boolean reuseTrees,
List<Integer> changedNodes)
Performs the actual maxflow/mincut computation.

int 
getNumEdges()
Gets the number of edges in this graph.

int 
getNumNodes()
Gets the number of nodes in this graph.

Terminal 
getTerminal(int node)
Get the segmentation, i.e., the terminal node that is connected to the
specified node.

void 
markNode(int node)
Mark a node as being changed.

void 
setEdgeWeight(int node1,
int node2,
float weight)
Set the edge weight of an undirected edge between two nodes.

void 
setEdgeWeight(int node1,
int node2,
float weight1to2,
float weight2to1)
Set the edge weight of a pair of directed edges between two nodes.

void 
setTerminalWeights(int node,
float source,
float sink)
Set the affinity for one node to belong to the foreground (i.e., source)
or background (i.e., sink).

public GraphCut(int numNodes, int numEdges)
numNodes
 The number of nodes that should be created.numEdges
 The number of edges that you can add. A directed edge and its
counterpart (i.e., the directed edge in the other
direction) count as one edge.public void setTerminalWeights(int node, float source, float sink)
node
 The number of the node.source
 The affinity of this node to the foreground (i.e., source)sink
 The affinity of this node to the background (i.e., sink)public void setEdgeWeight(int node1, int node2, float weight)
node1
 The first node.node2
 The second node.weight
 The weight (i.e., the cost) of the connecting edge.public void setEdgeWeight(int node1, int node2, float weight1to2, float weight2to1)
node1
 The first node.node2
 The second node.weight1to2
 The weight (i.e., the cost) of the directed edge from
node1 to node2.weight2to1
 The weight (i.e., the cost) of the directed edge from
node2 to node1.public float computeMaximumFlow(boolean reuseTrees, List<Integer> changedNodes)
reuseTrees
 reuse trees of a previos callchangedNodes
 list of nodes that potentially changed their
segmentation compared to a previous call, can be set
to nullpublic Terminal getTerminal(int node)
nodeId
 the node to checkpublic int getNumNodes()
public int getNumEdges()
public void markNode(int node)
nodeId
 The node that changed.Copyright © 2015–2017 Fiji. All rights reserved.