如何在图像中找到桥状结构的端点?
下面是一般化的表示。
我有一组图像,看起来就像您在左栏中看到的那样,如上图所示。我试图检测/定位的实际上是上图中右侧列中显示的两个端点。这很像找到“桥”的“两个端点”。
我应用了一些基本的形态学运算;然而,要么我做错了,要么那些基本的形态学操作在这种情况下不起作用。 (我曾尝试将其制作成骨架;但是,一旦骨架形成,我似乎无法检测到具有三个边缘的十字)。
EDITS
感谢之前的建议;然而,看起来原始图像集不能像我之前绘制的那样完全概括。
我已附上此问题的最新更新。下面是更详细的表示,包括原始分割区域和经过“细化”形态学操作的相应图像。同样,左边是原来分割的区域;右边是要检测的点。
使用Python的解决方案,NumPy http://en.wikipedia.org/wiki/NumPy, Pymorph http://luispedro.org/software/pymorph and Mahotas http://luispedro.org/software/mahotas:
import pymorph as m
import mahotas
from numpy import where, reshape
image = mahotas.imread('input.png') # Load image
b1 = image[:,:,0] < 100 # Make a binary image from the thresholded red channel
b2 = m.erode(b1, m.sedisk(4)) # Erode to enhance contrast of the bridge
b3 = m.open(b2,m.sedisk(4)) # Remove the bridge
b4 = b2-b3 # Bridge plus small noise
b5 = m.areaopen(b4,1000) # Remove small areas leaving only a thinned bridge
b6 = m.dilate(b3)*b5 # Extend the non-bridge area slightly and get intersection with the bridge.
#b6 is image of end of bridge, now find single points
b7 = m.thin(b6, m.endpoints('homotopic')) # Narrow regions to single points.
labelled = m.label(b7) # Label endpoints.
x1, y1 = reshape(where(labelled == 1),(1,2))[0]
x2, y2 = reshape(where(labelled == 2),(1,2))[0]
outputimage = m.overlay(b1, m.dilate(b7,m.sedisk(5)))
mahotas.imsave('output.png', outputimage)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)