AdvancedAndroid_Emojify icon indicating copy to clipboard operation
AdvancedAndroid_Emojify copied to clipboard

Application doesn't detect any face while Running last branch

Open mohammedgmgn opened this issue 8 years ago • 16 comments
trafficstars

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

mohammedgmgn avatar May 01 '17 15:05 mohammedgmgn

I'm following the tutorials. I m also facing the same issue. faces are not detected and faces.size is 0.

arvind-g avatar May 01 '17 15:05 arvind-g

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.

arvind-g avatar May 01 '17 18:05 arvind-g

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 avatar May 02 '17 17:05 davej33

@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,

arvind-g avatar May 04 '17 13:05 arvind-g

Hi All!

What devices are you testing on?

  • Nikita

ngamolsky avatar May 10 '17 18:05 ngamolsky

Mine is Sony z2 running lineage 7.1 ROM

arvind-g avatar May 10 '17 18:05 arvind-g

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

FilipeLipan avatar May 14 '17 21:05 FilipeLipan

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.

akristic avatar Jun 08 '17 05:06 akristic

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).

McFreez avatar Jun 08 '17 11:06 McFreez

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);

mehmetsalihkurt avatar Jun 12 '17 19:06 mehmetsalihkurt

I have the same Issue, the detector cannot detect any faces on any devices that I tried

levulinh avatar Aug 01 '17 03:08 levulinh

The issue is same like issue #19 , Take picture in landscape and faces will be detected

jawadhassan avatar Oct 01 '17 05:10 jawadhassan

Same issue faced @ngamolsky

Smita07374 avatar Mar 23 '18 04:03 Smita07374

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.....

ddeleon92 avatar Apr 29 '18 13:04 ddeleon92

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;

aznxed avatar Jun 30 '18 20:06 aznxed

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!

javierfurus avatar Apr 13 '19 09:04 javierfurus