AdvancedAndroid_Emojify
AdvancedAndroid_Emojify copied to clipboard
Application doesn't detect any face while Running last branch
Hello ! every time while testing the last branch the app show that doesn't detect any face after debugging I discover that the SparseArray "faces " length was 0 I know exactly that there is training for lessons but I cloned the last branch I think there is something missed
Thanks
I'm following the tutorials. I m also facing the same issue. faces are not detected and faces.size is 0.
I tried multiple versions of google play services following stackoverflow posts, but there is no use. Many github posts exists with no proper solution for this issue.
Chances are that the native library wasn't completely downloaded yet. The following is from the Google documentation...
The first time that an app using the Face API is installed on a device, GMS will download a native library to the device in order to do face detection. Usually this is done by the installer before the app is run for the first time. But if that download has not yet completed, then the above “detect” method will not detect any faces. This could happen if the user is not online, if the user lacks sufficient storage space on their device, or if the download is otherwise delayed (e.g., due to a slow network).
Make sure the device is connected to the internet and give it a minute or two to fully download then run the app again.
You can also check if the FaceDetector is operational by running the following test, also from the documentation...
If(!detector.isOperational()){ Log.... }
@davej33 I have tried all of them. The reasons you posted are in Stackoverflow also. Nothing solves the issue. There is no definite answer. Only google developers can solve this issue,
Hi All!
What devices are you testing on?
- Nikita
Mine is Sony z2 running lineage 7.1 ROM
Same issue in Samsung Galaxy J2 Prime =(
*edit i took some pictures from google and with works, i guess the library is not always accurate
I have the same problem on lg G2 and lg G4... searching for solution for two days now but no luck...
My solution: Go to google play settings and turn on Auto-update apps and it only work if picture is rotated correctly. In my case i have to take picture in landscape mode then turn phone in portrait (or the app will crash if I leave it in landscape mode). I don't know if it helped but i have also uninstalled app and cleared cache several times.
I have the same problem on Galaxy S7 Edge.
Agree with @Lantus81 , it only works when image rotated correctly (for this app, when it was taken in landscape mode).
According to @McFreez comment i edited the code like this, and it worked. do { //set rotation took ROTATION_0 = 0 , ROTATION_90 = 1.. frame = new Frame.Builder().setBitmap(bitmap).setRotation(i).build(); faces = faceDetector.detect(frame); if(faces.size() > 0){ break; } }while ((i++) < 4);
I have the same Issue, the detector cannot detect any faces on any devices that I tried
The issue is same like issue #19 , Take picture in landscape and faces will be detected
Same issue faced @ngamolsky
so it's almost been a year......has anyone figured out the issue? I don't want to move forward until I know because I am 100% I'll need this app in the future for a friends business app.....
Try this in addition to line 73 in BitmapUtils.java, tested in portrait mode on Google Pixel 2
Matrix matrix = new Matrix();
matrix.postRotate(-90);
Bitmap bitmapOrg = BitmapFactory.decodeFile(imagePath);
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmapOrg, bitmapOrg.getWidth(), bitmapOrg.getHeight(), true);
Bitmap rotatedBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true);
return rotatedBitmap;
Try this in addition to line 73 in BitmapUtils.java, tested in portrait mode on Google Pixel 2
Matrix matrix = new Matrix(); matrix.postRotate(-90); Bitmap bitmapOrg = BitmapFactory.decodeFile(imagePath); Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmapOrg, bitmapOrg.getWidth(), bitmapOrg.getHeight(), true); Bitmap rotatedBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true); return rotatedBitmap;
This is the fix that helped me. I noticed that the image was in landscape in the app despite the fact that I made it in portrait and I was thinking that that might have been the issue. Than I found this thread and your answer - you saved a lot of hours of research for me! Thank you!