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 | |
|---|---|---|---|
| document_scanner-0.1.9.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| document_scanner-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
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
|