54 float getDistance(
const GaussianMixtureDistributionBasePtr& gmm1,
const GaussianMixtureDistributionBasePtr& gmm2)
override
61 const Eigen::VectorXf d = g2->toEigenMean() - g1->toEigenMean();
62 const Eigen::MatrixXf
s = 2 * (g1->toEigenCovariance() + g2->toEigenCovariance());
63 const Eigen::MatrixXf distm = d.transpose() *
s.inverse() * d;
65 return sqrtf(distm(0, 0));
68 float getWeigtedDistance(
const GaussianMixtureDistributionBasePtr& gmm,
const NormalDistributionBasePtr& g)
74 for (
int i = 0; i < gmm->size(); ++i)
76 const GaussianMixtureComponent comp = gmm->getComponent(i);
79 result += getDistance(g1, g2) * comp.weight;
85 float getDistance(
const GaussianMixtureComponent& comp1,
const GaussianMixtureComponent& comp2)
override
90 Eigen::VectorXf d = gaussian2->toEigenMean() - gaussian1->toEigenMean();
91 Eigen::MatrixXf
s = 2 * (comp1.weight * gaussian1->toEigenCovariance() + comp2.weight * gaussian2->toEigenCovariance()) / (comp1.weight + comp2.weight);
92 Eigen::MatrixXf distm = d.transpose() *
s.inverse() * d;
97 return sqrtf(distm(0, 0));