当前位置:   article > 正文

shapely 多边形缩放_shapely 对多边形进行缩放

shapely 对多边形进行缩放
from shapely.geometry import Polygon, Point, LinearRing
import cv2
import numpy as np
xx = [(10, 10), (12,100), (100, 100), (20,20), (20,10)]
poly = Polygon(xx)
a = poly.buffer(-31)
print(len(list(a.exterior.coords)))
img = np.zeros((200,200,3), dtype=np.uint8)
lines = list(a.exterior.coords)
for i in range(len(lines)-1):
    cv2.line(img, (int(lines[i][0]),int(lines[i][1])), (int(lines[i+1][0]),int(lines[i+1][1])),(255,255,0),1, cv2.LINE_AA)
for i in range(len(xx)-1):
    cv2.line(img, xx[i],xx[i+1],(255,255,255),1, cv2.LINE_AA)
cv2.imshow('ss',img)
cv2.waitKey()
exit()
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/193549?site
推荐阅读
相关标签
  

闽ICP备14008679号