© 2018 - Analytics Link

Creating 'Pop Art' using OpenCV and Python

July 11, 2019

I've recently been doing some work for a client in Soho, London.  Every day on the way to the client I walk past the London Palladium, and have been admiring their 'Wall of Fame' which contains images of celebrities that have performed there.

 

The images on the wall are comprised of holes made in metal, with the size of the hole varying so that the image looks like the celebrities face, see below:

 

 

*That's most definitely Cliff Richard, not me.

 

I estimate there are about 10'000 holes (100 x 100) in each image.

 

As always, the first thought that popped into my head was - I wonder how I could create that in Python? So here we are.

 

I've got all the code below, but the general gist of what we're doing is this:

 

  • Selecting an image

  • Converting it to grey-scale

  • Downsizing it to the number of dots we want to draw

  • Selecting how big we want our output image to be

  • On a 'blank canvas' - drawing these dots, the size of each being dictated by the intensity of the pixel in the original image

  • Save the image

 

As an extra step, instead of just using black and white - I've chosen some bright colours which actually turns them almost 'pop-art'-esk.  Feel free to play around with the colours as you want!

 

There is also a 'multiplier' value, which means we can draw our dots onto as large an image as we want (so if you create something you really like, you can take the massive file down to your local print shop and get it framed...!)

 

 

Here are some of the first examples I came out with (these are down-scaled quite a lot, they look much better at full size):

 

 

 

 

 

Have fun - let me know what creations you come up with!

 

 

 

 

 

 

Andrew Jones has over 10 years experience in Analytics, Data Science, and Machine Learning within the Digital, Retail, Telecoms and Travel industries - most recently at Amazon, & Sony PlayStation

Share on Facebook
Please reload

Please reload

Recent Posts