我一直在android中乱搞facedetector和face类,似乎无法使用facedetector.findfaces方法在ics中用任何face对象填充faces数组。我试过在一个4.0模拟器上运行它,在我的galaxy nexus上运行4.0.2,这个数组从未填充过任何人脸对象。我试着在2.2仿真器上运行同一个应用程序,它运行得很好。我是错过了什么还是这是个虫子?

最佳答案

根据the documentation,位图必须为565格式。更详细地说,您应该如何加载图像:

    BitmapFactory.Options opts = new BitmapFactory.Options();
    opts.inPreferredConfig = Bitmap.Config.RGB_565;
    Bitmap bmpFindFaces = BitmapFactory.decodeFile("/path/to/image.jpg", opts);

我还以为是个虫子,因为someone reported it。也许google在4.0中改变了一些东西并更新了文档。

07-28 03:06
查看更多