Shading Removal of Illustrated Documents
Daniel Marques

Daniel Marques @dmo2000

About: Senior Software Engineer

Location:
Recife, Brasil
Joined:
May 15, 2024

Shading Removal of Illustrated Documents

Publish Date: May 17
0 0

During my PhD, I developed and published an algorithm — together with my advisor and a colleague — to enhance photos of documents captured with digital cameras. These images often suffered from uneven lighting across the page. Our algorithm corrects this by normalizing the illumination, similar to what CamScanner does. The implementation is written in C++ and is available on my GitHub: https://github.com/dmo2000/shading-removal-illustrated-docs.

The method works in four steps:

  1. Detection of low-variation regions: The algorithm first identifies areas in the image with low color variation, which are likely to correspond to blank regions of the paper (i.e., without text or illustrations).

  2. Background clustering: From these low-variation regions, it extracts the cluster most likely to represent the paper's true background.

  3. Shading estimation: Once the paper background is identified, the algorithm estimates the shading pattern for the rest of the document, including non-blank areas.

    To perform this step, I used a technique known as Natural Neighbor Interpolation (also called Voronoi interpolation). This method is especially useful when data points (in this case, known shading values) are unevenly distributed — a situation similar to how weather data is interpolated from scattered measurement stations.

    For the interpolation and related geometric computations, I used the CGAL library. I also relied on data structures from the Boost C++ libraries to support the implementation.

  4. Final enhancement: Finally, the image is enhanced removing the shading obtained in previous step.

The images below shows one example of processing:

Original Image

Original image

Cluster with detected background (steps 1 and 2)

Detected background

Background estimation (step 3)
Background estimation

Final enhancement (step 4)

Final enhancement

The complete source code is publicly available on GitHub:
👉 https://github.com/dmo2000/shading-removal-illustrated-docs

The full paper is available at: https://www.researchgate.net/publication/300028589_Shading_Removal_of_Illustrated_Documents

Comments 0 total

    Add comment