Task 4 image , crop and combine
🔅 Task 4.1
📌 Create image by yourself Using Python Code
🔅 Task 4.2
📌 Take 2 image crop some part of both image and swap it.
🔅 Task 4.3
📌 Take 2 image and combine it to form single image. For example collage
Task 4.1 :
We first import cv2 and numpy , and define a black canvas be initializing it with zeros.
We then initialize the points for making the line which , would then make the end picture .
each and every line is defined manually using the line draw function in cv2.
So then end result is presented , as custom made image , consisting of three different cubes with three different colours.
For Cropping and exchanging we use cv2 library from opencv to import the images from the hardisk ,
importing the modules and require libraries:
also displaying the second image
Cropping out the areas to be replaced of the image:
The resizing the crop f image 1 according to image 2 and the replaing:
and same for image 1 from image 2:
Now about combining both the images , we need to consider a concept called hstack and vstack in numpy , which horizontally or vertically stacks two arrays that is what we are going to do in this step :
The images we are going to hstack :
After hstack :