GClasses
GClasses::G2DRegionGraph Class Reference

Detailed Description

Implements a region adjacency graph for 2D images, and lets you merge similar regions to create a hierarchical breakdown of the image.

#include <GRegion.h>

Inheritance diagram for GClasses::G2DRegionGraph:
GClasses::GRegionAjacencyGraph

Public Member Functions

 G2DRegionGraph (int nWidth, int nHeight)
 
virtual ~G2DRegionGraph ()
 
void makeCoarserRegions (G2DRegionGraph *pFineRegions)
 Given a G2DRegionGraph, this merges every region with its closest neighbor to form a coarser G2DRegionGraph. More...
 
void makeWatershedRegions (const GImage *pImage)
 Toboggans the gradient magnitude image of the provided image to produce a list of watershed regions. More...
 
GImageregionMask ()
 Gets a pointer to the region mask image. More...
 
void setMaskPixel (int x, int y, unsigned int c, size_t nRegion)
 Specifies which region the given pixel belongs to. The color of the pixel is also specified so it can keep track of the average color of each region. More...
 
- Public Member Functions inherited from GClasses::GRegionAjacencyGraph
 GRegionAjacencyGraph ()
 
virtual ~GRegionAjacencyGraph ()
 
size_t addRegion ()
 Creates a new region and returns the region number. More...
 
void ajacency (size_t nEdge, size_t *pRegion1, size_t *pRegion2)
 Returns the two regions that are ajacent. More...
 
size_t ajacencyCount ()
 Returns the number of ajacencies. More...
 
bool areNeighbors (size_t nRegion1, size_t nRegion2)
 Returns true if the two specified regions are neighbors. More...
 
void averageColor (size_t nRegion, float *pRed, float *pGreen, float *pBlue)
 Returns the average pixel color in the specified region. More...
 
void makeNeighbors (size_t nRegion1, size_t nRegion2)
 Makes the two specified regions neighbors (if they aren't already neighbors) More...
 
size_t regionCount ()
 Returns the number of regions so far. More...
 

Protected Attributes

GImagem_pRegionMask
 
- Protected Attributes inherited from GClasses::GRegionAjacencyGraph
std::vector< GRegionEdge * > m_neighbors
 
GHeapm_pHeap
 
std::vector< GRegion * > m_regions
 

Constructor & Destructor Documentation

GClasses::G2DRegionGraph::G2DRegionGraph ( int  nWidth,
int  nHeight 
)
virtual GClasses::G2DRegionGraph::~G2DRegionGraph ( )
virtual

Member Function Documentation

void GClasses::G2DRegionGraph::makeCoarserRegions ( G2DRegionGraph pFineRegions)

Given a G2DRegionGraph, this merges every region with its closest neighbor to form a coarser G2DRegionGraph.

void GClasses::G2DRegionGraph::makeWatershedRegions ( const GImage pImage)

Toboggans the gradient magnitude image of the provided image to produce a list of watershed regions.

GImage* GClasses::G2DRegionGraph::regionMask ( )
inline

Gets a pointer to the region mask image.

void GClasses::G2DRegionGraph::setMaskPixel ( int  x,
int  y,
unsigned int  c,
size_t  nRegion 
)

Specifies which region the given pixel belongs to. The color of the pixel is also specified so it can keep track of the average color of each region.

Member Data Documentation

GImage* GClasses::G2DRegionGraph::m_pRegionMask
protected