Ask Your Question

dervish79's profile - activity

2017-03-01 02:57:29 -0500 received badge  Nice Question (source)
2014-05-30 06:33:29 -0500 received badge  Necromancer (source)
2014-01-21 02:59:28 -0500 commented question Eigenface algorith can be improved!

When I initialize as: createEigenFaceRecognizer(); => recognition rate = is good, but the distance returned by predict reaches up to 5000 !!!! But some true recognitions are returned by a distance equals to about 4000, where some FALSE recognitions by a distance equals to 1500!!!!!! can some one help me to get a reasonable configuration ??

2014-01-21 02:53:29 -0500 commented question Eigenface algorith can be improved!

Can someone tell me why I get a big distance when calling predict function ?? I initialized the constructor on Test data of the same database (best case) : createEigenFaceRecognizer(30,100); => recognition rate =0 createEigenFaceRecognizer(50,100); => recognition rate =0 createEigenFaceRecognizer(0,100); => recognition rate =0

2014-01-13 04:53:05 -0500 commented question find object size in pixels

could put your code, that will help us to help you

2014-01-13 04:48:36 -0500 answered a question Software to recognize buttons of a washing machine with Kinect

If you want to use what is in the tutorial, you should to install the OpenCV library. Here you find a good description to do that.

2014-01-13 04:40:35 -0500 commented question FaceRecognizer returns always the same label

what do you mean by "normalize the values of the pixel" ? They must be in graylevel .

2014-01-13 04:36:13 -0500 received badge  Editor (source)
2014-01-13 04:34:57 -0500 answered a question Recognition Confidence

It is the euclidean distance between the test face and the closest face in DB. As I know it is not the optimal measure to get the distance.

This parameter checks how similar the input image is to each training image, and finds the most similar one: the one with the least distance in Euclidean Space. As mentioned in the Servo Magazine article, you might get better results if you use the Mahalanobis space (define USE_MAHALANOBIS_DISTANCE in the code). Reference

There you find too suggestions to improve the accuracy.

2014-01-13 04:16:26 -0500 commented question FaceRecognizer returns always the same label

As I know, The eigenface implementation does not allow saving the model. It could be the reason of the problem. To verify, I suggest you to replace model->load("eigenfaces.yml"); by train(images, labels) from the scratch.

2014-01-07 04:28:17 -0500 received badge  Student (source)
2014-01-07 03:41:36 -0500 asked a question Eigenface algorith can be improved!

This paper suggests that discarding the three most significant principal components, the variation due to lighting is reduced, then Eigenface gives better output. Q1: does somebody can suggest how to do so, or even are we able to modify the Opencv code to remove three components of PCA ? Another suggestion to be able to update the model incrementally, we can apply an incremental PCA algorithm for this purpose.

Q2: is it possible to do so on OpenCV code?

2014-01-07 02:21:39 -0500 received badge  Supporter (source)
2014-01-06 08:33:56 -0500 asked a question unstable face recognition using OpenCV

I've already asked my question in stackoverflow.

I’m developing an android application for face recognition, using JavaCV which is unofficial wrapper of OpenCV. After importing (com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer) I apply and test the following known methods:

LBPH using createLBPHFaceRecognizer() method
FisherFace using createFisherFaceRecognizer() method
EigenFace using createEigenFaceRecognizer() method

Before I recognize the detected face, I correct the rotated face and crop the proper zone, inspiring from this method

In general when I pass on camera a face already exist in the database, the recognition is ok. But this is not always correct. Sometimes it recognizes the unknown face (not found in Database of trained samples) with a high probability. When we have in the DB two or more faces of similar features (beard, mustache, glasses...) the recognition may be highly mistaken between those faces!

To predict the result using the test face image, I apply the following code:

public String predict(Mat m) {

    int n[] = new int[1];
    double p[] = new double[1];
    IplImage ipl = MatToIplImage(m,WIDTH, HEIGHT);

    faceRecognizer.predict(ipl, n, p);

    if (n[0]!=-1)
        if (n[0] != -1)
        return labelsFile.get(n[0]);
        return "Unkown";

I can’t control the threshold of the probability p, because:

Small p < 50 could predict a correct result.
High p > 70 could predict a false result.
Middle p could predict a correct or false.

As well, I don’t understand why predict() function gives sometime a probability greater than 100 in case of using LBPH??? and in case of Fisher and Eigen it gives very big values (>2000) ?? Can someone help in finding a solution for these bizarre problems? Is there any suggestion to improve robustness of recognition? especially in case of similarity of two different faces.

The following is the entire class using Facerecognizer:

import com.googlecode.javacv.cpp.opencv_imgproc; import com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer; import com.googlecode.javacv.cpp.opencv_core.IplImage; import com.googlecode.javacv.cpp.opencv_core.MatVector;

import; import android.os.Environment; import android.util.Log; import android.widget.Toast;

public class PersonRecognizer {

public final static int MAXIMG = 100;
FaceRecognizer faceRecognizer;
String mPath;
int count=0;
labels labelsFile;

 static  final int WIDTH= 128;
 static  final int HEIGHT= 128;;
 private int mProb=999;

PersonRecognizer(String path)
  faceRecognizer =  com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(2,8,8,8,200);
 // path=Environment.getExternalStorageDirectory()+"/facerecog/faces/";
 labelsFile= new labels(mPath);


void changeRecognizer(int nRec)
    switch(nRec) {
    case 0: faceRecognizer = com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(1,8,8,8,100);
    case 1: faceRecognizer = com.googlecode.javacv.cpp.opencv_contrib.createFisherFaceRecognizer();
    case 2: faceRecognizer = com.googlecode.javacv.cpp.opencv_contrib.createEigenFaceRecognizer();


void add(Mat m, String description) {
    Bitmap bmp= Bitmap.createBitmap(m.width(), m.height(), Bitmap.Config.ARGB_8888);

    bmp= Bitmap.createScaledBitmap(bmp, WIDTH, HEIGHT, false);

    FileOutputStream f;
    try {
        f = new FileOutputStream(mPath+description+"-"+count+".jpg",true);
        bmp.compress(Bitmap.CompressFormat.JPEG, 100, f);
        f.close ...