我正在尝试将我的 SurfaceView(相机预览)转换为位图以进行动态人脸检测。我收到一个非空图像,但是当我将它显示到视图上时,它看起来是纯黑色的。任何想法可能是什么原因以及如何进行?
(我相信从 SurfaceView 中提取位图很困难但并非不可能 - 但没有人发布任何解决方案)
class BackgroundView extends SurfaceView implements SurfaceHolder.Callback {
public BackgroundView(Context context) {
super(context);
// ...
setDrawingCacheEnabled(true);
}
// ...
}
private Runnable update = new Runnable() {
public void run() {
// Following statement is sending a black/blank image
faceView.updateFaces(backgroundView.getDrawingCache());
mHandler.postDelayed(update, (long) (1000));
}
};