Skip to content
Bank credit card deep layout analysis, fields extraction and recognition/OCR (ScanToPay) using deep learning
Java C# C++ Python Perl CMake
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
binaries
c++
csharp
java
objc
perl
python
ruby
samples
.gitignore
CMakeLists.txt
LICENSE
README.md
SDK_TechnicalGuide_v2.0.pdf

README.md


This is a state-of-the-art DeepLayout Analysis implementation based on Tensorflow to accurately detect, qualify, extract and recognize/OCR every field from a bank credit card using a single image: Number, Holder's name, Validity, Company...

Our implementation works with all cards (credit, debit, travel, prepaid, corporate...) from all payment networks (Visa, MasterCard, American Express, RuPay, Discover...).

Both Embossed and UnEmbossed formats are supported.

Unlike other implementations we're not doing brute force OCR (trying multiple images/parameters until match). You only need a single image to get the correct result. There is no template matching which means the data could be malformed or at any position and you'll still have the correct result (WYSIWYG).

Next video (https://youtu.be/BBI_3AJIc1c) shows CCardVideoRecognizer sample Running on Android:
CCardVideoRecognizer Running on Android


You can reach 100% precision on the credit card number recognition using validation process.

The number of use cases in FinTech industry are countless: Scan To Pay, Helping visually impaired users, Online shopping speed-up, payment forms auto-filling, better user experience, reducing typing errors, process automation...

Don't take our word for it, come check our implementation. No registration, license key or internet connection is required, just clone the code and start coding/testing. Everything runs on the device, no data is leaving your computer. The code released here comes with many ready-to-use samples for Android and Raspberry Pi to help you get started easily.

You can also check our online cloud-based implementation (no registration required) to check out the accuracy and precision before starting to play with the SDK.

Please check full documentation at https://www.doubango.org/SDKs/credit-card-ocr/docs/

Getting started

The SDK works on many platforms and comes with support for many programming languages but the next sections focus on Android and Raspberry pi.

Android

The next sections are about Android and Java API.

Sample applications (Android)

The source code comes with #2 Android sample applications: Benchmark and CCardVideoRecognizer.

Benchmark (Android)

This application is used to check everything is ok and running as fast as expected. The information about the maximum frame rate (27fps) on Snapdragon 855 devices could be checked using this application. It's open source and doesn't require registration or license key.

CCardVideoRecognizer (Android)

This application should be used as reference code by any developer trying to add ultimateCreditCard to their products. It shows how to detect and recognize credit cards in realtime using live video stream from the camera.


CCardVideorecognizer sample application on Android

Trying the samples (Android)

To try the sample applications on Android:

  1. Open Android Studio and select "Open an existing Android Studio project" alt text

  2. Navigate to ultimateCreditCard-SDK/samples, select android folder and click OK alt text

  3. Select the sample you want to try (e.g. ccardvideorecognizer) and press run. alt text

Adding the SDK to your project (Android)

The SDK is distributed as an Android Studio module and you can add it as reference or you can also build it and add the AAR to your project. But, the easiest way to add the SDK to your project is by directly including the source.

In your build.gradle file add:

android {

      # This is the block to add within "android { } " section
      sourceSets {
         main {
             jniLibs.srcDirs += ['path-to-your-ultimateCreditCard-SDK/binaries/android/jniLibs']
             java.srcDirs += ['path-to-your-ultimateCreditCard-SDK/java/android']
             assets.srcDirs += ['path-to-your-ultimateCreditCard-SDK/assets/models']
         }
      }
}

Using the Java API (Android)

It's hard to be lost when you try to use the API as there are only 3 useful functions: init, process and deInit.

The C++ API is defined here.

	import org.doubango.ultimateAlpr.Sdk.ULTCCARD_SDK_IMAGE_TYPE;
	import org.doubango.ultimateAlpr.Sdk.UltCreditCardSdkEngine;
	import org.doubango.ultimateAlpr.Sdk.UltCreditCardSdkResult;

	final static String CONFIG = "{" +
		"\"debug_level\": \"info\"," + 
		"\"gpgpu_enabled\": true," + 

		"\"detect_minscore\": 0.5," + 
		"\"detect_quantization_enabled\": true," + 

		"\"recogn_score_type\": \"min\"," + 
		"\"recogn_minscore\": 0.2," + 
		"\"recogn_rectify_enabled\": false," + 
		"\"recogn_quantization_enabled\": true" + 
	"}";

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Initialize the engine
		assert UltCreditCardSdkEngine.init(
				getAssets(),
				CONFIG
		).isOK();
	}

	// Camera listener: https://developer.android.com/reference/android/media/ImageReader.OnImageAvailableListener
	final ImageReader.OnImageAvailableListener mOnImageAvailableListener = new ImageReader.OnImageAvailableListener() {

		@Override
		public void onImageAvailable(ImageReader reader) {
				try {
				    final Image image = reader.acquireLatestImage();
				    if (image == null) {
				        return;
				    }

				    // Credit card detection and recognition
				    final Image.Plane[] planes = image.getPlanes();
				    final UltCreditCardSdkResult result = UltCreditCardSdkEngine.process(
				        ULTCCARD_SDK_IMAGE_TYPE.ULTCCARD_SDK_IMAGE_TYPE_YUV420P,
				        planes[0].getBuffer(),
				        planes[1].getBuffer(),
				        planes[2].getBuffer(),
				        image.getWidth(),
				        image.getHeight(),
				        planes[0].getRowStride(),
				        planes[1].getRowStride(),
				        planes[2].getRowStride(),
				        planes[1].getPixelStride()
				    );
				    assert result.isOK();

				    // The result contains JSON string to parse in order to get recognitions
				    // result.json();

				    image.close();

				} catch (final Exception e) {
				   e.printStackTrace();
				}
		}
	};

	@Override
	public void onDestroy() {
		// DeInitialize the engine
		assert UltCreditCardSdkEngine.deInit().isOK();

		super.onDestroy();
	}

Again, please check the sample applications for Android and Raspberry Pi and full documentation for more information.

Raspberry Pi (Raspbian OS) and others

Sample applications (Raspberry Pi)

The source code comes with #2 C++ sample applications: Benchmark and Recognizer. These sample applications can be used on all supported platforms: Android, Windows, Raspberry pi, iOS, OSX, Linux...

Benchmark (Raspberry Pi)

This application is used to check everything is ok and running as fast as expected. The information about the maximum frame rate (27fps on Snapdragon 855 devices and 10fps on Raspberry Pi 4) could be checked using this application. It's open source and doesn't require registration or license key.

For more information on how to build and run this sample please check samples/c++/benchmark.

Recognizer (Raspberry Pi)

This is a command line application used to detect and recognize a license plate from any JPEG/PNG/BMP image.

For more information on how to build and run this sample please check samples/c++/recognizer.

Technical questions

Please check our discussion group or twitter account

You can’t perform that action at this time.