Skip navigation links
Pixelnetica DS SDK (v2.3.9)

Pixelnetica Document Scanning SDK

Pixelnetica Document Scanning SDK (DSSDK) adds a lot of value to mobile applications and services by enabling high-quality document scanning and processing using a camera built into a smart-phone or tablet.

See: Description

Packages 
Package Description
com.pixelnetica.docimageproc
Document Imaging SDK API (Version 1x) (deprecated).
com.pixelnetica.imagesdk
Please take a look at bundled sample application source code to see how to use DI SDK in real application.

Pixelnetica Document Scanning SDK (DSSDK) adds a lot of value to mobile applications and services by enabling high-quality document scanning and processing using a camera built into a smart-phone or tablet.

Pixelnetica DSSDK provides developers with an intelligent, highly efficient toolkit, which offers an easy way to add image processing features that are optimized for document photos that are taken by a mobile device or document camera to their applications.

Contents

System requirements

To see API level support by each Android platform please visit Android Developers site.

What's new in version 2.3.9

For more details on previous updates please view full Change Log.

How to add Pixelnetica DSSDK to Android project

Please follow the steps below to add Pixelnetica Document Image SDK to custom Android project in Android Studio.

  1. Add the following code to your project-level Gradle script
    repositories{
      maven {
            url 'http://repo.pixelnetica.com:8081/artifactory/libs-release'
        }
    
    }
  2. Add the following string to the "dependencies" section of .gradle configuration file:
        dependencies {
            implementation 'com.pixelnetica.sdk:scanning-release:2.3.9'
            .....
          }

    Please use most recent DSSDK version if you have active SMUA (Support Maintenance and Upgrade Assurance) subscription or version you've purchased if you don't have active SMUA.
    If you are not sure feel free to contact Pixelnetica Support.
    Take into consideration that from time to time DSSDK could be changed. Please check Change Log, Documentation and demo application source code for more details.

  3. Synchronize project

ABI settings

Currently DSSDK supports the following Application Binary Interface, or ABI: armeabi-v7a, arm64-v8a, x86 x86_64

To include necessary ABIs please adjust the abiFilters configuration in your build.gradle file.

android {
  defaultConfig {
    ndk {
        abiFilters "armeabi-v7a", "arm64-v8a"
    }
  }
}
        

In sample application x86 architecture included by default to support development and testing under emulator.

⚠️ We strongly suggest to exclude not necessary ABIs (like x86) for production build to significantly reduce your release apk.

Document Scanning SDK API (Version 2.3.6) typical usage as pseudocode

// Initialize SDK one time. Overriding Application.onLoad() is better choice.
// That supposes license key stored in the assets
ImageSdkLibrary.load(getApplication());

......

// Create SDK instance
ImageProcessing sdk = new ImageSdkLibrary().newProcessingInstance();
// Obtain your bitmap
Bitmap bitmap = ....;

// Create and setup MetaImage
MetaImage source = new MetaImage(bitmap, bitmapPath);
source.setStrongShadows(true);   // if need

// Detect document corners
Bundle params = new Bundle();
Corners corners = sdk.detectDocumentCorners(source, params);
if (corners != null) {
    // Corners detected!

    // Get detection confidence
    boolean isSmartCropMode = params.getBoolean("isSmartCropMode");

    // Crop image
    MetaImage cropped = sdk.correctDocument(source, corners);

    // Binarize image
    MetaImage target = sdk.imageBWBinarization(cropped);

    // Use those result!
    Bitmap result = target.getBitmap();
}

Please take a look at bundled sample application source code to see how to use DSSDK in real application.

Migration guide for Document Imaging SDK Version 1x users

You can continue using class DocImageProc with new SDK but new features will not be available. We strongly recommend migration to the new SDK version.
  1. Replace or rename used package from com.pixelnetica.docimageproc to com.pixelnetica.imagesdk
  2. Rename SDK instance class from com.pixelnetica.docimageproc.DocImageProc to com.pixelnetica.imagesdk.ImageProcessing
  3. Rename com.pixelnetica.docimageproc.Metaimage to com.pixelnetica.imagesdk.MetaImage. Don't forget capital I in MetaImage
  4. Change SDK instance creation from new DocImageProc(...) to new ImageSdkLibrary(...).newProcessingInstance()
  5. Change (if used) DocImageProc.load(android.app.Application) to ImageSdkLibrary.load(android.app.Application)
  6. Change final call sdk.close() to sdk.destroy() or simply remove this call, since it doesn't needed anymore.
  7. Now additional parameters passes not through deprecated PxDocCorners structure, but via system class Bundle. When call DocImageProc.detectDocumentCorners(com.pixelnetica.docimageproc.Metaimage, boolean, com.pixelnetica.docimageproc.PxDocCorners) change com.pixelnetica.docimageproc.PxDocCorners to android.os.Bundle.
    PxDocCorners.isSmartCropMode is now boolean key "isSmartCropMode" in the Bundle.
  8. ImageProcessing.detectDocumentCorners(com.pixelnetica.imagesdk.MetaImage, android.os.Bundle) now returns Corners or null on failure
  9. Corners now supports Android's Parcelable
  10. Remove all "docimageproc"-related strings from ProGuard configuration file.

For reference see how it done in Demo Sample application (source code provided with SDK demo package).

SDK initialization

SDK should be initialised only once - no need to send object-application on each SDK call.

You can choose one of three options to pass your license key to SDK

  1. You can store license key file in application's assets e.g.
    src/main/assets/pixelnetica/scanning/(file)
    Where (file) is described on ImageSdkLibrary.load()
    Then you can call
    ImageSdkLibrary.load(app)
    only with one Application argument.

  2. You can pass a very-very-long license key String to
    ImageSdkLibrary.load(app, licenceKey)
  3. For your comfort you can use resource ID instead license key String
    public class CropDemoApp extends Application {
    /*****/ @Override public void onCreate() { super.onCreate(); // Initialize Image SDK ImageSdkLibrary.load(this); // Where we suppose licence key stored in assets }

SDK call sample.

  // Create processing instance
  ImageProcessing sdk = new ImageSdkLibrary().newProcessingInstance();
  // You one use try-with-resources for image writer instance
  try (ImageWriter writer = new ImageSdkLibrary().newImageWriterInstance(IMAGE_WRITER_PDF)) {
    /*****/
  }
  catch(ImageWriterException e) {
      /*****/
  }
  

SDK Demo version restrictions

Document Scanning SDK demo libs features is identical to runtime except one thing - it puts watermark on resulted image in any application with package id other than "com.pixelnetica.cropdemo" (this is Demo application package id).

Demo application manual

To demonstrate most of DSSDK features and the way how it should be used in real application demo package bundled with demo application source code.
In order to understand how its work please take a look at Demo Application brief manual.

Feel free to contact us in case of any inquires: Pixelnetica Support.

Skip navigation links
Copyright © 2012-2018, Pixelnetica. All rights reserved.