Advertisement
Guest User

Untitled

a guest
Sep 7th, 2015
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. Mat covar, invcovar, mean;
  2. for(size_t sampleIdx = 0; sampleIdx < _projections.size(); sampleIdx++) {
  3.  
  4. calcCovarMatrix(_projections[sampleIdx], covar, mean, CV_COVAR_SCRAMBLED|CV_COVAR_ROWS,CV_64F); //Calculating the covariance matrix
  5. invert(covar, invcovar, DECOMP_SVD); //Calculating the inverse covariance matrix
  6. double dist=Mahalanobis( _projections[sampleIdx], q, invcovar );
  7. // Add to the resulting distance array:
  8. if(distances.needed()) {
  9. distances.getMat().at<double>(sampleIdx) = dist;
  10. }
  11. if((dist < minDist) && (dist < _threshold)) {
  12. minDist = dist;
  13. minClass = _labels.at<int>((int)sampleIdx);
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement