3

I'm using Mobile Vision API to count number of people in a captured image. I took reference from here and here. Following is code snippet i'm using.

FaceDetector detector = new FaceDetector.Builder(getApplicationContext())
            .setTrackingEnabled(false)
            .setLandmarkType(FaceDetector.ALL_LANDMARKS)
            .setClassificationType(FaceDetector.ALL_CLASSIFICATIONS)
            .build();
...

Frame frame = new Frame.Builder().setBitmap(editedBitmap).build();
SparseArray<Face> faces = detector.detect(frame);
int peopleCount = faces.size();

But it is detecting only when the persons are looking into the camera. I need to count people whose face is completely or partially visible and, can skip people whose face is completely not visible. I seen some samples using OpenCV. but it isn't properly documented. Is there any way to do it in a better way? Any snippet or algorithm will be great helpful.

Srikanth
  • 1,555
  • 12
  • 20
  • I think `setMinFaceSize()` method can help you to select people they visible in the picture. See this "https://developers.google.com/android/reference/com/google/android/gms/vision/face/FaceDetector.Builder.html#setMinFaceSize(float)" – Crammeur Jul 26 '18 at 22:50
  • Hi Srikanth, have you got any solution regarding this? I am facing the same problem. – Sanat Pandey Jan 22 '20 at 12:08

0 Answers0