我需要从X,Y坐标绘制多边形,但对于圆角,我有X,Y点
我的代码如下,但是如果有其他库,我可以使用它
这里是我的输出图像:
这就是代码
def create_mask(dirct,filename,alistofpoint,height,width):
myimg = np.zeros((height,width), dtype = "uint8")
po = np.array(alistofpoint, np.int32)
myimg_mod=cv2.fillPoly(myimg, [po],(255,255))
cv2.imwrite(dirct+"//"+filename, myimg_mod)
您可以使用Pillow的^{} 模块,首先使用坐标绘制多边形,然后使用带圆角的宽线勾勒多边形轮廓
这是一个3倍放大图,显示了左侧没有轮廓的多边形,右侧绘制了轮廓。在这样相对较低的图像分辨率下,效果有点难以看到
相关问题 更多 >
编程相关推荐