Accura OCR
High Accuracy OCR (Optical Character Recognition) Includes English, Latin, Chinese, Korean and Japanese Languages.
Step 1: Before you begin
If you haven't done already then follow Project Setup steps.
Please download the Accura Scan license and then add it to your app.
To generate your Accura Scan license contact sales@accurascan.com
Move your key.license file into the module (app-level) assets folder (usually
<project>/<app-module>/src/main/assets
)
Note: Make sure license file name should be key.license
Permissions required
Camera Permission
android.permission.CAMERA
Storage Permission required only for print out debug logs.
Note: Enable logging for debugging purposes using the methods provided below. Please remember to disable logging before releasing the app. (Storage permission is required for logging). AccuraLog.enableLogs(true); AccuraLog.refreshLogfile(activity); Log file will be stored in InternalStorage/Downloads/AccuraLog.txt
Step 2: Initialize SDK when the app starts
Initialize SDK with Licensing
After initializing the SDK, proceed to initialize the filters below if the license is valid.
(sdkModel.i > 0)
Set Blur Percentage to allow blur on document
Set Face blur Percentage to allow blur on detected Face
Set Glare Percentage to detect Glare on document
Set Hologram detection to verify the hologram on the face
Set light tolerance to detect light on document
Set motion threshold to detect motion on camera document
Step 3 : Set CameraView
Your activity class should extend
com.accurascan.ocr.mrz.motiondetection.SensorsActivity
.Camera View support both orientations Portarait and Landscape
Note: Make sure your activity orientation should be finalise before Initialize camera because auto rotate is not support during scanning.
Initialize cameraView to your activity class.
And recommended to override the following methods.
Implements
com.accurascan.ocr.mrz.interfaces.OcrCallback
to your Activity and Override following methods to receive data during scanning.Note: Below Override methods are invoked from background thread. So make sure to use in UI thread
When below override method is getting called, you can start scanning and set parameter of center scanning frame.
You can receive information during scanning in the below override method
Note : (Optional)
cameraView.flipImage(imageFlip);
Use to display default flip card animation. You can use your custom animation for flip card.You can receive and display the scanned result in the below override method. The method below is invoked twice for RecogType.PDF417 and RecogType.OCR. And for the RecogType.OCR, it can be invoked once or twice with respect to a document. You can verify this with
cameraView.isBackSideAvailable()
. It will return true if the back is available, otherwise return false.
Note: It is necessary to release the camera view before showing the result on the results screen. Before releasing it, ensure that both sides of the document must be scanned as per your requirements. If you only scan one side and then release it directly, it may not fulfill your requirements.
Receive error messages
(Optional)To restart the scanning process after obtaining the result, you need to include the following code. This code should be placed within the override method of an Android activity, which gets called when you open the result activity using the
startActivityForResult(Intent, RESULT_ACTIVITY_CODE)
.
Last updated