Categories: Mobile Phone

Simply add doc scanning functionality to your app with ML Package Doc Scanner API



Posted by Thomas Ezan – Sr. Developer Relations Engineer; Chengji Yan, Penny Li – ML Package Engineers; David Miro Llopis – Product Supervisor

We’re excited to announce the launch of the ML Package Doc Scanner API. This new API makes it straightforward so as to add superior doc scanning capabilities with a high-quality and constant consumer interface to your Android app. The ML Package Doc Scanner API allows your customers to rapidly and simply digitize paper paperwork.

Like the opposite ML Package APIs, the ML Package Doc Scanner API allows you to seamlessly combine options powered by Machine Studying (ML) with none ML information.

Why Doc Scanner SDK?

Regardless of the digital revolution, paper paperwork and printouts are nonetheless current in our on a regular basis life. A few of our most necessary paperwork are nonetheless bodily (identification paperwork, receipts, and many others.).

The ML Package Doc Scanner API presents an a variety of benefits, together with:

    • A high-quality and constant consumer interface for digitizing bodily paperwork.
    • Correct doc detection with exact nook and edge detection for a seamless scanning expertise and optimum scanning outcomes.
    • Versatile performance permits customers to crop scanned paperwork, apply filters, take away fingers, take away stains and different blemishes and ship digitized information in PDF and JPEG codecs again to your app.
    • On-device processing helps protect privateness.
    • An entire answer eliminating the necessity for digicam permission.

The ML Package Doc Scanner API is already utilized by Google Drive Android software and the Google Pixel Digicam.

ML Package Doc scanner API in motion in
Google Drive

Get began

The ML Package Doc Scanner API requires Android API stage 21 or above. The fashions, scanning logic, and UI movement are dynamically downloaded through Google Play providers so the ML Package Doc Scanner API has a minimal influence in your app dimension.

To combine it in your app, begin by configuring the scanner choices and getting a scanner shopper:

val choices = GmsDocumentScannerOptions.Builder()
    .setGalleryImportAllowed(false)
    .setPageLimit(2)
    .setResultFormats(RESULT_FORMAT_JPEG, RESULT_FORMAT_PDF)
    .setScannerMode(SCANNER_MODE_FULL)
    .construct()
val scanner = GmsDocumentScanning.getClient(choices)

Then register an ActivityResultCallback to obtain the scanning outcomes:

val scannerLauncher = registerForActivityResult(StartIntentSenderForResult()) {
  consequence -> {
    if (consequence.resultCode == RESULT_OK) {
      val consequence =
        GmsDocumentScanningResult.fromActivityResultIntent(consequence.knowledge)
      consequence.getPages()?.let { pages ->
        for (web page in pages) {
          val imageUri = web page.getImageUri()
        }
      }
      consequence.getPdf()?.let { pdf ->
        val pdfUri = pdf.getUri()
        val pageCount = pdf.getPageCount()
      }
    }
  }
}

Lastly launch the doc scanner exercise:

scanner.getStartScanIntent(exercise)
  .addOnSuccessListener { intentSender ->   
    scannescannerrLauncher.launch(IntentSenderRequest.Builder(intentSender).construct())
  }
  .addOnFailureListener { ... }

To get began with the ML Package Doc Scanner API, go to the documentation. We will’t wait to see what you’ll construct with it!

Uncomm

Share
Published by
Uncomm

Recent Posts

Printed Circuit Board Design Engineer At Aether Semiconductors In Sahibzada Ajit Singh Nagar

- Commercial - Location: Sahibzada Ajit Singh Nagar Firm: Aether Semiconductors Expertise Degree: 1 –…

3 hours ago

The evolution of PCBs and the calls for of recent electronics

Printed circuit boards (PCBs) have come a great distance over time. Electronics design engineers should…

7 hours ago

A PSpice Swap Mannequin For Excessive-Energy Utility

**** 10/13/23 09:55:59 ****** PSpice Lite (October 2012) ****** ID# 10813 ****An influence swap for…

9 hours ago

PCB Soldering Definition, Course of, Working, Makes use of & Benefits

What's PCB Soldering? Printed Circuit Board (PCB) soldering is a basic course of in electronics…

19 hours ago

SparkFun Electronics is Now the Sole Producer and Gross sales Accomplice for Teensy® – Information

SparkFun brings the manufacturing of PJRC’s product in-house and turns into the only real gross…

21 hours ago

Syria’s al-Sharaa indicators short-term structure | Syria’s Conflict Information

Syria’s interim President Ahmed al-Sharaa has signed a brief structure that can be in power…

23 hours ago