Skip to content

Latest commit

 

History

History

README.md

CNN based Image Colorization using OpenCV

This repository contains code for the blog post Convolutional Neural Network, CNN based Image Colorization using OpenCV.

CNN based Image Colorization

download

Usage

The small support files (pts_in_hull.npy and models/colorization_deploy_v2.prototxt) are now stored directly in this repo. Run getModels.sh only to download the large colorization_release_v2.caffemodel from the repository release assets.

Attribution for the vendored support files and the mirrored model asset is documented in ASSET_ATTRIBUTION.md.

sudo chmod a+x getModels.sh ./getModels.sh 

Python: Commandline usage to colorize a single image: python3 colorizeImage.py --input greyscaleImage.png a video file: python3 colorizeVideo.py --input greyscaleVideo.mp4

C++:

Compilation examples

g++ pkg-config --cflags --libs opencv4 colorizeImage.cpp -o colorizeImage.out -lopencv_core -lopencv_dnn -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -std=c++11 g++ pkg-config --cflags --libs opencv4 colorizeVideo.cpp -o colorizeVideo.out -lopencv_core -lopencv_dnn -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_videoio -std=c++11

Commandline usage to colorize

a single image: ./colorizeImage.out greyscaleImage.png a video file: ./colorizeVideo.out greyscaleVideo.mp4

AI Courses by OpenCV

Want to become an expert in AI? AI Courses by OpenCV is a great place to start.