所以我使用
facedector中构建的机器人来检测和确定位图中面部的位置.现在它起作用并告诉我:信心,眼睛距离和中点,但每当我试图获得姿势时,无论我尝试使用什么图像,它总是返回0.
poseString = "Pose: (" + getFace.pose(FaceDetector.Face.EULER_X) + "," + getFace.pose(FaceDetector.Face.EULER_Y) + "," + getFace.pose(FaceDetector.Face.EULER_Z) + ")";@H_404_5@这是我使用的代码:
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_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"); } }@H_404_5@
解决方法
一个粗略的谷歌搜索显示大约10个不同的帖子 – 有些甚至
on StackOverflow – 有相同问题的人.你找到了吗?看起来它可能是一个bug.我建议你把它报告给
android bug tracker.
编辑:你一定要提交一个bug.看看人脸检测源代码:this source file显示Android永远不会将这些设置为0以外的任何内容.
在此更改之前,Android还有其他CV选项.查看OpenCV for Android,该团队现已正式支持.