Guest User

Untitled

a guest
Sep 7th, 2015
174
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data