The source code of Document Rectification and Illumination Correction using a Patch-based CNN by Li et al, to appear at SIGGRAPH Asia 2019.
- Linux or Windows
- Python 3
- CPU or NVIDIA GPU + CUDA CuDNN
We use Blender to automatically generate synthetic distorted document image and the corresponding flow.
You can download a sample dataset (438MB) from here and we are still working on how to find a good way to upload the full dataset since it is too large (65GB).
The dataset includes three folders: img (the distorted images), img_mask (the mask of background), flow (the forward flow of the distorted images).
The first thing you need to do is to crop the dataset to patches for training. Change arguments to your own and run the following commands. For help message about optional arguments, run python xxx.py --h
python local_patch.py # crop images and flows to local patches and local patch flows
python global_patch.py # crop images to global patchesRun the following command for training and change the optional arguments like dataset directory, etc.
python train.pyYou can download the pre-trained model here.

