def circle_mask_blurred( img, radius, sig = 20 ):
'''Creates a blurred circle, using supplied image as template for dimensions'''
height, width, ch = img.shape
centre_y = (height-1) / 2.
centre_x = (width-1) / 2.
img_copy = img.copy()
img_copy[:, :, :] = (0.,0.,0.)
rr, cc = draw.circle(centre_y, centre_x, radius, img.shape)
img_copy[rr, cc, :] = (1.,1.,1.)
img_copy = filters.gaussian(img_copy, sigma=sig, mode='nearest', multichannel=True)
return img_copy
评论列表
文章目录