Ask Your Question

Bruno Teixeira's profile - activity

2013-03-17 18:11:31 -0600 received badge  Supporter (source)
2013-03-16 19:39:09 -0600 commented question How do I change predict method in class FaceRecognizer

But I will change for three.

2013-03-16 19:32:30 -0600 received badge  Editor (source)
2013-03-16 19:17:24 -0600 asked a question 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)