Python and C++ implementations of a user-guided image/video colorization technique as proposed by the paper Colorization Using Optimization. The algorithm is based on a simple premise; neighboring pixels in space-time that have similar intensities should have similar colors. This premise is formalized using a quadratic cost function that obtains an optimization problem that can be solved efficiently using standard techniques. While using this alogorithm, an artist only needs to annotate the image with a few color scribbles or visual clues, and the indicated colors are automatically propagated in both space and time to produce a fully colorized image or sequence. The annotation can be done using any drawing tool such as JSPaint or Gimp.
-
Create a virtualenv using:
virtualenv venv --python=python3
source venv/bin/activate
pip install -r requirements.txt
-
Colorize images using the CLI:
python colorize.py Options: --original_image TEXT Original Image Path --visual_clue TEXT Visual Clue Image Path --result_path TEXT Colorized Image Path (without file extensions) -i, --use_itercative Use Iterative Mode --epochs INTEGER Number of epochs for Iterative Mode --log_intervals INTEGER Log Interval --help Show this message and exit.
-
Install dependencies using
sh install.sh
-
Create a build directory
mkdir build && cd build
-
Generate makefiles and compile using
cmake .. && make
-
Run the executable using
./colorization [input-image] [visual-clues] [result] [gamma] [threshold]
-
Alternatively, you can download the executable from here and run it (installation of dependencies is still needed).
Original Image | Visual Clues | Colorized Image |
---|---|---|