Face recognition using android sdk not opencv

依然范特西╮ 提交于 2019-11-27 13:29:49

问题


I am currently work on face recognition in android. I spent reasonable time on internet and I found FaceDetector.Face class in Android. And these are the utilities of this class:

 Constants
 float  CONFIDENCE_THRESHOLD
 int    EULER_X The x-axis Euler angle of a face.
 int    EULER_Y The y-axis Euler angle of a face.
 int    EULER_Z The z-axis Euler angle of a face.

 Public Methods
 float   confidence()
 float   eyesDistance()
 void    getMidPoint(PointF point)
 float   pose(int euler)

The problem is, I do not know how to use these methods and I cannot find any tutorial or example source code for this. The question is, should I use eyesDistance() for differenciating the people? For example Sarah's eyesDistance is= 6.51 cm and John's is= 6.82. When the code calculates a persons eyes distance and when it is 6.82, is it tell you that "it is john" is this the way for identifind the people? Or what is the algorithm for that? Or should I use EULER constants? In what way? I think I am going to use these methods for face recognition, but I do not know how to use it.

Or can you suggest another solution for face recognition? Any help would be appreciated.


回答1:


The FaceDetector class doesn't do what you think it does. Specifically, it doesn't do Facial Recognition, but instead Facial Detection (hence the class name).

It analyzes an image and returns Faces found in the image. It makes no distinction between Faces (you can't tell if it's John's Face or Sarah's Face) other than the distance between their eyes - but that isn't really a valid comparison point. It just gives you the Faces found and the confidence level that the objects found are actually Faces.

Ex:

int maxNumFaces = 2; // Set this to whatever you want
FaceDetector fd = new FaceDetector(imageWidth,imageHeight,maxNumFaces);
Faces[] faces = new Faces[maxNumFaces];

try {
  int numFacesFound = fd.findFaces(image, faces);

  for (int i = 0; i < maxNumFaces; ++i) {
     Face face = faces[i];
     Log.d("Face " + i + " found with " + face.confidence() + " confidence!");
     Log.d("Face " + i + " eye distance " + face.eyesDistance());
     Log.d("Face " + i + " pose " + face.pose());
     Log.d("Face " + i + " midpoint (between eyes) " + face.getMidPoint());
  }
} catch (IllegalArgumentException e) {
  // From Docs:
  // if the Bitmap dimensions don't match the dimensions defined at initialization 
  // or the given array is not sized equal to the maxFaces value defined at 
  // initialization
}



回答2:


As Tushar said, the FaceDetector only detects the faces. You can't recognize them using FaceDetector though. The eye distance output is measured in pixels, not in cm or inches. It represents how big the face is inside the bitmap image. The euler angles are supposed to represent the 3D rotation of the head. However, if your app uses any api before 14, the euler angles values will always be 0.0 (they are not computed). So, take care with this.

If you want to do face recognition, you can use opencv. I haven't used it myself, but I think it is available on Android. Face Recognition in OpenCV http://docs.opencv.org/trunk/modules/contrib/doc/facerec/

If you don't want or can't add OpenCV to your project, you can program the face recognition by yourself. It take some time, but it's not so hard. You can implement some variation of eigenfaces: http://www.youtube.com/watch?v=LYgBqJorF44&list=PLd3hlSJsX_Imk_BPmB_H3AQjFKZS9XgZm&index=16

Good luck!




回答3:


you use this link,may be is helpful for you. http://www.edumobile.org/android/android-programming-tutorials/face-detection-example-tutorials-in-android/



来源:https://stackoverflow.com/questions/15526964/face-recognition-using-android-sdk-not-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!