Java – face detection is not applicable to front camera

So basically I have this code,

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));


            }


        });

Call mcamera startFaceDetection(); After calling the callback, everything is normal However, if I change the camera, the same code will cause the callback to never be called Getmaxnumdetectedfaces returns 35 for two cameras, so I think it supports the front camera I can change the camera back and forth. Every time I call this code, it will apply to the rear camera, but not to the front camera

Is there anything else I might have done wrong?

Solution

The quality of the camera is impossible (the previous one, right?) Is face detection accurate enough? The camera image may be too noisy for the face detector to work There are many other variables that may hinder this

Also search the front camera. Points that look like the front camera may be mirrored This is described below: http://developer.android.com/reference/android/hardware/Camera.Face.html

I hope it helps

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>