Android Facedetector姿势值始终为0

时间:2012-04-01 00:13:48

标签: android

所以我使用内置facedector的机器人来检测和确定位图中面部的位置。现在它起作用并告诉我:信心,眼睛距离和中点,但无论何时我试图获得姿势,无论我尝试使用什么图像,它总是返回0。

这是我用来获取姿势的代码:

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

以下是我使用的代码:

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");
            }




        }

1 个答案:

答案 0 :(得分:3)

粗略的谷歌搜索显示了大约10个不同的帖子 - 有些甚至on StackOverflow - 有相同问题的人。你找到了吗?看起来它可能是一个错误。我建议您将其报告给android bug tracker

编辑:你应该肯定提交错误。看一下人脸检测源代码:this source file表明Android永远不会将这些设置为0以外的任何内容。

在此更改之前,Android还有其他CV选项。查看OpenCV for Android,现在该团队正式支持。