{"id":21458087,"url":"https://github.com/shubham0204/simple_document_scanner_android","last_synced_at":"2025-07-15T01:31:07.681Z","repository":{"id":47228739,"uuid":"515969984","full_name":"shubham0204/Simple_Document_Scanner_Android","owner":"shubham0204","description":"A simple document scanner app for Android available in two options - API-based and on-device inference","archived":false,"fork":false,"pushed_at":"2024-03-28T02:20:46.000Z","size":245317,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-08T19:11:44.569Z","etag":null,"topics":["android","fastapi","image-processing","kotlin","opencv"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shubham0204.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-20T12:19:39.000Z","updated_at":"2025-03-06T19:43:56.000Z","dependencies_parsed_at":"2023-01-18T13:15:19.708Z","dependency_job_id":null,"html_url":"https://github.com/shubham0204/Simple_Document_Scanner_Android","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/shubham0204/Simple_Document_Scanner_Android","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2FSimple_Document_Scanner_Android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2FSimple_Document_Scanner_Android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2FSimple_Document_Scanner_Android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2FSimple_Document_Scanner_Android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shubham0204","download_url":"https://codeload.github.com/shubham0204/Simple_Document_Scanner_Android/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham0204%2FSimple_Document_Scanner_Android/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265385756,"owners_count":23756728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","fastapi","image-processing","kotlin","opencv"],"created_at":"2024-11-23T06:17:39.205Z","updated_at":"2025-07-15T01:31:06.564Z","avatar_url":"https://github.com/shubham0204.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📄 Simple Document Scanner in Android\n\n![Banner](images/repo_banner.png)\n\n\n## Document Scanning App\n\nThe simplest document scanning app. It only contains the code necessary to provide the basic functionality of a document scanning app, and hence can be extended to meet your requirements.\n\nThe app can either use an API to crop documents or built-in OpenCV package for on-device document scanning.\n\n\n### Using the API-based app \n\u003e See [`main`](https://github.com/shubham0204/Simple_Document_Scanner_Android/tree/main) branch\n\nThis app calls an API to get the coordinates of the corners of the document and also to binarize it. The image processing algorithm remains the same in both the options.\n\nThe API is developed with [FastAPI](https://fastapi.tiangolo.com/) in Python and uses [OkHttp](https://square.github.io/okhttp/) as a client to make requests. For more details on how to run the API server, see [Document Scanning API](#document-scanning-api).\n\nThere's no additional setup required to setup the Android project for this app. Clone the `main` branch and open the resulting directory in Android Studio.\n\n\n### Using the on-device document scanning app \n\u003e See [`on_device_scanning_app`](https://github.com/shubham0204/Simple_Document_Scanner_Android/tree/on_device_scanning_app) branch\n\nThis app uses [OpenCV 4.5.5 Android SDK](https://sourceforge.net/projects/opencvlibrary/files/4.5.5/opencv-4.5.5-android-sdk.zip/download) to uses the same image processing algorithm as that in API-based app.\n\n\n### Motivation\n\nThere are a lot of document scanner apps for Android, some of which are open-source and provide better accuracy. The perks of using and extending this project are,\n\n* The core idea behind this project was **simplicity**. The source code is easy to understand even for beginners in Android and they can easily familiarize themselves with it.\n* The project utilizes the **latest Android libraries for Kotlin** like Coroutines, Room, Scoped Storage\n* It provides **two options to deploy the document scanning service**. The Android app on the `main` branch uses an API to crop the documents whereas the Android app on the `on_device_scanning_app` performs detection on-device and works without any networking.\n* You can learn how to use **OpenCV in Kotlin and its setup** by viewing the `on_device_scanning_app` branch.\n\n\n### Android/Kotlin libraries used in this project\n\n* [OpenCV Android](https://opencv.org/android/) ( Needs Android NDK )\n* [Kotlin Coil](https://github.com/coil-kt/coil)\n* [Material Dialogs](https://github.com/afollestad/material-dialogs)\n* [AndroidX Room](https://developer.android.com/training/data-storage/room)\n* [Kotlin Coroutines](https://developer.android.com/kotlin/coroutines)\n\n\n## Document Scanning API\n\n\u003e 👉 *[Go to the `api` branch](https://github.com/shubham0204/Simple_Document_Scanner_Android/tree/api)*\n\n\nThe `api` branch contains the code for the API built using [FastAPI](https://fastapi.tiangolo.com/) in Python. First, install the required packages from `requirements.txt` in a Python virtual environment,\n\n```\n\u003e python venv doc_scanning_env\n\u003e source doc_scanning_env/bin/activate\n\u003e ( doc_scanning_env ) pip install -r requirements.txt\n```\n\n### Using the API locally\n\nTo run the FastAPI server locally, use\n\n```\n\u003e uvicorn main:app \n```\nin the source code directory where `main.py` is located. Make sure that,\n\n* **The mobile device on which the app is running and the computer on which the server runs, are connected to the same network.**\n* **On Windows, make sure you turn-off the Firewall while testing the app.**\n\n### Using the Streamlit app\n\n![Stream App](images/streamlit_app.png)\n\nYou can also perform document scanning with the Streamlit app, that let's you upload your image and outputs the boundaries of the document. To run the Streamlit app locally, use,\n\n```\n\u003e streamlit run app.py\n```\n\n\n### Building and running the Docker image\n\nYou can bundle the code in a Docker image and build it,\n\n```\n# Make sure you're in the source directory\n\u003e docker build --tag document_scanning_api .\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham0204%2Fsimple_document_scanner_android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubham0204%2Fsimple_document_scanner_android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham0204%2Fsimple_document_scanner_android/lists"}