【发布时间】:2017-08-23 20:10:38
【问题描述】:
我正在使用带有 python 的 openCV 从图像中提取轮廓。现在我需要将这些轮廓路径(列表)导出为 svg 路径。我怎样才能做到这一点?
代码:
ret,thresh = cv2.threshold(imgray,27,25,0)
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_EXTERNAL , cv2.CHAIN_APPROX_TC89_L1)
print(type(contours)) #type list
【问题讨论】:
-
您遇到困难的具体方面是什么?您有一个轮廓向量,遍历它们,将它们转换为 SVG
path语句并将它们写入文本文件 w3schools.com/graphics/svg_path.asp 您可能需要进行初始传递以了解页面大小的最大尺寸,或者您只需使用您在其上找到轮廓的原始图像的尺寸。 -
@MarkSetchell 谢谢你的提示。我太懒了:)
标签: python opencv svg contour opencv-contour