Image Component Library (ICL)
|
Class for creating a color distance map. More...
#include <ColorDistanceOp.h>
Public Member Functions | |
ColorDistanceOp () | |
Dummy constructor (creates an uninitialized instance) | |
template<class Container > | |
ColorDistanceOp (const Container &vec, double threshold=-1) | |
create a new instance with given reference color and optional threshold | |
template<class ForewardIterator > | |
ColorDistanceOp (ForewardIterator begin, ForewardIterator end, double threshold=-1) | |
create with given iterator range for the reference color initialization | |
void | apply (const core::ImgBase *src, core::ImgBase **dst) |
creates a color distance map | |
void | setThreshold (double threshold) |
sets the threshold value | |
void | setReferenceColor (const std::vector< double > &refColor) |
sets the current reference color | |
template<class Container > | |
void | init (const Container &refColor, double threshold=-1) |
sets both reference color and threshold at once | |
Private Attributes | |
std::vector< double > | m_refColor |
internal reference color | |
double | m_threshold |
internal threshold |
Class for creating a color distance map.
icl::filter::ColorDistanceOp::ColorDistanceOp | ( | ) | [inline] |
Dummy constructor (creates an uninitialized instance)
icl::filter::ColorDistanceOp::ColorDistanceOp | ( | const Container & | vec, |
double | threshold = -1 |
||
) | [inline] |
create a new instance with given reference color and optional threshold
If the given threshold is not -1, the resulting distance values are thresholded (so that pixels, that are closer than threshold to the referenceColor are set to 255. The reference color needs at least 3 entries.
icl::filter::ColorDistanceOp::ColorDistanceOp | ( | ForewardIterator | begin, |
ForewardIterator | end, | ||
double | threshold = -1 |
||
) | [inline] |
create with given iterator range for the reference color initialization
void icl::filter::ColorDistanceOp::apply | ( | const core::ImgBase * | src, |
core::ImgBase ** | dst | ||
) | [virtual] |
creates a color distance map
If the current threshold is not -1, then the result image becomes a binary 8-image. Otherwise, the resulting image is adapted to an Img32f. Only if the source depth is depth64f, and Img64f is also used for the result.
The source image is assumed to have 3 channels
Implements icl::filter::UnaryOp.
void icl::filter::ColorDistanceOp::init | ( | const Container & | refColor, |
double | threshold = -1 |
||
) | [inline] |
sets both reference color and threshold at once
void icl::filter::ColorDistanceOp::setReferenceColor | ( | const std::vector< double > & | refColor | ) | [inline] |
sets the current reference color
void icl::filter::ColorDistanceOp::setThreshold | ( | double | threshold | ) | [inline] |
sets the threshold value
std::vector<double> icl::filter::ColorDistanceOp::m_refColor [private] |
internal reference color
double icl::filter::ColorDistanceOp::m_threshold [private] |
internal threshold