【问题标题】:How to trace curvy lines in an image in Python? [closed]如何在 Python 中跟踪图像中的曲线? [关闭]
【发布时间】:2019-07-18 04:00:12
【问题描述】:

我正在尝试在视网膜图像中描绘几条曲线(血管)。图像中的血管非常清晰,所以我认为这会非常直截了当,但我很难弄清楚这一点。这是实际图像的链接: https://drive.google.com/open?id=1cRTk37U7LSeaV6rhvg0K6FKYsnDhlQZr

我正在寻找以下追踪。还希望将红色跟踪放在单独的文件中:

【问题讨论】:

  • 尝试阅读cv2.adaptiveThreshold()

标签: python opencv retina


【解决方案1】:

这是在 Imagemagick 中实现的一种可能的方法。您可能会在 OpenCV 中找到类似的功能。不是最好的检测,但可以得到大部分的行。

Filter noise (20 iterations of -enhance) -- median filtering should work.

Perform local area (adaptive) thresholding (-lat)

Perform morphology thinning

Use connected components processing to remove small isolate regions (<100)

Do morphology dilate to thicken the lines.


输入:

convert img.jpg \
-enhance -enhance -enhance -enhance -enhance \
-enhance -enhance -enhance -enhance -enhance \
-enhance -enhance -enhance -enhance -enhance \
-enhance -enhance -enhance -enhance -enhance \
-negate -lat 50x50+1% \
-morphology Thinning:-1 Skeleton \
-define connected-components:area-threshold=100 \
-define connected-components:mean-color=true \
-connected-components 4 \
-morphology dilate octagon:3 \
result.png


【讨论】:

  • 感谢您的回复。这是python代码吗?
  • 不,正如我提到的,它是 Imagemagick 代码。
猜你喜欢
  • 1970-01-01
  • 2011-07-11
  • 2011-04-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-20
  • 1970-01-01
  • 2011-03-05
相关资源
最近更新 更多