I am learning OpenCV and tried to paste a small image over a large image. But, it showed an error as both the images should have an equal size. I have also tried to follow the suggestion provided (How to paste an image onto a larger image using Pillow?) and (How do you composite an image onto another image with PIL in Python?)
import cv2 as cv
from scipy import ndimage
img1 = cv.imread('Please put your file name')
top_left_x = min([x1,x2,x3,x4])
top_left_y = min([y1,y2,y3,y4])
bot_right_x = max([x1,x2,x3,x4])
bot_right_y = max([y1,y2,y3,y4])
y_right =bot_right_y + 1
x_right =bot_right_x + 1
cropped = img[top_left_y: y_right, top_left_x: x_right]
rotate = ndimage.rotate(cropped, ang)
The final output image should be at centre.