我正在尝试获取 leftEye 和 rightEye 的坐标并从 leftEye 到 rightEye 画一条线,但返回的坐标为空。我正在使用 Nexus 4 来测试应用程序。Nexus 4 不支持这个功能??我可以在检测到的人脸周围画一个矩形,没有任何问题。作为参考,我附上了用于检测眼睛坐标的代码。
try{
float x1 = detectedFaces[i].leftEye.x;
float y1 = detectedFaces[i].leftEye.y;
float x2 = detectedFaces[i].rightEye.y;
float y2 = detectedFaces[i].rightEye.y;
//Converting from driver coordinate to view coordinate
float Xx1 = (x1+1000) * vWidth/2000;
float Yy1 = (y1+1000) * vHeight/2000;
float Xx2 = (x2+1000) * vWidth/2000;
float Yy2 = (y2+1000) * vHeight/2000;
canvas.drawLine(Xx1, Yy1, Xx2, Yy2, drawingPaint);
}
catch(Exception e){
Log.e(TAG, "Error: " +e.getMessage());
}
日志猫
11-15 16:37:52.895: E/Take_Picture(1304): Error: null
11-15 16:37:53.115: E/Take_Picture(1304): Error: null
11-15 16:37:53.286: E/Take_Picture(1304): Error: null