Stay organized with collections Save and categorize content based on your preferences.
Document scanner
Digitizing physical documents, which allows users to convert physical documents into digital formats has become a very common user journey in mobile apps. ML Kit's document scanner API provides a comprehensive solution with a high-quality, consistent UI flow across Android apps and devices. Once the document scanner flow is triggered from your app, users retain full control over the scanning process. They can optionally crop the scanned documents, apply filters, remove shadows or stains, and easily send the digitized files back to your app.
The UI flow, ML models and other large resources are delivered using Google Play services, which means:
Low binary size impact (all ML models and large resources are downloaded centrally in Google Play services).
No camera permission is required - the document scanner leverages the Google Play services' camera permission, and users are in control of which files to share back with your app.
The entire document scanner flow operates on-device.
High-quality and consistent user interface for digitizing physical documents.
Automatic capture with document detection.
Accurate edge detection for optimal crop results.
Automatic rotation detection to show documents upright.
Editing functionalities to crop, apply filters, remove shadows, clean stains, and seamlessly send digitized files back to your app.
On-device processing, preserving user's privacy.
No camera permission is needed from your app.
Low apk binary size impact.
Customization
The document scanner API provides a high-quality fully fledged UI flow that is consistent across Android apps. However, there is also room to customize some aspects of the user experience:
Maximum number of pages: Set a limit to the number of pages scanned.
Gallery import: Enable or disable the capability to import from the photo gallery.
Editing functionalities: Customize the editing functionalities available to the user by choosing from 3 modes:
SCANNER_MODE_BASE_WITH_FILTER: adds image filters (grayscale, auto image enhancement, etc…) to the SCANNER_MODE_BASE mode.
SCANNER_MODE_FULL (default): adds ML-enabled image cleaning capabilities (erase stains, fingers, etc…) to the SCANNER_MODE_BASE_WITH_FILTER mode. This mode will also allow future major features to be automatically added along with Google Play services updates, while the other two modes will maintain their current feature sets and only receive minor refinements.
Base mode
Base mode with filter
Full mode
Example results
Original picture
Scanned document with perspective corrected, wrinkle removed and grayscale filter applied
Original picture
Scanned document auto-rotated with stain removed and color filter applied
Original picture
Scanned document with stain removed and auto filter applied
Original picture
Scanned document auto-rotated with shadow removed and auto filter applied
Original picture
Scanned document auto-rotated with finger removed and auto filter applied
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eML Kit's Document Scanner API enables digitization of physical documents within Android apps, providing a high-quality and consistent user interface.\u003c/p\u003e\n"],["\u003cp\u003eThe API offers on-device processing, ensuring user privacy and eliminating the need for camera permissions from the app.\u003c/p\u003e\n"],["\u003cp\u003eUsers have control over the scanning process, including cropping, applying filters, removing imperfections, and sharing the digitized files.\u003c/p\u003e\n"],["\u003cp\u003eCustomization options are available to tailor the user experience, such as limiting pages, enabling gallery imports, and adjusting editing functionalities.\u003c/p\u003e\n"],["\u003cp\u003eThe API leverages Google Play services for model delivery, minimizing app size and enabling automatic updates for enhanced features.\u003c/p\u003e\n"]]],["The document scanner API allows users to digitize physical documents within Android apps. Key actions include automatic document capture, edge and rotation detection, and editing features like cropping, filtering, and stain/shadow removal. The API operates on-device and uses Google Play services, ensuring low binary size impact and eliminating the need for camera permissions. Customization options are provided for the maximum number of pages, gallery import, and three editing modes, with the full mode offering the most feature set.\n"],null,["Document scanner This API is offered in beta, and is not subject to any SLA or deprecation policy. Changes may be made to this API that break backward compatibility.\n\nDigitizing physical documents, which allows users to convert physical documents\ninto digital formats has become a very common user journey in mobile apps.\nML Kit's document scanner API provides a comprehensive solution with a\nhigh-quality, consistent UI flow across Android apps and devices. Once the\ndocument scanner flow is triggered from your app, users retain full control over\nthe scanning process. They can optionally crop the scanned documents, apply\nfilters, remove shadows or stains, and easily send the digitized files back to\nyour app.\n\nThe UI flow, ML models and other large resources are delivered using Google Play\nservices, which means:\n\n- Low binary size impact (all ML models and large resources are downloaded centrally in Google Play services).\n- No camera permission is required - the document scanner leverages the Google Play services' camera permission, and users are in control of which files to share back with your app.\n\nThe entire document scanner flow operates on-device.\n\n[Android](/ml-kit/vision/doc-scanner/android)\n\nKey capabilities\n\n- High-quality and consistent user interface for digitizing physical documents.\n- Automatic capture with document detection.\n- Accurate edge detection for optimal crop results.\n- Automatic rotation detection to show documents upright.\n- Editing functionalities to crop, apply filters, remove shadows, clean stains, and seamlessly send digitized files back to your app.\n- On-device processing, preserving user's privacy.\n- No camera permission is needed from your app.\n- Low apk binary size impact.\n\nCustomization\n\nThe document scanner API provides a high-quality fully fledged UI flow that is\nconsistent across Android apps. However, there is also room to customize some\naspects of the user experience:\n\n- **Maximum number of pages:** \n\n Set a limit to the number of pages scanned.\n\n- **Gallery import:** \n\n Enable or disable the capability to import from the photo gallery.\n\n- **Editing functionalities:** \n\n Customize the editing functionalities available to the user by choosing\n from 3 modes:\n\n - `SCANNER_MODE_BASE`: basic editing capabilities (crop, rotate, reorder pages, etc...).\n - `SCANNER_MODE_BASE_WITH_FILTER`: adds image filters (grayscale, auto image enhancement, etc...) to the `SCANNER_MODE_BASE` mode.\n - `SCANNER_MODE_FULL` (default): adds ML-enabled image cleaning capabilities (erase stains, fingers, etc...) to the `SCANNER_MODE_BASE_WITH_FILTER` mode. This mode will also allow future major features to be automatically added along with Google Play services updates, while the other two modes will maintain their current feature sets and only receive minor refinements.\n\n| Base mode | Base mode with filter | Full mode |\n|-----------|-----------------------|-----------|\n| | | |\n\nExample results\n\n| Original picture | Scanned document with perspective corrected, wrinkle removed and grayscale filter applied |\n|------------------|-------------------------------------------------------------------------------------------|\n| | |\n\n| Original picture | Scanned document auto-rotated with stain removed and color filter applied |\n|------------------|---------------------------------------------------------------------------|\n| | |\n\n| Original picture | Scanned document with stain removed and auto filter applied |\n|------------------|-------------------------------------------------------------|\n| | |\n\n| Original picture | Scanned document auto-rotated with shadow removed and auto filter applied |\n|------------------|---------------------------------------------------------------------------|\n| | |\n\n| Original picture | Scanned document auto-rotated with finger removed and auto filter applied |\n|------------------|---------------------------------------------------------------------------|\n| | |"]]