Ask Your Question

Afnman's profile - activity

2016-12-27 02:07:16 -0500 received badge  Popular Question (source)
2013-01-30 02:51:25 -0500 answered a question LBP recognizer model for face recognition

By setting a threshold. ex. model->set("threshold", 100.0) Anything above 100.0 will be considered as alien

2013-01-16 03:23:55 -0500 received badge  Supporter (source)
2013-01-16 03:10:03 -0500 commented answer in Opencv4Android 2.4.3

Sorry, I can't accept my own answer due to......50 points thing.

2012-12-14 02:57:23 -0500 received badge  Self-Learner (source)
2012-11-29 01:58:51 -0500 commented answer Help ! Opencv FaceRecognition can not predicte new face?

That's my problem too. Maybe in your case you can find it with trials and errors. Others set the threshold as the maximum value of minimum Euclidean distances of each face from other faces In general case, the threshold varies according to illuminations,faces background,translations etc. It If you find something that works for all situations, I would like to know it.

2012-11-28 01:59:07 -0500 answered a question Help ! Opencv FaceRecognition can not predicte new face?

You must set a threshold for your Face Recognition Algorithm.For Example:

Ptr<FaceRecognizer> model = createEigenFaceRecognizer()
    model->set("threshold", 3000.0);

if the distance of your tested face from the trained face is above 3000.0 (threshold) then will be considered as unknown (-1).

See details here:

2012-11-26 05:42:35 -0500 answered a question in Opencv4Android 2.4.3

I have found a solution to my problem by doing this trick:

 Ptr<FaceRecognizer> model =createLBPHFaceRecognizer();
 jlong ptr =(jlong)model.obj;

where ptr is the nativeObject's address.

2012-11-26 03:54:28 -0500 answered a question in Opencv4Android 2.4.3

Thank you very much for your answers. Actually, after this(in JNI function):

 FaceRecognizer* model = createLBPHFaceRecognizer();
int k=model->getInt("radius");  //error here

I get segfault but if I use Ptr<facerecognizer> model=createLBPHFaceRecognizer() then I don't. I still have issues with the pointer returned by createLBPHFaceRecognizer.

I have done this:

-First I call

 JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_LBPFaceRecognizer_nativeCreateObject (JNIEnv * jenv, jclass) { FaceRecognizer* model = createLBPHFaceRecognizer();
return (jlong)model; }

that returns jlong memory address and stored it in my wrapper object.

Then I call

JNIEXPORT int JNICALL Java_org_opencv_samples_fd_LBPFaceRecognizer_nativeGetNeighbor
(JNIEnv * jenv, jclass, jlong ptr) {
int neigh=((FaceRecognizer*)ptr)->getInt("radius"),
return neigh;

with ptr equal to model's address returned by the previous function (nativeCreateObject) I still get segfault.

2012-11-23 05:32:44 -0500 received badge  Student (source)
2012-11-23 03:44:22 -0500 received badge  Editor (source)
2012-11-23 03:38:29 -0500 asked a question in Opencv4Android 2.4.3

Hello, I am trying to use FaceRecognizer class (from contrib folder).

I have created LBPFaceRecognizer class that inherits from FaceRecognizer class with one method nativecreateObject.

the corresponding JNI nativecreateOBject function:

   JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_LBPFaceRecognizer_nativeCreateObject
(JNIEnv * jenv, jclass)
     Ptr<FaceRecognizer> model;
              model= createLBPHFaceRecognizer();   
return  (jlong)model.obj; //Problem here!?!?!?!? What should I return?

Then I call the nativeCreateObject in the constructor of LBPFaceRecognizer:

public LBPFaceRecognizer() {

The problem is here: (inside the OnManagerConnected()):

BPFaceRecognizer model= new LBPFaceRecognizer();    
                 int r=model.getInt("radius"); //!?!?! CRASH HERE

I get Fatal signal 11 (SIGSEGV) at 0x00000028. when the native method getInt0(nativeObject,"radious") is called.

how can I use the FaceRecognizer ??