Skip to content

An interactive document scanner built in Python using OpenCV featuring automatic corner detection, image sharpening, and color thresholding.

Notifications You must be signed in to change notification settings

elevin04/JDCRP-Document-Scanner

 
 

Repository files navigation

JDCRP Automatic Document Scanner built in Python using OpenCV with Interactive Capabilities

JDCRP

This scanner takes a poorly scanned image, finds the corners of the document, applies 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.

This project makes use of the transform and imutils modules from pyimagesearch (which can be accessed here). The UI code for the interactive mode is adapted from poly_editor.py from here.

  • You can manually click and drag the corners of the document to be perspective transformed: Example of interactive GUI

  • The scanner can also process an entire directory of images automatically and save the output in an output directory: Image Directory of images to be processed

Here are some examples of images before and after scan:

Usage (using the command line)

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

About

An interactive document scanner built in Python using OpenCV featuring automatic corner detection, image sharpening, and color thresholding.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 99.5%
  • Batchfile 0.5%