Document Scanner
An interactive document scanner built in Python using OpenCV
The scanner takes a poorly scanned image, finds the corners of the document, applies the perspective transformation to get a top-down view of the document, sharpens the image, and applies an adaptive color threshold to clean up the image.
On my test dataset of 300 images, the program correctly detected the corners of the document 92.8% of the time.
- The scanner can process an entire directory of images automatically and save the output in an output directory:
Here are some examples of images before and after scan:
Usage
You can use this script by downloading it from pypi
pip install document-scanner
aftter installing it from pypi index, you can use it from the terminal as follows.
python scan.py (--images <IMG_DIR> | --image <IMG_PATH>) [-i]
- The
-iflag enables interactive mode, where you will be prompted to click and drag the corners of the document. For example, to scan a single image with interactive mode enabled:
python scan.py --image sample_images/desk.JPG -i
- Alternatively, to scan all images in a directory without any input:
python scan.py --images sample_images
Metadata
Release files for document-scanner 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| document_scanner-0.1.9.tar.gz | 6.9 kB | Without provenance | Details for document_scanner-0.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| document_scanner-0.1.9-py3-none-any.whl | Python 3 | none | any | Details for document_scanner-0.1.9-py3-none-any.whl |
Total release size: 14.8 kB
Release files / document_scanner-0.1.9.tar.gz
| Download URL | document_scanner-0.1.9.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
79d063b0edf5f976516d174cabf077261c00f744340d298e97f2c972e5099996
|
|
BLAKE2b-256 checksum How to use checksums |
5de11eef4a7f21ec314b918df57e8ff42c9ff977beac5c46cfc13d297feccc80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0
|
Release files / document_scanner-0.1.9-py3-none-any.whl
| Download URL | document_scanner-0.1.9-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
34e2ea8403a32650198f3834885ce48e941c64f089bc13475be1feb88a29cc92
|
|
BLAKE2b-256 checksum How to use checksums |
54202f6ed364d6a11cb659efd1323edf0d90f391b49f0d1924c07970cd5319ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.9.0
|
Security for document-scanner 0.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.