Search code examples
androidimage-processingface-detection

"return 0 faces because error exists btk_facefinder_putdcr" Error in Android face detector


fd = new FaceDetector(mFaceWidth, mFaceHeight, MAX_FACES);
count = fd.findFaces(mFaceBitmap, faces);

Using the above code I'm getting this error on some images.

return 0 faces because error exists btk_facefinder_putdcr

Can someone help me? How to get rid of this?

The same code works fine for some other images.


Solution

  • http://blog.csdn.net/devilkin64/article/details/8509767 传入的图片的宽度必须是偶数的

    Bitmap srcImg = BitmapFactory.decodeFile(imgUrl);
        Bitmap srcFace = srcImg.copy(Bitmap.Config.RGB_565, true);
        srcImg = null;
        int w = srcFace.getWidth();
        int h = srcFace.getHeight();
        if (w % 2 == 1) {
            w++;
            srcFace = Bitmap.createScaledBitmap(srcFace,
                    srcFace.getWidth()+1, srcFace.getHeight(), false);
        }
        if (h % 2 == 1) {
            h++;
            srcFace = Bitmap.createScaledBitmap(srcFace,
                    srcFace.getWidth(), srcFace.getHeight()+1, false);
        }