[英]Python Stroke Width Transform
I'm trying to implement the Stroke Width Transform in Python.我正在尝试在 Python 中实现笔划宽度变换。 I have gone through numerous stack overflow questions and answers and other resources on the internet but have not found an implementation for it.我浏览了互联网上无数的堆栈溢出问题和答案以及其他资源,但还没有找到它的实现。 So I decided to try on my own.所以我决定自己试试。
After performing Canny edge detection, my first step is to calculate the x and y derivatives of the image执行 Canny 边缘检测后,我的第一步是计算图像的 x 和 y 导数
sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5)
sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5)
How do I then combine these to get the gradient at each point in the image?然后我如何组合这些以获得图像中每个点的渐变? Also, how do I then calculate the width of the stroke?另外,我该如何计算笔划的宽度?
I'm using the steps given in the original IEEE Paper (freely accessible paper direct from Microsoft here ) for reference.我正在使用原始IEEE 论文(可在此处直接从 Microsoft 直接免费访问的论文)中给出的步骤作为参考。 The description of the steps is on the bottom of the right hand side on page 3.步骤说明位于第 3 页右侧的底部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.