Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

document_scanner-0.1.9.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

document_scanner-0.1.9-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page