Document scanner built using python opencv.
Project description
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
-i
flag 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file document_scanner-0.1.9.tar.gz
.
File metadata
- Download URL: document_scanner-0.1.9.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d063b0edf5f976516d174cabf077261c00f744340d298e97f2c972e5099996 |
|
MD5 | e2c416ed49e5748851bd145fefe3ae9b |
|
BLAKE2b-256 | 5de11eef4a7f21ec314b918df57e8ff42c9ff977beac5c46cfc13d297feccc80 |
File details
Details for the file document_scanner-0.1.9-py3-none-any.whl
.
File metadata
- Download URL: document_scanner-0.1.9-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34e2ea8403a32650198f3834885ce48e941c64f089bc13475be1feb88a29cc92 |
|
MD5 | 2e908223278f63c51baeea45e675ef12 |
|
BLAKE2b-256 | 54202f6ed364d6a11cb659efd1323edf0d90f391b49f0d1924c07970cd5319ea |