0

Excuse the hasty code dump. I'm working with OpenCV at the moment. I've been stuck with an error for 2h.

- (IBAction)faceRecognition:(id)sender {
// load images
vector<Mat> images;
vector<int> labels;

int numberOfSubjects = 4;
int numberPhotosPerSubject = 3;

for (int i=1; i<=numberOfSubjects; i++) {
    for (int j=1; j<=numberPhotosPerSubject; j++) {
        // create grayscale images
        Mat src = [self CreateIplImageFromUIImage:[UIImage imageNamed:[NSString stringWithFormat:@"%d_%d.jpg", i, j]]];
        Mat dst;
        cv::cvtColor(src, dst, CV_BGR2GRAY);

        images.push_back(dst);
        labels.push_back(i);
    }
}

// get test instances
Mat testSample = images[images.size() - 1];
int testLabel = labels[labels.size() - 1];

// ... and delete last element
images.pop_back();
labels.pop_back();

// build the Fisherfaces model
Fisherfaces model(images, labels);

// test model
int predicted = model.predict(testSample);
cout << "predicted class = " << predicted << endl;
cout << "actual class = " << testLabel << endl;

}

I can't figure out how to fix this:

Variable type 'cv::Fisherfaces' is an abstract class

It appears under "//build the Fisherfaces model" in the bottom.

Any assistance greatly appreciated.

AppCodinz
  • 1
  • 5
  • The public interface is the factory function, `Ptr createFisherFaceRecognizer(int num_components, double threshold)`. (The class doesn't even have a public definition, so you must have jumped through some hoops just to be able to declare the variable.) – molbdnilo Jun 15 '16 at 07:53
  • @molbdnilo I have an imported "facerec.hpp" file where most of the magic happens. (https://www.dropbox.com/s/hpzwbrpauma5ezm/facerec.hpp?dl=0) – AppCodinz Jun 15 '16 at 10:55

0 Answers0