.setRequestedPreviewSize(1600, 1024) .setRequestedFps(15.0f) .build();
/** * Creates and starts the camera. Note that this uses a higher resolution in comparison * to other detection examples to enable the barcode detector to detect small barcodes * at long distances. */ private void createCameraSource() { Context context = getApplicationContext(); FaceDetector detector = new FaceDetector.Builder(context) .setClassificationType(FaceDetector.ALL_CLASSIFICATIONS) .build(); detector.setProcessor( new MultiProcessor.Builder<>(new GraphicFaceTrackerFactory()) .build()); if (!detector.isOperational()) { // Note: The first time that an app using face API is installed on a device, GMS will // download a native library to the device in order to do detection. Usually this // completes before the app is run for the first time. But if that download has not yet // completed, then the above call will not detect any faces. // // isOperational() can be used to check if the required native library is currently // available. The detector will automatically become operational once the library // download completes on device. Log.w(TAG, "Face detector dependencies are not yet available."); } mCameraSource = new CameraSource.Builder(context, detector) .setRequestedPreviewSize(640, 480) .setFacing(CameraSource.CAMERA_FACING_BACK) .setRequestedFps(30.0f) .build(); }
.setRequestedFps(10.0f); cameraSource = builder.build(); Log.i(LOG_TAG, "Camera Source built"); cameraView.getHolder().addCallback(new SurfaceHolder.Callback() {
.setRequestedFps(2.0f) .setAutoFocusEnabled(true) .build();
.setAutoFocusEnabled(true) .setRequestedPreviewSize(1600, 1024) .build();
.setFacing(CameraSource.CAMERA_FACING_FRONT) .setRequestedFps(30.0f) .build();
.setFacing(CameraSource.CAMERA_FACING_FRONT) .setRequestedFps(30.0f) .build();
/** * Create face decoder and camera source. */ private void creteCameraTracker() { mDetector = new FaceDetector.Builder(mActivity) .setTrackingEnabled(false) .setClassificationType(FaceDetector.ALL_CLASSIFICATIONS) .build(); mDetector.setProcessor( new MultiProcessor.Builder<>(new GraphicFaceTrackerFactory()) .build()); if (!mDetector.isOperational()) { mUserAwareVideoView.onErrorOccurred(); Log.e("Start Tracking", "Face tracker is not operational."); } mCameraSource = new CameraSource.Builder(mActivity, mDetector) .setRequestedPreviewSize(640, 480) .setFacing(CameraSource.CAMERA_FACING_FRONT) .setRequestedFps(30.0f) .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(); }