-
Notifications
You must be signed in to change notification settings - Fork 19
Home
This repository contains code to achieve the lovely scan effects provided by mobile camera based document scanning apps like Camscanner, Adobe Scan. I have kept the repository's name as "DocumentScanner" to make it more descriptive but the name I prefer to use for my project is "RScan".
The OpenCV based project has been implemented on both Python as well as Java indipendently. Java implementation is meant to make the project Android compatible.
This documentation will often use Java program as its reference but Python geeks need not get dissapointed as the same documentation will aslo help as complete guide for the Python program (after all both Python & Java program use nothing other than our favourite OpenCV)
Lets begin !
My system has:
- Python 3.5.4 with OpenCV 3.4.3
- Java jdk 11.0.8 with OpenCV 3.4.4
Document scanning performs two major tasks, auto-crop of documents and processing the cropped images to make them look like scanned documents. Currently the repository only contains code to scan documents. Code to auto-crop documents will be uploaded in near future.
I have used Photoshop to figure out editing techniques required to achieve the scan effect. In Photoshop the scanning effect can be acheived using the operations, "set white point" & "set black point" provided by "Levels" feature. Combination of these two operations result in the scan effect often regarded as "magic color" in various mobile apps. Apart from this, High Pass Filter can be used along with above two operations to achieve some exciting results like shadow removal. Scanning of documents in the "Black & White" mode is achieved by processing the image in LAB color space using OpenCV.
I'll suggest to use Adobe Photoshop to apply the scanning techniques discussed ahead so as to get a good escence of the project. Doing so will also help you get an idea about selecting values for blackPoint, whitePoint & kernelSize prameters(to be discussed) manually. Get a trial version of Photoshop if you don't have it.
In Java, the project has a "Scan" class which contains various methods to implement the processing techniques.
In Python, a single .py file contains the various functions to scan documents.
I have tried my best to provide a well commented code along with wiki for both Python and Java. Most of the image processing fraternity use Python and so do I, the only reason for which I coded it on Java too was to make it compatible on Android without loosing much on processing speed.
email id : sourabhkhemkask@gmail.com