def create_wedge( image, center, radius, wcors, acute_angle=True) :
'''YG develop at June 18, 2017, @CHX
Create a wedge by a combination of circle and a triangle defined by center and wcors
wcors: [ [x1,x2,x3...], [y1,y2,y3..]
'''
from skimage.draw import line_aa, line, polygon, circle
imy, imx = image.shape
cy,cx = center
x = [cx] + list(wcors[0])
y = [cy] + list(wcors[1])
maskc = np.zeros_like( image , dtype = bool)
rr, cc = circle( cy, cx, radius, shape = image.shape)
maskc[rr,cc] =1
maskp = np.zeros_like( image , dtype = bool)
x = np.array( x )
y = np.array( y )
print(x,y)
rr, cc = polygon( y,x)
maskp[rr,cc] =1
if acute_angle:
return maskc*maskp
else:
return maskc*~maskp
评论列表
文章目录