Android Face Detection

I use the native Android interface for my application, where the bitmap is set as an input signal, and faces should be detected. It works great for bitmaps with large faces. but does not work for a bitmap with small edges.

I tried using a bitmap containing 10 faces, but only 3 were found.

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 offer me something. faceteection should work on small faces. used picture enter image description here

early

+4
source share
1 answer

I understood that. For those who have this problem. Face recognition only works with a 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); 
+11
source

Source: https://habr.com/ru/post/1502960/


All Articles