Части моего кода:
Код: Выделить всё
filename = askopenfilename(filetypes=[("image", "*.png")])
image = cv2.imread(filename, 1)
filename1 = askopenfilename(filetypes=[("image", "*.png")]) # Inserted img
img = cv2.imread(filename1, 1)
# to calculate the cordination/width and height of the rectangle
x, y, w, h = cv2.boundingRect(c)
offset = np.array((x, y))
image[offset[0]:offset[0]+img.shape[0], offset[1]:offset[1]+img.shape[1]] = img
Подробнее здесь: https://stackoverflow.com/questions/502 ... r-position