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.