What we are going to see in this blog?
- Creating one drawing using cv2 module.
- Will swap few part of two images with each other.
- Will learn to combine images.
How can we draw image using cv2?
Well there are many function in cv2 which has the capability to draw line circle, rectangle, lines, etc. I have used few of those function to draw a house and a person. Below is image of my code snippet and the output.
How to swap few part of two images with each other?
There is one good thing about image is that it is an array of number and whatever operation we can do with the numpy array in python we can do with the images also. Here I have taken two pictures and have swapped the eyes of the two emojis. Below are the two images which I have used for swapping.
I have used the concept of numpy array and cropped the eyes of both the images and swapped it. below is image of code snippet and the output image:
Now how can we make a collage of images?
As I said Images are just a array of number so we can perform all the operation on images which e can perform on numpy. Here I will add the two image arrays and the output will be a combination of both the images. Here are the code snippet and the output of the code.
Cv2 is really amazing and we can perform many amazing thing by using it. The task I have perform is just a small things we can perform many other tasks too.