Fun Task using Cv2 module of Python.

What we are going to see in this blog?

  1. Creating one drawing using cv2 module.
  2. Will swap few part of two images with each other.
  3. Will learn to combine images.

How can we draw image using cv2?

Code snippet and 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:

code snippet and the output Images

Now how can we make a collage of images?

These are two images which will be combined.
Code Snippet and the output image.

Conclusion: