Skip to content

bluetickconsultants/image_video_colorization

Repository files navigation

Image and Video colorization using Deep learning and OpenCV



Converting color images to black and white is quite easy using the OpenCV framework,but for converting black and white images to color we need to take a different approach. We need to add colors to black and white pixels using Deep Learning Neural Networks. Let’s first look at how the color information is represented in gray scale images and digital images.

Gray scale image means the value of each pixel represents only the intensity information of the light. Such images commonly display only the darkest black to the brightest white. The image carries only black, white, and gray colors, in which gray has multiple levels.Each pixel typically consists of 8 bits(1byte) for gray scale images and there are 256 possible grayscale colors.

Color images have three different channels called RGB. Each pixel intensity was represented by three channels. Each color image has 24 bits/pixel, which means 8 bits for each of the three color bands(RGB).There are 16 million colors possible.

Black and White Image to Color Image

We trained a neural network which converts this grayscale image to the colored one. It needs to learn to map this single value to a three channel image. For this purpose we used a concept called LAB space where we figured out the lightness scale of each pixel and mapped them correspondent A and B channels.

LAB color space

Lab is an another color space same like RGB where L channel = Lightness A channel = from green-red B channel = from Yellow-blue

Technologies used

● Neural Networks ● Open CV ● Tensorflow ● Statistics for Normalization

For this purpose we used a pre-trained neural network which was already trained on Imagenet grayscale dataset.It uses a simple convolutional neural network architecture. As explained above, we take the L channel image and learn to predict a and b channels. Combining the prediction and input would give us the colorized image which looks like a Lab color space image.

4

After collecting pretrained weights and using tensorflow and opencv we convert predicted lab space images into RGB format.Hence the Neural network trained on 1000 different greyscale images we got 91.29 % accuracy for our results.

Outputs

bw_video_1.mp4
processed_video_1.mp4
bw_video_2.mp4
processed_video_2.mp4
people.mp4
processed_video_3.mp4
videoplayback.mp4
processed_video_4.mp4

Useful Information

References

Other Projects

To view all other open source projects visit

Author

Bluetick Consultants LLP

Releases

No releases published

Packages

No packages published