Ask Your Question

Maharacha's profile - activity

2016-05-15 20:18:27 -0600 commented question Add a public function to face recognition src-file

Ok I see, but it helped me so thanks :)

2016-05-15 09:12:51 -0600 commented question Add a public function to face recognition src-file

@berak answered my question but it is only visible under my notification, don't know why... Anyway his first suggestion worked fine!

1: the easy way, have a base implementation:

class CV_EXPORTS_W FaceRecognizer : public Algorithm {
public:
    CV_WRAP virtual void test() {} // <-- that's all !
};

class LBPH : public LBPHFaceRecognizer {
public:
void test();
};
void LBPH::test() {
    std::cout << "test function" << std::endl; // do someting special..
}
2016-05-15 07:37:51 -0600 asked a question Add a public function to face recognition src-file

I have a c++ program from where I can create a LBPHFaceRecognizer, train it with with data, send an image for prediction etc. But now I want to customize lbph_faces.cpp. I can change/add private stuff in it, build and compile, and it works fine but when I try to add something public I get lost. Can someone tell me, if I want to add a public function in lbph_faces.cpp, what do I have to do? Which headerfiles do I have to update?

Example:

lbph_faces.cpp

class LBPH : public LBPHFaceRecognizer {
public:
void test();
};
void LBPH::test() {
    std::cout << "test function" << std::endl;
}

My program has

#include "opencv2/face.hpp"

And if I try to add the test-function in face.hpp like this for example:

class CV_EXPORTS_W FaceRecognizer : public Algorithm {
public:
    CV_WRAP virtual void test();
};

I get:

Undefined symbols for architecture x86_64:
  "cv::face::BasicFaceRecognizer::test()", referenced from:
      vtable for cv::face::Eigenfaces in eigen_faces.cpp.o
      vtable for BasicFaceRecognizerImpl in eigen_faces.cpp.o
      vtable for cv::face::Fisherfaces in fisher_faces.cpp.o
      vtable for BasicFaceRecognizerImpl in fisher_faces.cpp.o
  "typeinfo for cv::face::FaceRecognizer", referenced from:
      typeinfo for cv::face::LBPHFaceRecognizer in lbph_faces.cpp.o
  "typeinfo for cv::face::BasicFaceRecognizer", referenced from:
      typeinfo for BasicFaceRecognizerImpl in eigen_faces.cpp.o
      typeinfo for BasicFaceRecognizerImpl in fisher_faces.cpp.o
  "vtable for cv::face::FaceRecognizer", referenced from:
      BasicFaceRecognizerImpl::~BasicFaceRecognizerImpl() in eigen_faces.cpp.o
      BasicFaceRecognizerImpl::~BasicFaceRecognizerImpl() in fisher_faces.cpp.o
      cv::face::LBPH::~LBPH() in lbph_faces.cpp.o
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)