0

I'm trying to detect faces inside a thread. outside of that thread it works pretty well , so I don't understand why the listener is never called.another important thing-it's implemented inside a GLSurfaceView class. the relevant code inside that thread (the thread constructor and then the thread function startPreview that should make the detection):

public CameraThread(final CameraGLView parent) {
        super("Camera thread");
        this.myFaceDetector = new Camera.FaceDetectionListener() {
            @Override
            public void onFaceDetection(Camera.Face[] faces, Camera camera) {
                Log.v("face detect", "face");
            }//myFaceDetector;
        };
    }
private final void startPreview(final int width, final int height) {    
    try {
                CAMERA_ID = findFrontFacingCamera();//front camera id
                mCamera = Camera.open(CAMERA_ID);
                mCamera.setFaceDetectionListener(myFaceDetector);
        }
        Camera.Parameters params = mCamera.getParameters();

        if (params.getMaxNumDetectedFaces() > 0) {
            mCamera.startFaceDetection();
        }
 }
Gilad Levinson
  • 234
  • 2
  • 12

0 Answers0