.setFacing(CameraSource.CAMERA_FACING_BACK) .setRequestedPreviewSize(metrics.heightPixels, metrics.widthPixels) .setAutoFocusEnabled(true) .setRequestedFps(10.0f);
private void createCameraSource() { BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(this).build(); final CameraSource cameraSource = new CameraSource.Builder(this, barcodeDetector) .setAutoFocusEnabled(true) .setRequestedPreviewSize(1600, 1024) .build();
.setRequestedPreviewSize(1280, 1024) .setRequestedFps(2.0f) .setAutoFocusEnabled(true) .build();
/** * Creates the face detector and the camera. */ private void createCameraSource() { Context context = getApplicationContext(); FaceDetector detector = createFaceDetector(context); int facing = CameraSource.CAMERA_FACING_FRONT; if (!mIsFrontFacing) { facing = CameraSource.CAMERA_FACING_BACK; } // The camera source is initialized to use either the front or rear facing camera. We use a // relatively low resolution for the camera preview, since this is sufficient for this app // and the face detector will run faster at lower camera resolutions. // // However, note that there is a speed/accuracy trade-off with respect to choosing the // camera resolution. The face detector will run faster with lower camera resolutions, // but may miss smaller faces, landmarks, or may not correctly detect eyes open/closed in // comparison to using higher camera resolutions. If you have any of these issues, you may // want to increase the resolution. mCameraSource = new CameraSource.Builder(context, detector) .setFacing(facing) .setRequestedPreviewSize(320, 240) .setRequestedFps(60.0f) .setAutoFocusEnabled(true) .build(); }