基本上,我有这段代码,
if(mCamera.getParameters().getMaxNumDetectedFaces()==0)
{
System.out.println("Face detection not avaliable");
}
else
{
System.out.println("Max faces: " + Integer.toString(mCamera.getParameters().getMaxNumDetectedFaces()));
}
mCamera.setFaceDetectionListener(new FaceDetectionListener() {
@Override
public void onFaceDetection(Face[] faces, Camera camera) {
// TODO Auto-generated method stub
System.out.println("Face detection callback called." + Integer.toString(faces.length));
}
});
调用 mCamera.startFaceDetection();
后,回调函数被调用,一切正常。然而,如果我更改摄像头,相同的代码导致回调永远不会被调用。 getMaxNumDetectedFaces
对于两个摄像头都返回35,因此我认为它在前置摄像头上受支持。我可以来回切换相机,并每次调用此代码,它将对后置摄像头起作用,但对前置摄像头不起作用。
我可能还做错了什么吗?