opencv学习-泊松分布


import cv2
import numpy as np

# Read images : src image will be cloned into dst
img = cv2.imread(r"E:\1\data\img\4.png")   #背景影像
obj= cv2.imread(r"E:\1\data\img\2.png")    #目标影像

# Create an all white mask
mask = 255 * np.ones(obj.shape, obj.dtype)

# The location of the center of the src in the dst
width, height, channels = img.shape
print(img.shape)
center = (height//2, width//2)
print(center)

# Seamlessly clone src into dst and put the results in output
normal_clone = cv2.seamlessClone(obj,img, mask,center , cv2.NORMAL_CLONE)
mixed_clone = cv2.seamlessClone(obj, img, mask,center , cv2.MIXED_CLONE)

# Write results
cv2.imwrite(r"E:\1\data\result\normal_clone.png", normal_clone)
cv2.imwrite(r"E:\1\data\result\mixed_clone.png", mixed_clone)

可以用于数据增强

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值