0

So I'm trying to implement the Face Recognizer methods from the contributed section of the OpenCV API on Android. The API documentation can be found here: http://docs.opencv.org/modules/contrib/doc/facerec/facerec_api.html

The problem I'm having is that in the Java API, the train method is:

public  void train(List<Mat> src, Mat labels){
    Mat src_mat = Converters.vector_Mat_to_Mat(src);
    train_0(nativeObj, src_mat.nativeObj, labels.nativeObj);

    return;
}

I cannot for the life of me, get the call to work because of the (Mat) labels input. In the c++ documentation it calls for a vector of integers, so I tried passing a 1D Mat, but no luck. Anyone had this problem or have some insight on how to tackle this?

Dan
  • 66
  • 5
  • you're not trying to *implement* it, but *use* it, right ? – berak Feb 13 '14 at 18:17
  • Yes you are correct, sorry for the incorrect language. I guess I am going to have to implement something though after seeing your response. – Dan Feb 13 '14 at 18:38

1 Answers1

1

oh dear, looks like you haven't found out, that you cannot create a FaceRecognizer in the opencv java api as of now ?

it's a known bug, you would need some jni skills to build the missing factory functionality.

unless you solve that, don't worry about the labels ...

berak
  • 39,159
  • 9
  • 91
  • 89
  • Well that sucks. Is it worth my time to write my own methods in jni? Is there another route for getting this done that would be better? Thanks for the quick response above too, I was getting pretty frustrated. – Dan Feb 13 '14 at 18:36
  • 1
    well if you're good with jni, it's all about recreating the createXXXFaceRecognizer() methods. if not, maybe have a look at javacv. ( i hate their api, because they're mostly using the old shitty c-api, but htey got the facereco part working at least ) – berak Feb 13 '14 at 18:46
  • @berak, do you know if there any fork on git hub of opencv project with implemented JNI of FaceRecognizer? – Johnny Apr 17 '15 at 03:33
  • opencv3.0 has it fixed now. – berak Apr 17 '15 at 05:39