AURobotServers
4
|
#include <ufuzzysplit.h>
Public Member Functions | |
bool | addElement (UFuzzyElement *elem) |
bool | classify (int clusters, double stopVal, int maxLoopCnt, bool initialize) |
bool | classifyOld (int clusters, double stopVal, int maxLoopCnt) |
void | clear () |
void | countMembers () |
UFuzzyElement * | getElement (int index) |
UMatrix * | getF (int clust) |
int | getMembCount (int clust) |
UMatrix * | getV (int clust) |
bool | initFromValues (int clust, int inx, int idxCnt) |
UFuzzySplit () | |
int | updateElement (UFuzzyElement *elem, int clustCnt) |
~UFuzzySplit () | |
Protected Member Functions | |
bool | getCenter (int clust, double m, UFuzzyElement **e, int eCnt, UMatrix *pmV) |
bool | getCovariance (int clust, double m, UFuzzyElement **e, int eCnt, UMatrix *pmF, UMatrix *pmV, UMatrix *pmAi) |
Protected Attributes | |
int | clustCnt |
int | elemClust [MAX_CLUSTER_CNT] |
UFuzzyElement * | elems [MAX_ELEMENTS] |
int | elemsCnt |
UMatrix4 | mAi [MAX_CLUSTER_CNT] |
UMatrix4 | mF [MAX_CLUSTER_CNT] |
UMatrix4 | mV [MAX_CLUSTER_CNT] |
Static Protected Attributes | |
static const int | MAX_CLUSTER_CNT = 20 |
static const int | MAX_ELEMENTS = 100000 |
Split fuzzy elements into n classes
UFuzzySplit::UFuzzySplit | ( | ) |
Constructor
References clear().
UFuzzySplit::~UFuzzySplit | ( | ) |
Destructor
bool UFuzzySplit::addElement | ( | UFuzzyElement * | elem | ) |
Add element. Returns false if no more space.
References elems, elemsCnt, and MAX_ELEMENTS.
Referenced by UClientFuncImgGui::doFuzzyClassify(), UFuncFz::initializeClassesFromLine(), UFuncFz::loadNewImage(), testFuzzySplit(), and testFuzzySplit2().
bool UFuzzySplit::classify | ( | int | clusters, |
double | stopVal, | ||
int | maxLoopCnt, | ||
bool | initialize | ||
) |
Split into x classes
References clustCnt, elems, elemsCnt, getCenter(), getCovariance(), UFuzzyElement::getMaxClusterCnt(), UFuzzyElement::getMembValueChange(), UFuzzyElement::getVectorSize(), mAi, mF, mV, UFuzzyElement::setDistance(), UMatrix::setSize(), and UFuzzyElement::updateMembValue().
Referenced by UFuncFz::doClassify(), UClientFuncImgGui::doFuzzyClassify(), testFuzzySplit(), and testFuzzySplit2().
bool UFuzzySplit::classifyOld | ( | int | clusters, |
double | stopVal, | ||
int | maxLoopCnt | ||
) |
Old split function
References UFuzzyElement::addCovariance(), UFuzzyElement::addPosition(), UMatrix::clear(), clustCnt, countMembers(), UMatrix4::det(), elems, elemsCnt, getMembCount(), UFuzzyElement::getMembValueChange(), UMatrix4::inversed(), mAi, mF, UMatrix::mult(), mV, UFuzzyElement::print(), UMatrix::print(), UFuzzyElement::setDistance(), UMatrix::setSize(), and UFuzzyElement::updateMembValue().
void UFuzzySplit::clear | ( | void | ) |
Clear all elements away
References elemsCnt.
Referenced by UFuncFz::doClassify(), UClientFuncImgGui::doFuzzyClassify(), UFuncFz::initializeClassesFromLine(), UFuncFz::loadNewImage(), and UFuzzySplit().
void UFuzzySplit::countMembers | ( | ) |
Coumt members
References clustCnt, elemClust, elems, and elemsCnt.
Referenced by classifyOld(), UFuncFz::doClassify(), UClientFuncImgGui::doFuzzyClassify(), testFuzzySplit(), and testFuzzySplit2().
|
protected |
Calculate center of cluster if 'clust' = -1, then membership is set to 1.0.
References UMatrix::clear(), elems, elemsCnt, and UMatrix::mult().
Referenced by classify(), getF(), and initFromValues().
|
protected |
Calculate new value for covariance matrices. Requires that center is calculated (in pmV) Result is set in pmF and pmAi. Returns true
References UMatrix::add(), UMatrix::clear(), UMatrix::cols(), UMatrix4::det(), UMatrix4::inversed(), UMatrix::mult(), UMatrix::rows(), and UMatrix::setRC().
Referenced by classify(), getF(), and initFromValues().
UFuzzyElement * UFuzzySplit::getElement | ( | int | index | ) |
|
inline |
Get cluster center mvector
References getCenter(), getCovariance(), and mF.
Referenced by UClientFuncImgGui::showUVImage().
int UFuzzySplit::getMembCount | ( | int | clust | ) |
Get number of members in a group. NB! countMembers must be called first.
References elemClust.
Referenced by classifyOld(), UFuncFz::doClassify(), UClientFuncImgGui::doFuzzyClassify(), testFuzzySplit(), and testFuzzySplit2().
|
inline |
bool UFuzzySplit::initFromValues | ( | int | clust, |
int | inx, | ||
int | idxCnt | ||
) |
Set class center, covariance matrix and from these elements with a common membership value (=0.5)
References elems, elemsCnt, getCenter(), getCovariance(), UFuzzyElement::getVectorSize(), mAi, mF, mV, UFuzzyElement::setMembValue(), and UMatrix::setSize().
Referenced by UClientFuncImgGui::doFuzzyClassify(), UFuncFz::initializeClassesFromLine(), and testFuzzySplit2().
int UFuzzySplit::updateElement | ( | UFuzzyElement * | elem, |
int | clustCnt | ||
) |
Update this element with distance and membershop value. Returns number of best cluster
References clustCnt, UFuzzyElement::getClass(), mAi, mV, UFuzzyElement::setDistance(), and UFuzzyElement::updateMembValue().
Referenced by UClientFuncImgGui::getPixelClass(), and UFuncFz::getPixelClass().
|
protected |
Number of requested classes
Referenced by classify(), classifyOld(), countMembers(), and updateElement().
|
protected |
Number of elements in each cluster
Referenced by countMembers(), and getMembCount().
|
protected |
Array of pointers to elements to classify
Referenced by addElement(), classify(), classifyOld(), countMembers(), getCenter(), getElement(), and initFromValues().
|
protected |
Number of elements in class
Referenced by addElement(), classify(), classifyOld(), clear(), countMembers(), getCenter(), getElement(), and initFromValues().
|
protected |
Inverse Mahalanobi matrix values for classes
Referenced by classify(), classifyOld(), initFromValues(), and updateElement().
|
staticprotected |
Maximum number of clusters usable
|
staticprotected |
Maximum number of elements to classify
Referenced by addElement().
|
protected |
Covariance matrix values for classes
Referenced by classify(), classifyOld(), getF(), and initFromValues().
|
protected |
Cluster center
Referenced by classify(), classifyOld(), getV(), initFromValues(), and updateElement().