I am using Android native facedetection for my app where the bitmap is given as input and the faces should get detected. It works good for bitmap with large faces. but not working for bitmap with small faces.
I tried on a picture bitmap which contains 10 faces , but only 3 are detected.
detectedFaces=new FaceDetector.Face[NUMBER_OF_FACES];
faceDetector=new FaceDetector(resultBmp.getWidth(),resultBmp.getHeight(),NUMBER_OF_FACES);
NUMBER_OF_FACE_DETECTED=faceDetector.findFaces(resultBmp, detectedFaces);
for(int count=0;count<NUMBER_OF_FACE_DETECTED;count++)
{
if(count==0){
face1=detectedFaces[count];
midPoint1=new PointF();
face1.getMidPoint(midPoint1);
eyeDistance=face1.eyesDistance();
left1 = midPoint1.x - (float)(1.8 * eyeDistance);
right1 = midPoint1.x + (float)(1.4 * eyeDistance);
top1 = midPoint1.y - (float)(1.4 * eyeDistance);
bottom1 = midPoint1.y + (float)(1.8 * eyeDistance);
Bitmap bmface = Bitmap.createBitmap(resultBmp, (int) left1+5, (int) top1+5, (int) (2.8 * eyeDistance)+5, (int) (3.6 * eyeDistance)+5);
}
if(count==1)
{
----
}
-------------and so-on till count==10---------
}
Now please suggest me something. facedetection should work on small faces too. the picture i used is
thanks in advance
I figured it out. For those having this issue. Face detection only works on bitmap after it is converted to RGB_565 using this
BitmapFactory.Options bitmapFatoryOptions=new BitmapFactory.Options();
bitmapFatoryOptions.inPreferredConfig=Bitmap.Config.RGB_565;
mybitmapss=BitmapFactory.decodeResource(getResources(), R.drawable.familyportrait2,bitmapFatoryOptions);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With