#include <HxBlob2d.h>
Public Methods | |
HxBlob2d () | |
Constructor. More... | |
HxBlob2d (int label, int xmin, int ymin, int width, int height) | |
Constructor. More... | |
~HxBlob2d () | |
Destructor. More... | |
int | ident () const |
Get the identifier of this blob. More... | |
int | getLabel () const |
Get the label of this blob (unique only within the labeled image. More... | |
HxPoint | startMaer () const |
Get the upper left corner of the MAER. More... | |
HxSizes | sizeMaer () const |
Get the sizes of the MAER. More... | |
template<class T> void | addFeature (HxString name, const T &val) |
Add combination name,val to the list of features. More... | |
template<class T> void | addFeature (HxNameTable::sizeType id, const T &val) |
Add combination id,val to the list of features. More... | |
template<class T> bool | getFeature (HxString name, T &val) const |
Get feature idetified by name from the list. More... | |
template<class T> bool | getFeature (HxNameTable::sizeType id, T &val) const |
Get feature idetified by name from the list. More... | |
int | getFeatureInt (HxString name) const |
Wrapper around getFeature for int's. More... | |
HxValue | getFeatureValue (HxString name) const |
Wrapper around getFeature for HxValue's. More... | |
STD_OSTREAM & | put (STD_OSTREAM &os) const |
Put blob on stream. More... | |
Static Public Methods | |
std::vector< HxString > | getFeatureNames () |
Get all feature names. More... |
Basically, a blob is a label in an identification image. In other words, a blob is a set of pixels that are "connected".
|
Constructor.
00024 { 00025 _ident = _nr++; 00026 } |
|
Constructor.
00041 { 00042 _ident = _nr++; 00043 _label = label; 00044 _xmin = xmin; 00045 _ymin = ymin; 00046 _width = width; 00047 _height = height; 00048 } |
|
Destructor.
00051 { 00052 } |
|
Get the identifier of this blob.
00056 { 00057 return _ident; 00058 } |
|
Get the label of this blob (unique only within the labeled image.
00076 { 00077 return _label; 00078 } |
|
Get the upper left corner of the MAER.
00082 { 00083 return HxPoint(_xmin, _ymin, 0); 00084 } |
|
Get the sizes of the MAER.
00088 { 00089 return HxSizes(_width, _height, 1); 00090 } |
|
Add combination name,val to the list of features.
00077 { 00078 HxNameTable::sizeType id = _featNameTable.getId(name); 00079 addFeature(id, val); 00080 } |
|
Add combination id,val to the list of features.
00085 { 00086 HxBlob2dFeature* feat = new HxBlob2dFeatureTem<T>(val); 00087 _features[id] = feat; 00088 } |
|
Get feature idetified by name from the list.
00093 { 00094 HxNameTable::sizeType id = _featNameTable.getId(name); 00095 return getFeature(id, val); 00096 } |
|
Get feature idetified by name from the list.
00101 { 00102 FeatureMap::const_iterator it = _features.find(id); 00103 if (it == _features.end()) 00104 return false; 00105 HxBlob2dFeature* base = (*it).second; 00106 HxBlob2dFeatureTem<T>* featPtr = 00107 dynamic_cast<HxBlob2dFeatureTem<T>* > (base); 00108 if (featPtr == 0) 00109 return false; // was other type 00110 val = featPtr->getValue(); 00111 return true; 00112 } |
|
Wrapper around getFeature for int's.
00144 { 00145 int val; 00146 getFeature(name, val); 00147 return val; 00148 } |
|
Wrapper around getFeature for HxValue's.
00152 { 00153 HxValue val; 00154 getFeature(name, val); 00155 return val; 00156 } |
|
Put blob on stream.
|
|
Get all feature names.
00168 { 00169 return _featNameTable.getNames(); 00170 } |