Courtesy: GitHub
Warning: file_get_contents(../git/googlesamples/android-vision/visionSamples/ocr-reader/ failed to open stream: No such file or directory in /var/www/ on line 10

compileSdkVersion 23

applicationId ""

minSdkVersion 9

targetSdkVersion 23

versionCode 1

versionName "1.0"

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

compile ''

compile ''

compile ''



  • android.permission.CAMERA


Main activity demonstrating how to pass extra parameters to an activity that recognizes text.

Called when a view has been clicked. * @param v The view that was clicked.

Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. The resultCode will be {@link #RESULT_CANCELED} if the activity explicitly returned that, didn't return any result, or crashed during its operation.

You will receive this call immediately before onResume() when your activity is re-starting.

* @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from. @param resultCode The integer result code returned by the child activity through its setResult(). @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). @see #startActivityForResult @see #createPendingResult @see #setResult(int)


Activity for the multi-tracker app. This app detects text and displays the value with the rear facing camera. During detection overlay graphics are drawn to indicate the position, size, and contents of each TextBlock.

Initializes the UI and creates the detector pipeline.

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

Creates and starts the camera. Note that this uses a higher resolution in comparison to other detection examples to enable the ocr detector to detect small text samples at long distances. * Suppressing InlinedApi since there is a check that the minimum version is met before using the constant.

Restarts the camera.

Stops the camera.

Releases the resources associated with the camera source, the associated detectors, 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)

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.

onTap is called to capture the first TextBlock under the tap location and return it to the Initializing Activity. * @param rawX - the raw position of the tap @param rawY - the raw position of the tap. @return true if the activity is ending.

Responds to scaling events for a gesture in progress. Reported by pointer motion. * @param detector The detector reporting the event - use this to retrieve extended info about event state. @return Whether or not the detector should consider this event as handled. If an event was not handled, the detector will continue to accumulate movement until an event is handled. This can be useful if an application, for example, only wants to update scaling factors if the change is greater than 0.01.

Responds to the beginning of a scaling gesture. Reported by new pointers going down. * @param detector The detector reporting the event - use this to retrieve extended info about event state. @return Whether or not the detector should continue recognizing this gesture. For example, if a gesture is beginning with a focal point outside of a region where it makes sense, onScaleBegin() may return false to ignore the rest of the gesture.

Responds to the end of a scale gesture. Reported by existing pointers going up.

Once a scale has ended, {@link ScaleGestureDetector#getFocusX()} and {@link ScaleGestureDetector#getFocusY()} will return focal point of the pointers remaining on the screen. * @param detector The detector reporting the event - use this to retrieve extended info about event state.