Provides a mechanism for mapping region IDs to colours and class names. Can be initialized from an XML configuration file or programmatically for a number of standard datasets.
More...
|
| drwnMultiSegRegionDefinitions () |
| default region definitions (constructed from initDefaultRegions)
|
|
| drwnMultiSegRegionDefinitions (const char *filename) |
| construct region definitions from file
|
|
void | clear () |
| clear region definitions
|
|
void | read (const char *filename) |
| read region definitions from file
|
|
void | read (drwnXMLNode &root) |
| read region definitions from XML node
|
|
bool | empty () const |
| returns true if no regions have been definied
|
|
int | size () const |
| returns the number of defined regions
|
|
int | maxKey () const |
| returns the highest region ID
|
|
set< int > | keys () const |
| returns the set of region IDs
|
|
string | name (int key) const |
| returns the name of the region with ID key
|
|
unsigned int | color (int key) const |
| returns the colour of the region with ID kep
|
|
virtual void | initializeForDataset (const drwnStandardMultiSegRegionDatasets &dataset) |
| re-initialize with a standard multi-class image labeling dataset
|
|
MatrixXi | convertImageToLabels (const cv::Mat &img) const |
| utility function for converting an image from colours to labels
|
|
MatrixXi | convertImageToLabels (const char *filename) const |
| utility function for reading an image and converting it from colours to labels
|
|
MatrixXi | loadLabelFile (const char *filename) const |
| utility to load labels from file (.txt read as is; .png converted via convertImageToLabels)
|
|
unsigned int & | operator[] (int key) |
| returns the colour of the region with ID key
|
|
|
static unsigned char | red (unsigned int c) |
| converts from 32-bit colour to 8-bit red
|
|
static unsigned char | green (unsigned int c) |
| converts from 32-bit colour to 8-bit green
|
|
static unsigned char | blue (unsigned int c) |
| converts from 32-bit colour to 8-bit blue
|
|
static unsigned int | rgb (unsigned char r, unsigned char g, unsigned char b) |
| converts 8-bit red, green and blue into 32-bit colour
|
|
|
virtual void | initDefaultRegions () |
| initializes the defitions with a default set of regions
|
|
|
map< int, int > | _keys |
| mapping from keys to colour and name index
|
|
vector< unsigned int > | _colors |
| colour for i-th key
|
|
vector< string > | _names |
| name of class for i-th key
|
|
Provides a mechanism for mapping region IDs to colours and class names. Can be initialized from an XML configuration file or programmatically for a number of standard datasets.
For example, the following XML file provides region IDs for the 21-class MSRC dataset:
<regionDefinitions>
<region
id=
"-1" name=
"void" color=
"0 0 0"/>
<region
id=
"0" name=
"building" color=
"128 0 0"/>
<region
id=
"1" name=
"grass" color=
"0 128 0"/>
<region
id=
"2" name=
"tree" color=
"128 128 0"/>
<region
id=
"3" name=
"cow" color=
"0 0 128"/>
<region
id=
"4" name=
"sheep" color=
"0 128 128"/>
<region
id=
"5" name=
"sky" color=
"128 128 128"/>
<region
id=
"6" name=
"airplane" color=
"192 0 0"/>
<region
id=
"7" name=
"water" color=
"64 128 0"/>
<region
id=
"8" name=
"face" color=
"192 128 0"/>
<region
id=
"9" name=
"car" color=
"64 0 128"/>
<region
id=
"10" name=
"bicycle" color=
"192 0 128"/>
<region
id=
"11" name=
"flower" color=
"64 128 128"/>
<region
id=
"12" name=
"sign" color=
"192 128 128"/>
<region
id=
"13" name=
"bird" color=
"0 64 0"/>
<region
id=
"14" name=
"book" color=
"128 64 0"/>
<region
id=
"15" name=
"chair" color=
"0 192 0"/>
<region
id=
"16" name=
"road" color=
"128 64 128"/>
<region
id=
"17" name=
"cat" color=
"0 192 128"/>
<region
id=
"18" name=
"dog" color=
"128 192 128"/>
<region
id=
"19" name=
"body" color=
"64 64 0"/>
<region
id=
"20" name=
"boat" color=
"192 64 0"/>
</regionDefinitions>
The documentation for this class was generated from the following files: