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

Implementation of graph based image segmentation as described in the paper by Felzenswalb and Huttenlocher. More...

#include <graph_segmentation.h>

Public Member Functions

 GraphSegmentation ()
 Default constructor; uses the Manhatten distance. More...
 
virtual ~GraphSegmentation ()
 Destructor. More...
 
void setDistance (GraphSegmentationDistance *_distance)
 Set the distance to use. More...
 
void setMagic (GraphSegmentationMagic *_magic)
 Set the magic part of graph segmentation. More...
 
void buildGraph (const cv::Mat &image)
 Build the graph nased on the image, i.e. compute the weights between pixels using the underlying distance. More...
 
void oversegmentGraph ()
 Oversegment the given graph. More...
 
void enforceMinimumSegmentSize (int M)
 Enforces the given minimum segment size. [in] M minimum segment size in pixels. More...
 
cv::Mat deriveLabels ()
 Derive labels from the produced oversegmentation. More...
 

Protected Attributes

int H
 Image height. More...
 
int W
 Image widt.h. More...
 
ImageGraph graph
 The constructed and segmented image graph. More...
 
GraphSegmentationDistancedistance
 The underlying distance to use. More...
 
GraphSegmentationMagicmagic
 The magic part of graph segmentation. More...
 

Detailed Description

Implementation of graph based image segmentation as described in the paper by Felzenswalb and Huttenlocher.

Author
David Stutz

Constructor & Destructor Documentation

GraphSegmentation::GraphSegmentation ( )
inline

Default constructor; uses the Manhatten distance.

virtual GraphSegmentation::~GraphSegmentation ( )
inlinevirtual

Destructor.

Member Function Documentation

void GraphSegmentation::buildGraph ( const cv::Mat &  image)

Build the graph nased on the image, i.e. compute the weights between pixels using the underlying distance.

Parameters
[in]imageimage to oversegment

Copyright (c) 2016, David Stutz Contact: david.nosp@m..stu.nosp@m.tz@rw.nosp@m.th-a.nosp@m.achen.nosp@m..de, davidstutz.de All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cv::Mat GraphSegmentation::deriveLabels ( )

Derive labels from the produced oversegmentation.

Returns
labels as integer matrix
void GraphSegmentation::enforceMinimumSegmentSize ( int  M)

Enforces the given minimum segment size. [in] M minimum segment size in pixels.

void GraphSegmentation::oversegmentGraph ( )

Oversegment the given graph.

void GraphSegmentation::setDistance ( GraphSegmentationDistance _distance)
inline

Set the distance to use.

Parameters
[in]_distancepointer to a GraphSegmentationDistance to use
void GraphSegmentation::setMagic ( GraphSegmentationMagic _magic)
inline

Set the magic part of graph segmentation.

Parameters
[in]_magixpointer to a GraphSegmentationMagic to use

Member Data Documentation

GraphSegmentationDistance* GraphSegmentation::distance
protected

The underlying distance to use.

ImageGraph GraphSegmentation::graph
protected

The constructed and segmented image graph.

int GraphSegmentation::H
protected

Image height.

GraphSegmentationMagic* GraphSegmentation::magic
protected

The magic part of graph segmentation.

int GraphSegmentation::W
protected

Image widt.h.


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