git clone https://github.com/dkhanna511/documentScanner.git
Function to to perform four point tranform of an image and find out the rectangulare coordinates of the document and showing it by removing the unwanted backgrounf keeping only the page coordinates.
python3 4pointTransform.py --image "path/to/image" --coords "x,y coordinates for rectangle"
Python script for taking any input image and convert it into a black and white scanned document using fourPointTranformUtility.py script as a utility function.
python3 scanner.py --image "path/to/image"
https://www.pyimagesearch.com/2014/09/01/build-kick-ass-mobile-document-scanner-just-5-minutes/