原文地址:Seamless Cloning using OpenCV (Python , C++)
无缝合成(Seamless Cloning)是 opencv3 的新特性。
利用这个新特性,我们可以从一个图像复制对象,并将其粘贴到另一个图像中,同时使组合看起来无缝和自然。
比如说下面这个图就是飞机和天空无缝合成的结果
想要达到上述效果,我们主要的函数就是 cv2.seamlessClone,其定义如下:
output = cv2.seamlessClone(src, dst, mask, center, flags)
参数 | 含义 |
---|---|
src | Source image that will be cloned into the destination image. In our example it is the airplane. |
dst | Destination image into which the source image will be cloned. In our example it is the sky image. |
mask | A rough mask around the object you want to clone. This should be the size of the source image. Set it to an all white image if you are lazy! |