Pointilify-ing your images
Have you guys heard about Pointilism? It is a distinct variety of paintings where the image is created not by using long brush strokes but by short “dots” and “dashes”. It is an impressive form of painting, if it appeals to you. Take a look at the below photograph (Image courtesy Wikipedia). It is a fantastic example of pointilism.
As a child when I first learnt about it, I wanted to make paintings like these myself. Humanity was fortunate and I did not become an artist. But I did learn computer vision and image processing. And I wrote a program which pointilifies an image. I want to share the code and details here.
Algorithm
- Read the input image as grayscale (not colour)
- Reduce the image to 1/8th of its original size
- Create an empty image with the same size as original
- Identify the distribution of pixel values and calculate the quartiles i.e. q1, q2, q3 and a4.
- Now walk through the reduced image by each pixel.
- If the pixel intensity is less than q1 then consider it as a whitespace. Assign 8by8 pixel space in the empty image with a pure white image. If the intensity is between q1 and q2 then assign the 8x8 pixel space in the empty image with a “.”. If the intensity is between q2 and q3 then use a “+”. If it is greater than q4 then use a pure black 8x8 image.
- Save the new file to disk.
You can see the code here. https://github.com/ngopikrishna/ComputerVision/tree/main/pointilify
This produces the below results.
Here’s another of George Clooney
What do you guys think? You might want to try with other images as well. Photographs of real people give good results. The higher the resolution, the better. Photographs of paintings are less likely to give a good result because of low variation of pixel intensities. Feel free to checkout the code from Github and play with it.
Thanks,
Gopi Krishna Nuti