Update em.cpp

Fix a bug. When reading from a saved model, function decomposeCovs() will be called. And if covMatType is COV_MAT_DIAGONAL, covsEigenValues is computed using SVD and eigen values are sorted so that the order of eigen values is not preserved. This would lead to different result when calling function predict2. This issues is discussed here: http://stackoverflow.com/questions/23485982/got-different-empredict-results-after-emread-saved-model-in-opencv.
This commit is contained in:
art-programmer 2015-09-14 19:35:53 -05:00
parent 9533982729
commit e0ef293645

View File

@ -379,7 +379,7 @@ public:
}
else if(covMatType == COV_MAT_DIAGONAL)
{
covsEigenValues[clusterIndex] = svd.w;
covsEigenValues[clusterIndex] = covs[clusterIndex].diag().clone(); //Preserve the original order of eigen values.
}
else //COV_MAT_GENERIC
{