ANPR SDK for Android. Usage

Quick start

For complete sample please refer to: ANPR Reader sources on github

Step 1

Modify your project build.gradle by adding SD-TOOLKIT SDK maven repository URL:

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://www.sd-toolkit.com/repository'
        }
    }
}

Step 2

Modify your app module build.gradle by adding reference to com.sd-toolkit.developer:anpr-sdk:

dependencies {
	...
	compile 'com.sd-toolkit.developer:anpr-sdk:'
}

Step 3

Create instance of IAnprEngine
        mAnprEngine = AnprEngineFactory.createAnprEngine(this);

Architecture

The diagram below demonstrate core components used in final ANPR solution

The SD-TOOLKIT ANPR SDK components are primarily used to communicate over Binder with SD-TOOLKIT ANPR Service where the actual license plate recognition from camera stream is performed. Such architecture allow to "shorten" video stream capture pipeline as well as operate camera device in a mode most suitable for license plate recognition. Another advantage - regular updates of SD-TOOLKIT ANPR Service are delivered without affecting your software components.
To access license plate recognition functionality your application communicates with SDT ANPR Service over IAnprEngine interface.

ANPR Service Lifecycle

The SD-TOOLKIT ANPR Service lifecycle is demonstrated on the diagram below.

The Service can be in one of following states:

  • KILLED - ANPR Service is either not started or scheduled to be killed or is already killed by the android system.
  • IDLE - ANPR Serivce is connected by one or several IAnprEngine instances and is ready to operate. See IAnprEngine.open() for more details. Service will stop itself (returns back to KILLED state) if all connected instances will call IAnprEngine.close()
  • PREVIEW - Service receive a setup request from one of connected IAnprEngine instances which calls setup() thus initializing camera device session. Subsequent calls to IAnprEngine.open() will not modify ANPR Service State. However, if all connected IAnprEngine instances will disconnect by calling IAnprEngine.close(), ANPR Service will close camera session and terminate self (returning back to KILLED state).
  • RECOGNITION - One of connected IAnprEngine instances calls beginRecognition() thus initializing actual license plate recognition from camera device video stream. Subsequent calls to IAnprEngine.open() or IAnprEngine.close() will not modify the Service state. It will continue to run recognition reading camera device stream. This secure no interruption of recognition session event if screen is off. To stop recognition (and return back to PREVIEW state) one of connected instances must call IAnprEngine.endRecognition()