latest version v1.9 - last update 10 Apr 2010 |
Functor to manipulate graphs of adjacent image regions, where the nodes of the graphs contain the mean value of the region represented by the node. More...
#include <ltiRegionGraphMeans.h>
Public Types | |
typedef regionGraphFunctor < adjacencyGraph < regionGraphMeansNode < trgbPixel< float > >, float, int, F, symmetricEdgeTraits < float > > > | parent |
typedef parent::graph_type | graph_type |
typedef parent::weight_type | weight_type |
typedef parent::edge_data_type | edge_data_type |
typedef parent::node_type | node_type |
Public Member Functions | |
regionGraphColor () | |
regionGraphColor (const parameters &par) | |
regionGraphColor (const regionGraphColor &other) | |
virtual | ~regionGraphColor () |
virtual const char * | getTypeName () const |
virtual functor * | clone () const |
bool | apply (const matrix< int > ®ions, const image &image, const int minLabel, graph_type &graph) |
bool | apply (const matrix< int > ®ions, const channel &c1, const channel &c2, const channel &c3, const int minLabel, graph_type &graph) |
bool | generate (const matrix< int > ®ions, const image &image, const int minLabel, graph_type &graph) |
bool | generate (const matrix< int > ®ions, const channel &c1, const channel &c2, const channel &c3, const int minLabel, graph_type &graph) |
bool | apply (const weight_type &threshold, graph_type &graph, ivector &equivalences) |
bool | apply (graph_type &graph, ivector &equivalences) |
bool | apply (const weight_type &threshold, const int minLabel, graph_type &graph, ivector &equivalences) |
bool | apply (const int minLabel, graph_type &graph, ivector &equivalences) |
Protected Member Functions | |
bool | apply (const matrix< int > ®ions, const int minLabel, graph_type &graph) |
Reimplemented virtual methods | |
virtual bool | checkInternalData (const point ®ionsSize, const int maxRegionIndex) const |
virtual bool | considerForEdgeData (const point &p1, const point &p2, edge_data_type &edgeData) |
virtual bool | considerForNodeData (const point &p1, const int label, node_type &nodeData) |
Protected Attributes | |
Internal data | |
channel | c1 |
channel | c2 |
channel | c3 |
Functor to manipulate graphs of adjacent image regions, where the nodes of the graphs contain the mean value of the region represented by the node.
The template F is the distance computation functor required by the graph.
typedef parent::edge_data_type lti::regionGraphColor< F >::edge_data_type |
Edge data type.
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.
typedef parent::graph_type lti::regionGraphColor< F >::graph_type |
typedef parent::node_type lti::regionGraphColor< F >::node_type |
Edge denotation with the pair of node ids.
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.
typedef regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel<float> >, float, int, F, symmetricEdgeTraits<float> > > lti::regionGraphColor< F >::parent |
Parent class shortcut.
typedef parent::weight_type lti::regionGraphColor< F >::weight_type |
Type used for the weights.
They should usually be float or double, but any type supported by the lti::vector can be used.
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.
lti::regionGraphColor< F >::regionGraphColor | ( | ) |
default constructor
lti::regionGraphColor< F >::regionGraphColor | ( | const parameters & | par | ) |
Construct a functor using the given parameters.
lti::regionGraphColor< F >::regionGraphColor | ( | const regionGraphColor< F > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::regionGraphColor< F >::~regionGraphColor | ( | ) | [virtual] |
destructor
bool lti::regionGraphColor< F >::apply | ( | const matrix< int > & | regions, | |
const int | minLabel, | |||
graph_type & | graph | |||
) | [protected] |
Alias for generate().
bool lti::regionGraphColor< F >::apply | ( | const int | minLabel, | |
graph_type & | graph, | |||
ivector & | equivalences | |||
) |
Alias for merge() taking the threshold from the parameters.
bool lti::regionGraphColor< F >::apply | ( | const weight_type & | threshold, | |
const int | minLabel, | |||
graph_type & | graph, | |||
ivector & | equivalences | |||
) |
Alias for merge().
bool lti::regionGraphColor< F >::apply | ( | graph_type & | graph, | |
ivector & | equivalences | |||
) |
Alias for merge() taking the threshold from the parameters.
bool lti::regionGraphColor< F >::apply | ( | const weight_type & | threshold, | |
graph_type & | graph, | |||
ivector & | equivalences | |||
) |
Alias for merge().
bool lti::regionGraphColor< F >::apply | ( | const matrix< int > & | regions, | |
const channel & | c1, | |||
const channel & | c2, | |||
const channel & | c3, | |||
const int | minLabel, | |||
graph_type & | graph | |||
) |
Generate a graph representation for the given image using the partition in regions and considering only the labels above or equal minLabel.
The nodes of the graph contain at the end enough information to compute the color mean values of each region.
bool lti::regionGraphColor< F >::apply | ( | const matrix< int > & | regions, | |
const image & | image, | |||
const int | minLabel, | |||
graph_type & | graph | |||
) |
Generate a graph representation for the given image using the partition in regions and considering only the labels above or equal minLabel.
The nodes of the graph contain at the end enough information to compute the color mean values of each region.
virtual bool lti::regionGraphColor< F >::checkInternalData | ( | const point & | regionsSize, | |
const int | maxRegionIndex | |||
) | const [protected, virtual] |
Check if the internal data is compatible with the region mask.
The weights between region nodes can be computed from very different information sources. Usually, this information is coded in images and channels also extracted from the same image from which the regions map was computed. Therefore, it is important to provide a way to check if the internal data is compatible with the regions map, since both must be provided by the user at different times.
regionsSize | size of the original image and region mask. This allows to check for channels and other data in the original image size format. | |
maxRegionIndex | maximum region index employed. This is used to check if the vectors with information per region have the appropriate size. |
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.
virtual functor* lti::regionGraphColor< F >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.
virtual bool lti::regionGraphColor< F >::considerForEdgeData | ( | const point & | p1, | |
const point & | p2, | |||
edge_data_type & | edgeData | |||
) | [protected, virtual] |
For each two neighbor pixels that belong to different regions, this method is called to compute the edge data value in a sequential manner.
It will be assumed, that the default constructor of the graph_type::edge_type::data_type "resets" correctly the data of the edge.
p1 | coordinates of pixel belonging to one region | |
p2 | coordinates of pixel belonging to another region | |
edgeData | reference to data structure of the edge, where some values can be accumulated or set. |
virtual bool lti::regionGraphColor< F >::considerForNodeData | ( | const point & | p1, | |
const int | label, | |||
node_type & | nodeData | |||
) | [protected, virtual] |
For each pixel in each region, this method is called once to compute statistics or other data for each node.
p1 | coordinates of the current pixel | |
label | identification label for the region to which the pixel belongs. | |
nodeData | reference to the data structure of the node, where some values can be accumulated or set. |
bool lti::regionGraphColor< F >::generate | ( | const matrix< int > & | regions, | |
const channel & | c1, | |||
const channel & | c2, | |||
const channel & | c3, | |||
const int | minLabel, | |||
graph_type & | graph | |||
) |
Generate a graph representation for the given image using the partition in regions and considering only the labels above or equal minLabel.
The nodes of the graph contain at the end enough information to compute the color mean values of each region.
This is an alias. You can also directly call the corresponding apply method.
bool lti::regionGraphColor< F >::generate | ( | const matrix< int > & | regions, | |
const image & | image, | |||
const int | minLabel, | |||
graph_type & | graph | |||
) |
Generate a graph representation for the given image using the partition in regions and considering only the labels above or equal minLabel.
The nodes of the graph contain at the end enough information to compute the color mean values of each region.
This is an alias. You can also directly call the corresponding apply method.
virtual const char* lti::regionGraphColor< F >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("regionGraphColorMean")
Reimplemented from lti::regionGraphFunctor< adjacencyGraph< regionGraphMeansNode< trgbPixel< float > >, float, int, F, symmetricEdgeTraits< float > > >.