Camera startFaceDetection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Camera startFaceDetection method.

This code example shows how to use the following methods:getParameters, setPreviewDisplay, startFaceDetection, startPreview, stopPreview
          return; 
        } 
 
        // stop preview before making changes 
        try { 
            mCamera.stopPreview();
        } catch (Exception e){
          // ignore: tried to stop a non-existent preview 
        } 
 
        // set preview size and make any resize, rotate or 
        // reformatting changes here 
 
        // start preview with new settings 
        try { 
            mCamera.setPreviewDisplay(mHolder);
            mCamera.startPreview();
 
            Camera.Parameters params = mCamera.getParameters();
 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getParameters, setFaceDetectionListener, startFaceDetection, startPreview
	} 
 
	public void surfaceChanged(SurfaceHolder holder, int format, int width,
			int height) {
 
		param = camera.getParameters();
		System.out.println("gets parameters");
		System.out.println("Max num faces " + param.getMaxNumDetectedFaces());
		System.out.println("sets size");
		try { 
 
			camera.setParameters(param);
			System.out.println("sets parameters");
		} catch (Exception e) {
			e.printStackTrace();
		} finally { 
			camera.startPreview();
 
			if (param.getMaxNumDetectedFaces() > 0) {
				camera.startFaceDetection();

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getParameters, setDisplayOrientation, setFaceDetectionListener, setPreviewDisplay, startFaceDetection
        surfaceHolder.addCallback(this);
        surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); // deprecated, but required on Android versions prior to 3.0
    } 
     
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
		mCamera.stopPreview();
		isPreviewing = false;
		previewWidth = width;
		previewHeight = height;
		 
		// Make any parameter changes here, while camera is not previewing 
		 
		if(mCamera != null) {
    		try { 
    			mCamera.setPreviewDisplay(surfaceHolder);
    			mCamera.setDisplayOrientation(90); // Needed to have camera in correct orientation
    			mCamera.setFaceDetectionListener(new MyFaceDetectionListener());
    		    mCamera.startPreview();
    		    isPreviewing = true;
    		    startFaceDetection(); // start face detection feature 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getParameters, setPreviewDisplay, startFaceDetection, startPreview
    public void surfaceCreated(SurfaceHolder holder) {
        // The Surface has been created, now tell the camera where to draw the preview. 
        Log.d("DEBUG", "Surface created");
 
        try { 
            mCamera.setPreviewDisplay(holder);
            mCamera.startPreview();
             
            Camera.Parameters params = mCamera.getParameters();
 
            // start face detection only *after* preview has started 
            if (params.getMaxNumDetectedFaces() > 0){
                // camera supports face detection, so can start it: 
                mCamera.startFaceDetection();
                Log.d("DEBUG", "Face detection started");
            } 
             
        } catch (IOException e) {
            Log.d(TAG, "Error setting camera preview: " + e.getMessage());
        } 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getParameters, startFaceDetection
        } 
    } 
     
    public void startFaceDetection(){ 
        // Try starting Face Detection 
        Camera.Parameters params = mCamera.getParameters();
 
        // start face detection only *after* preview has started 
        if (params.getMaxNumDetectedFaces() > 0){
            // camera supports face detection, so can start it: 
            mCamera.startFaceDetection();
        } 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
startFaceDetection Method Overview
Starts the face detection.
See Code Examples for other Android Camera Methods: