How do I change predict method in class FaceRecognizer
I trying to custom predict method for my application, but doesn't work. How can I do this?
I wanna change this part in facerec.cpp, where would be calculated Mahalanobis distance:
for(size_t sampleIdx = 0; sampleIdx < _projections.size(); sampleIdx++) {
double dist = norm(_projections[sampleIdx], q, NORM_L2);
if((dist < minDist) && (dist < _threshold)) {
minDist = dist;
minClass = _labels.at<int>((int)sampleIdx);
}
}
I change in contrib.hpp to:
virtual int predict(InputArray src,int distance) const = 0;
where distance
is the type identifier of the distance to be calculated (Euclidian, Mahalanobis, Cosine)
what are you trying ? where did it went wrong ? what did you customize ?
-1 for "it doesn't work"
which one is it, actually ? eigen, lbp, fisher ? ah eigen ( looking at the code )
But I will change for three.
still, you'll have to change fisher and lbp as well,
and, believe me, you don't want mahalanobis distance with lbp ( chi_square is the recommended distance there [histograms] )