Take the 2-minute tour ×

I am trying to use FaceDetection in android. If I decode the bitmap using the below line then the faces are detected -

Bitmap myBitmap=BitmapFactory.decodeResource(getResources(), R.drawable.face5,bitmapFatoryOptions);

However if I store the same image in the sdcard and try the use the below line, faces are not detected.

Bitmap myBitmap=BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/axs" + "/face5.png");

I really dont know why this is happening. I am able to see the image on canvas in both the cases. However the first one highlights the detected faces, but not the second one. I guess there is some difference in the result bitmap when I read it both the ways.

Please suggest what I could do to get the face detection to work from sdcard.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I think I posted the question too quickly before doing a good search. Sorry for that.

I found the solution to the problem. It is basically the size of the image which creates the problem. Follow this link. Android Face detection only works with drawables not with images from SD card

share|improve this answer
add comment

Your Answer


