Face recognition using android sdk not opencv

后端 未结 2 1164
情书的邮戳
情书的邮戳 2020-12-14 12:37

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 c

相关标签:
2条回答
  • 2020-12-14 13:09

    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!

    0 讨论(0)
  • 2020-12-14 13:11

    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).

    An example of Facial Detection

    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
    }
    
    0 讨论(0)
提交回复
热议问题