A tool to remove background color from scanned documents, ideal for yellowed pages or recycled paper.
This project provides a command-line tool to remove the background tint and enhance the foreground of images using various image processing techniques. The tool is implemented in Python and utilizes the OpenCV library for image processing tasks.
- Background Tint Removal: Removes the background tint from images.
- Background and Foreground Enhancement: Denoises (with separate settings) the background and foreground.
- Separate Foreground and Background saving: Can save foreground and background images separately (e.g. to benefit from different compression settings, as implemented in DjVu).
- Inpainting: Supports inpainting of the background.
Ensure you have Python 3.x installed. You can install the required packages using pip:
pip install numpy opencv-python click click-loggingThe tool shall be executed from the command line. Below are some examples of how to use the tool.
python PageWhiten.py input_image.jpg -o output_image.jpgpython PageWhiten.py input1.jpg input2.jpg -o output_directoryBy saving intermediate images, the processing parameters can be tuned more easily.
python PageWhiten.py input_image.jpg -o output_image.jpg --save-intermediate