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.
What I am going to demonstrate specifically?
- Creating a custom image using OpenCV ๐โจ
- Cropping pictures and pasting them ( We do that every day, donโt we while making memes ๐๐ )
- 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.
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 -
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 -
Here the face of Tom is cropped and swapped with Jerryโs face.
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 ๐ )
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 !! ๐โ