Colorization is the process of adding color to a black and white or grayscale image or video. Colorization methods aim to produce realistic and accurate colors that match the original scene or subject, and can be applied to historical photos or films, as well as contemporary media.

Automated colorization methods use machine learning algorithms, such as deep neural networks, to automatically predict and apply colors to the image. These algorithms are trained on large datasets of color images and their corresponding black and white versions, learning to recognize and generalize patterns and relationships between features in the image.

Some colorization methods involve providing a small amount of color guidance, such as indicating the general hue of objects or regions in the image, while others require no user input and can generate plausible colorizations from scratch.

As part of a school project, I had the opportunity to develop an automatic

colorization method in C++.

Technologies Used: C++, OpenCV, QtCreator.

You can find the code at this link.

Here are the different steps that we followed.

  • Creating the graphical window (Start, Quit)
  • Selection of a filter for edge detection
  • Management of the display of the 2 images side by side
  • Palette management
  • Management of writing on the image containing the edges
  • Image colorization

The first step was to create a window where we can see the main picture and the edge detection.

After doing this different steps:

  • Region growing function
  • Management of region filling using the created function
  • Verification of the state of the different neighboring pixels = optimal colorization
  • Management of the display of the new image with the new colors chosen for colorization
We were able to get this result: