参考链接

import cv2
import numpy as np

im = cv2.imread('d:/images/wood.jpg')
obj = cv2.imread('d:/images/love.jpg')

mask = 255*np.ones(obj.shape, obj.dtype)

width, height, channels = im.shape
center = (int(height/2), int(width/2))

normal_clone = cv2.seamlessClone(obj, im, mask, center, cv2.NORMAL_CLONE)
mixed_clone = cv2.seamlessClone(obj, im, mask, center, cv2.MIXED_CLONE)

cv2.imwrite("d:/images/opencv-normal-clone-example.jpg", normal_clone)
cv2.imwrite("d:/images/opencv-mixed-clone-example.jpg", mixed_clone)

 

seamless clone

seamless clone

mixed clone

seamless clone

normal clone

seamless clone

相关文章:

  • 2021-08-31
  • 2022-12-23
  • 2022-02-25
  • 2021-10-20
  • 2021-12-17
  • 2021-10-07
猜你喜欢
  • 2021-07-08
  • 2022-12-23
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
相关资源
相似解决方案