Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
Public Member Functions | List of all members
ImageGraph Class Reference

Represents an image graph, consisting of one node per pixel which are 4-connected. More...

#include <image_graph.h>

Public Member Functions

 ImageGraph ()
 Default constructor. More...
 
 ImageGraph (int N)
 Constructs an image graph with the given exact number of nodes. More...
 
void operator= (const ImageGraph &graph)
 Assignment operator. More...
 
void setNode (int n, ImageNode &node)
 Set the node of the given index. More...
 
void addNode (ImageNode &node)
 Add a new node. More...
 
void addEdge (ImageEdge &edge)
 Add a new edge. More...
 
ImageNodegetNode (int n)
 
ImageEdgegetEdge (int e)
 Get the e-th edge in the current sorting. More...
 
int getNumNodes ()
 Get the number of nodes. More...
 
int getNumEdges ()
 Get the number of edges. More...
 
int getNumComponents ()
 Get number of connected components. More...
 
void sortEdges ()
 Sort the edges by weight. More...
 
ImageNodefindNodeComponent (ImageNode &n)
 When two nodes get merged, the first node is assigned the id of the second node as label. By traversing this labeling, the current component of each node (that is, pixel) can easily be identified and the label can be updated for efficiency. More...
 
void merge (ImageNode &S_n, ImageNode &S_m, ImageEdge &e)
 Merge two pixels (that is merge two nodes). More...
 

Detailed Description

Represents an image graph, consisting of one node per pixel which are 4-connected.

Author
David Stutz

Constructor & Destructor Documentation

ImageGraph::ImageGraph ( )
inline

Default constructor.

ImageGraph::ImageGraph ( int  N)
inline

Constructs an image graph with the given exact number of nodes.

Parameters
[in]Nnumber of nodes to allocate

Member Function Documentation

void ImageGraph::addEdge ( ImageEdge edge)
inline

Add a new edge.

Parameters
[in]edge
void ImageGraph::addNode ( ImageNode node)
inline

Add a new node.

Parameters
[in]node
ImageNode& ImageGraph::findNodeComponent ( ImageNode n)
inline

When two nodes get merged, the first node is assigned the id of the second node as label. By traversing this labeling, the current component of each node (that is, pixel) can easily be identified and the label can be updated for efficiency.

Parameters
[in]nodenode to find component for
Returns
node representing found component
ImageEdge& ImageGraph::getEdge ( int  e)
inline

Get the e-th edge in the current sorting.

Parameters
[in]eedge index
ImageNode& ImageGraph::getNode ( int  n)
inline
Parameters
[in]Getthe n-th node.
[in]nnode index
Returns
node at index n
int ImageGraph::getNumComponents ( )
inline

Get number of connected components.

Returns
int ImageGraph::getNumEdges ( )
inline

Get the number of edges.

Returns
number of edges
int ImageGraph::getNumNodes ( )
inline

Get the number of nodes.

Returns
number of nodes
void ImageGraph::merge ( ImageNode S_n,
ImageNode S_m,
ImageEdge e 
)
inline

Merge two pixels (that is merge two nodes).

Depending on the used "Distance", some lines may be commented out to speed up the algorithm.

Parameters
[in]S_nfirst node
[in]S_msecond node
[in]ecorresponding edge
void ImageGraph::operator= ( const ImageGraph graph)
inline

Assignment operator.

Parameters
[in]graphgraph to copy
void ImageGraph::setNode ( int  n,
ImageNode node 
)
inline

Set the node of the given index.

Parameters
[in]nindex of node
[in]node
void ImageGraph::sortEdges ( )
inline

Sort the edges by weight.


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