#include <EMGaussianMixtureLibrary.h>
Public Member Functions | |
EMGaussianMixture (bool useFixedWeight, bool useFixedSigma) | |
~EMGaussianMixture () | |
void | initRandom () |
void | initMeansOnTrainingSet () |
void | setTrainingSet (Vector3< double > *newTrainingData, int newTrainingDataLength) |
void | startEM (int maxSteps) |
void | sortClusters () |
void | stepExpectation () |
int | assignToCluster (Vector3< double > &sample) |
double | gaussianProbability (Vector3< double > &sample, int cluster) |
double | posteriorProbability (Vector3< double > &sample, int cluster) |
void | stepMaximization () |
void | reestimateWeight (int cluster) |
void | reestimateMean (int cluster) |
void | reestimateSigma (int cluster) |
void | updateLookupTable () |
void | updateLookupTable (int phase) |
void | lookupColor (const Vector3< unsigned char > &fullColor, Vector3< unsigned char > &clusterColor) |
int | lookupColorNumber (const Vector3< unsigned char > &fullColor) |
void | saveLookupTable (const char *filename) |
bool | loadLookupTable (const char *filename) |
void | clusterImage (Image &clustered) |
void | visualizeClusters (Image &overview) |
void | computeRecursively (int level, int x, int y, int z) |
Public Attributes | |
double | weight [MAX_CLUSTERS] |
Vector3< double > | mean [MAX_CLUSTERS] |
Matrix3x3< double > | sigma [MAX_CLUSTERS] |
Matrix3x3< double > | sigmaInv [MAX_CLUSTERS] |
bool | sigmaInvValid [MAX_CLUSTERS] |
bool | fixedWeight |
bool | fixedSigma |
Vector3< double > * | trainingData |
int | trainingDataLength |
double * | q [MAX_CLUSTERS] |
unsigned char | lookupTable [64][64][64] |
Vector3< unsigned char > | clusterColor [MAX_CLUSTERS] |
int | equals [MAX_CLUSTERS] |
Definition at line 18 of file EMGaussianMixtureLibrary.h.
EMGaussianMixture::EMGaussianMixture | ( | bool | useFixedWeight, | |
bool | useFixedSigma | |||
) |
Definition at line 39 of file EMGaussianMixtureLibrary.cpp.
References fixedSigma, fixedWeight, and trainingDataLength.
EMGaussianMixture::~EMGaussianMixture | ( | ) |
int EMGaussianMixture::assignToCluster | ( | Vector3< double > & | sample | ) |
Definition at line 125 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, gaussianProbability(), and weight.
Referenced by computeRecursively().
void EMGaussianMixture::clusterImage | ( | Image & | clustered | ) |
Definition at line 229 of file EMGaussianMixtureLibrary.cpp.
References Image::cameraInfo, clusterColor, Image::image, lookupTable, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by ColorClustering::clusterImage(), and PanoramaImageProcessor::showDebugClusters().
void EMGaussianMixture::computeRecursively | ( | int | level, | |
int | x, | |||
int | y, | |||
int | z | |||
) |
Definition at line 524 of file EMGaussianMixtureLibrary.cpp.
References assignToCluster(), equals, lookupTable, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by updateLookupTable().
double EMGaussianMixture::gaussianProbability | ( | Vector3< double > & | sample, | |
int | cluster | |||
) |
Definition at line 142 of file EMGaussianMixtureLibrary.cpp.
References Matrix3x3< V >::invert(), mean, pi, sigma, sigmaInv, and sigmaInvValid.
Referenced by assignToCluster(), posteriorProbability(), and stepExpectation().
void EMGaussianMixture::initMeansOnTrainingSet | ( | ) |
Definition at line 79 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, mean, trainingData, and trainingDataLength.
Referenced by ColorClustering::clusteringPrepare(), and PanoramaImageProcessor::computeClusters().
void EMGaussianMixture::initRandom | ( | ) |
Definition at line 50 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, fixedWeight, mean, random(), sigma, sigmaInvValid, weight, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by ColorClustering::clusteringPrepare(), and PanoramaImageProcessor::computeClusters().
bool EMGaussianMixture::loadLookupTable | ( | const char * | filename | ) |
Definition at line 601 of file EMGaussianMixtureLibrary.cpp.
References clusterColor, CLUSTERS, equals, InFile::exists(), lookupTable, and weight.
Referenced by PanoramaImageProcessor::execute(), and ColorClustering::loadLookupTable().
void EMGaussianMixture::lookupColor | ( | const Vector3< unsigned char > & | fullColor, | |
Vector3< unsigned char > & | clusterColor | |||
) |
Definition at line 577 of file EMGaussianMixtureLibrary.cpp.
References clusterColor, lookupTable, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
int EMGaussianMixture::lookupColorNumber | ( | const Vector3< unsigned char > & | fullColor | ) |
Definition at line 590 of file EMGaussianMixtureLibrary.cpp.
References lookupTable, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by PanoramaImageProcessor::featureDetected().
double EMGaussianMixture::posteriorProbability | ( | Vector3< double > & | sample, | |
int | cluster | |||
) |
Definition at line 167 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, gaussianProbability(), and weight.
void EMGaussianMixture::reestimateMean | ( | int | cluster | ) |
Definition at line 199 of file EMGaussianMixtureLibrary.cpp.
References mean, q, trainingData, trainingDataLength, and weight.
Referenced by stepMaximization().
void EMGaussianMixture::reestimateSigma | ( | int | cluster | ) |
Definition at line 215 of file EMGaussianMixtureLibrary.cpp.
References mean, sigma, trainingData, trainingDataLength, and weight.
Referenced by stepMaximization().
void EMGaussianMixture::reestimateWeight | ( | int | cluster | ) |
Definition at line 188 of file EMGaussianMixtureLibrary.cpp.
References q, trainingDataLength, and weight.
Referenced by stepMaximization().
void EMGaussianMixture::saveLookupTable | ( | const char * | filename | ) |
Definition at line 595 of file EMGaussianMixtureLibrary.cpp.
Referenced by PanoramaImageProcessor::execute(), and ColorClustering::saveLookupTable().
void EMGaussianMixture::setTrainingSet | ( | Vector3< double > * | newTrainingData, | |
int | newTrainingDataLength | |||
) |
Definition at line 85 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, q, trainingData, and trainingDataLength.
Referenced by ColorClustering::clusteringFinish(), ColorClustering::clusteringPrepare(), PanoramaImageProcessor::computeClusters(), and ~EMGaussianMixture().
void EMGaussianMixture::sortClusters | ( | ) |
Definition at line 335 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, equals, mean, sigma, sigmaInv, sigmaInvValid, and weight.
Referenced by updateLookupTable().
void EMGaussianMixture::startEM | ( | int | maxSteps | ) |
Definition at line 328 of file EMGaussianMixtureLibrary.cpp.
References stepExpectation(), and stepMaximization().
Referenced by ColorClustering::clusteringExecute(), and PanoramaImageProcessor::computeClusters().
void EMGaussianMixture::stepExpectation | ( | ) |
Definition at line 101 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, e, gaussianProbability(), q, trainingData, and trainingDataLength.
Referenced by startEM().
void EMGaussianMixture::stepMaximization | ( | ) |
Definition at line 179 of file EMGaussianMixtureLibrary.cpp.
References CLUSTERS, fixedSigma, fixedWeight, reestimateMean(), reestimateSigma(), reestimateWeight(), and weight.
Referenced by startEM().
void EMGaussianMixture::updateLookupTable | ( | int | phase | ) |
Definition at line 457 of file EMGaussianMixtureLibrary.cpp.
References clusterColor, CLUSTERS, computeRecursively(), dist(), equals, int(), lookupTable, mean, min, sortClusters(), sqr, weight, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
void EMGaussianMixture::updateLookupTable | ( | ) |
Definition at line 376 of file EMGaussianMixtureLibrary.cpp.
References clusterColor, CLUSTERS, computeRecursively(), dist(), equals, int(), lookupTable, mean, min, sortClusters(), sqr, weight, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by PanoramaImageProcessor::computeClusters(), and FastPanoramaProcessor::frameExecute().
void EMGaussianMixture::visualizeClusters | ( | Image & | overview | ) |
Definition at line 268 of file EMGaussianMixtureLibrary.cpp.
References Image::cameraInfo, clusterColor, CLUSTERS, equals, Image::image, CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, weight, Vector3< V >::x, Vector3< V >::y, and Vector3< V >::z.
Referenced by ColorClustering::clusterImage(), and PanoramaImageProcessor::showDebugClusters().
Vector3<unsigned char> EMGaussianMixture::clusterColor[MAX_CLUSTERS] |
Definition at line 35 of file EMGaussianMixtureLibrary.h.
Referenced by clusterImage(), PanoramaImageProcessor::drawTransition(), SignatureGenerator::drawTransition(), FastPanoramaProcessor::frameExecute(), loadLookupTable(), lookupColor(), updateLookupTable(), and visualizeClusters().
int EMGaussianMixture::equals[MAX_CLUSTERS] |
Definition at line 36 of file EMGaussianMixtureLibrary.h.
Referenced by computeRecursively(), loadLookupTable(), sortClusters(), updateLookupTable(), and visualizeClusters().
Definition at line 28 of file EMGaussianMixtureLibrary.h.
Referenced by EMGaussianMixture(), and stepMaximization().
Definition at line 27 of file EMGaussianMixtureLibrary.h.
Referenced by EMGaussianMixture(), initRandom(), and stepMaximization().
unsigned char EMGaussianMixture::lookupTable[64][64][64] |
Definition at line 34 of file EMGaussianMixtureLibrary.h.
Referenced by ColorClustering::assignCluster(), clusterImage(), computeRecursively(), loadLookupTable(), lookupColor(), lookupColorNumber(), SignatureGenerator::scanPixel(), HorizonEstimator::scanPixel(), SignatureGenerator::scanPixelDetail(), and updateLookupTable().
Vector3<double> EMGaussianMixture::mean[MAX_CLUSTERS] |
Definition at line 21 of file EMGaussianMixtureLibrary.h.
Referenced by gaussianProbability(), initMeansOnTrainingSet(), initRandom(), reestimateMean(), reestimateSigma(), sortClusters(), and updateLookupTable().
double* EMGaussianMixture::q[MAX_CLUSTERS] |
Definition at line 32 of file EMGaussianMixtureLibrary.h.
Referenced by reestimateMean(), reestimateWeight(), setTrainingSet(), and stepExpectation().
Matrix3x3<double> EMGaussianMixture::sigma[MAX_CLUSTERS] |
Definition at line 22 of file EMGaussianMixtureLibrary.h.
Referenced by gaussianProbability(), initRandom(), reestimateSigma(), and sortClusters().
Matrix3x3<double> EMGaussianMixture::sigmaInv[MAX_CLUSTERS] |
Definition at line 24 of file EMGaussianMixtureLibrary.h.
Referenced by gaussianProbability(), and sortClusters().
bool EMGaussianMixture::sigmaInvValid[MAX_CLUSTERS] |
Definition at line 25 of file EMGaussianMixtureLibrary.h.
Referenced by gaussianProbability(), initRandom(), and sortClusters().
Vector3<double>* EMGaussianMixture::trainingData |
Definition at line 30 of file EMGaussianMixtureLibrary.h.
Referenced by ColorClustering::clusteringFinish(), initMeansOnTrainingSet(), reestimateMean(), reestimateSigma(), setTrainingSet(), and stepExpectation().
Definition at line 31 of file EMGaussianMixtureLibrary.h.
Referenced by EMGaussianMixture(), initMeansOnTrainingSet(), reestimateMean(), reestimateSigma(), reestimateWeight(), setTrainingSet(), and stepExpectation().
double EMGaussianMixture::weight[MAX_CLUSTERS] |
Definition at line 20 of file EMGaussianMixtureLibrary.h.
Referenced by assignToCluster(), PanoramaImageProcessor::featureDetected(), initRandom(), loadLookupTable(), posteriorProbability(), reestimateMean(), reestimateSigma(), reestimateWeight(), sortClusters(), stepMaximization(), updateLookupTable(), and visualizeClusters().