赞
踩
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()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。