Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Facedetector pose values are always 0

Tags:

android

So I'm using androids built in facedector to detect and determine the position of faces in a bitmap. Right now it works and will tell me: confidence, eyesDistance and midpoint but whenever i try to get the pose it always returns 0 no matter what images i try using.

This is the code I use to get the pose:

poseString = "Pose: (" + getFace.pose(FaceDetector.Face.EULER_X) + ","
                        + getFace.pose(FaceDetector.Face.EULER_Y) + ","
                        + getFace.pose(FaceDetector.Face.EULER_Z) + ")";

And here is the code I use:

arrayFaces = new FaceDetector(picWidth, picHeight, NUM_FACES);
        arrayFaces.findFaces(sourceImage, getAllFaces);

        for (int i = 0; i < getAllFaces.length; i++) {
            getFace = getAllFaces[i];
            try {
                PointF eyesMP = new PointF();
                getFace.getMidPoint(eyesMP);
                poseString = "Pose: ("+ getFace.pose(FaceDetector.Face.EULER_X) + ","
                        + getFace.pose(FaceDetector.Face.EULER_Y) + ","
                        + getFace.pose(FaceDetector.Face.EULER_Z) + ")";
                EULER_X = getFace.EULER_X;
                EULER_Y = getFace.EULER_Y;
                EULER_Z = getFace.EULER_Z;      

                eyesDistance[i] = getFace.eyesDistance();
                eyesMidPts[i] = eyesMP;

                if (DEBUG) {
                    currentx = eyesMidPts[i].x;
                    currenty = eyesMidPts[i].y;
                    betweeneyes = getFace.eyesDistance();

                    Log.d("currentx", currentx + "");
                    Log.d("currenty", currenty + "");
                    Log.d("betweeneyes", betweeneyes + "");
                    Log.d("EULER", "EULER_X: " + EULER_X + "EULER_Y: " + EULER_Y + "EULER_Z: " + EULER_Z);

                    Log.i("Face", i + " " + getFace.confidence() + " "
                            + getFace.eyesDistance() + " " + "Pose: ("
                            + getFace.pose(FaceDetector.Face.EULER_X) + ","
                            + getFace.pose(FaceDetector.Face.EULER_Y) + ","
                            + getFace.pose(FaceDetector.Face.EULER_Z) + ")"
                            + "Eyes Midpoint: (" + eyesMidPts[i].x + ","
                            + eyesMidPts[i].y + ")");
                }
            } catch (Exception e) {
                if (DEBUG)
                    Log.e("Face", i + " is null");
            }




        }
like image 571
Peter Avatar asked Apr 01 '12 00:04

Peter


1 Answers

A cursory google search shows about 10 different posts--some even on StackOverflow--of people with the same problem. Did you find these? It looks like it might be a bug. I suggest you report it to the android bug tracker.

Edit: You should definitely file a bug. Take a look at the face detection source code: this source file shows that Android will never set these to anything but 0.

Until this changes, there are other CV options for Android. Check out OpenCV for Android, which is now officially supported by the team.

like image 110
sastraxi Avatar answered Oct 01 '22 20:10

sastraxi