Source: Google

Fun Image Processing using Python 🐍🐍

Most of us are familiar with image processing, not in formal terms of image processing but we all edit our pictures and post them on social media. 💖

Here I am going to show some interesting ways of doing image processing that we normally do every day using OpenCV and python.

  1. Creating a custom image using OpenCV 😍✨
  2. Cropping pictures and pasting them ( We do that every day, don’t we while making memes 😂😂 )
  3. Making a collage of 2 pictures

So let's get going ✌💥

Using the above code we can create a smiley face 😊

I have basically used the drawing functions that are available from the OpenCV library in the cv2 module and created the image.

Image Output

Keep smiling 😊 in your tough times and things will definitely come back to normal and you will achieve all the success in the world 😊✌🙏

🚩 You can get creative and create your own custom image like this. 😉😉

Now I will show you how to crop a face from an image and paste it somewhere ( the thing we mostly do while meme-making 😂😂 )

The Original Image I am going to use is -

Source: Google

Our very favorite Tom and Jerry.😍

Who all got reminded of their childhood memories? 💖🤩

Now using the above code we can crop Tom and Jerry’s faces and swap them also.

Results -

Tom’s cropped image

Here the face of Tom is cropped and swapped with Jerry’s face.

Jerry’s cropped image

Here the face of Jerry is cropped and swapped with Tom’s face.

❗ In the above code, only one face swap code will work at a time, that is if you run the code for pasting Tom’s face on top of Jerry’s face then the other won’t work, and vice-versa. You need to then run the codes separately. I have given the codes together here. ❗

Now I will be creating a collage of Tom and Jerry ( after all they were the best of buddies 💖 )

Collage made using OpenCV

This way I have performed few fun experiments with OpenCV and NumPy. 💖

You can find all the codes and images that I used here from the below GitHub link

A lot more things can be done using OpenCV and NumPy but for now this much.✌

I hope you liked this article.💖

Would definitely like to hear your views on this and feedbacks so that I can improve on those points in future articles. 🙌 Comment your views below.

You can also check my LinkedIn profile and connect with me.

Follow me on medium as I will come up with articles on various technologies like Cloud Computing, DevOps, Automation, and their integration.

That’s all for now. Thank You !! 😊✌

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rahul Sil

I am a tech enthusiasts. I love exploring new technologies and creating stuff out of them !! ✌