简体   繁体   English

无法从SD卡Android运行人脸检测

[英]Unable to get facedetection to work from sdcard android

I am trying to use FaceDetection in android. 我正在尝试在Android中使用FaceDetection。 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. 但是,如果我将相同的图像存储在sdcard中并尝试使用下面的行,则不会检测到脸部。

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. 请提出我可以做些什么来使sdcard上的人脸检测正常工作。

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 Android人脸检测仅适用于可绘制对象,不适用于SD卡中的图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM