Courtesy: GitHub
Warning: file_get_contents(../git/googlesamples/android-vision/visionSamples/googly-eyes/README.md): failed to open stream: No such file or directory in /var/www/appsrox.com/public_html/ide/content.php on line 10

compileSdkVersion 24

applicationId "com.google.android.gms.samples.vision.face.googlyeyes"

minSdkVersion 9

targetSdkVersion 24

versionCode 1

versionName "1.0"

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:support-v4:24.2.0'

compile 'com.android.support:design:24.2.0'

compile 'com.google.android.gms:play-services-vision:9.4.0+'

package com.google.android.gms.samples.vision.face.googlyeyes

versionCode 1

versionName 1

uses-permission

  • android.permission.CAMERA

GooglyEyesActivity

Activity for Googly Eyes, an app that uses the camera to track faces and superimpose Googly Eyes animated graphics over the eyes. The app also detects whether the eyes are open or closed, drawing the eyes in the correct state.

This app supports both a front facing mode and a rear facing mode, which demonstrate different API functionality trade-offs:

Front facing mode uses the device's front facing camera to track one user, in a "selfie" fashion. The settings for the face detector and its associated processing pipeline are set to optimize for the single face case, where the face is relatively large. These factors allow the face detector to be faster and more responsive to quick motion.

* Rear facing mode uses the device's rear facing camera to track any number of faces. The settings for the face detector and its associated processing pipeline support finding multiple faces, and attempt to find smaller faces in comparison to the front facing mode. But since this requires more scanning at finer levels of detail, rear facing mode may not be as responsive as front facing mode.

Initializes the UI and initiates the creation of a face detector.

Handles the requesting of the camera permission. This includes showing a "Snackbar" message of why the permission is needed then sending the request.

Restarts the camera.

Stops the camera.

Releases the resources associated with the camera source, the associated detector, and the rest of the processing pipeline.

Callback for the result from requesting permissions. This method is invoked for every call on {@link #requestPermissions(String[], int)}.

Note: It is possible that the permissions request interaction with the user is interrupted. In this case you will receive empty permissions and results arrays which should be treated as a cancellation.

@param requestCode The request code passed in {@link #requestPermissions(String[], int)}. @param permissions The requested permissions. Never null. @param grantResults The grant results for the corresponding permissions which is either {@link PackageManager#PERMISSION_GRANTED} or {@link PackageManager#PERMISSION_DENIED}. Never null. @see #requestPermissions(String[], int)

Saves the camera facing mode, so that it can be restored after the device is rotated.

Toggles between front-facing and rear-facing modes.

Creates the face detector and associated processing pipeline to support either front facing mode or rear facing mode. Checks if the detector is ready to use, and displays a low storage warning if it was not possible to download the face library.

Creates the face detector and the camera.

Starts or restarts the camera source, if it exists. If the camera source doesn't exist yet (e.g., because onResume was called before the camera source was created), this will be called again when the camera source is created.