定位一桥状结构的端部点映像 [英] Locating the end points of a bridge-like structure in an image

查看:156
本文介绍了定位一桥状结构的端部点映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到一个桥状结构的端部点映像?

How do I locate the end points of a bridge-like structure in an image?

下面是一个广义重presentation。

我有一组是什么样子,你的左手栏看到如图上面的图片图像。我所试图检测/定位实际上是显示在上面的图片右侧栏的两个端点。这很象定位桥梁的两端点。

I have a set of images that look like what you see on the left hand column as shown in the above picture. What I am trying to detect/locate is actually the two endpoints that are shown on the right hand column in the above picture. It's quite like locating the "two ends points" of the 'bridge'.

我已经申请了一些基本的形态学操作;然而,无论是我做错了还是那些基本形态操作使用的不是这种情况。 (我曾尝试使它成为骷髅;然而,一旦骨架形成,我似乎无法检测与三个边缘交叉)。

I have applied some basic morphological operations; however, either I'm doing it wrong or those basic morphological operations aren't working in this scenario. (I have tried making it into skeletons; however, once the skeletons are formed, I can't seem to detect the cross with three edges).

感谢previous建议;但是,它看起来像原来的图像集不能像我想previously得出完全一概而论。

Thanks for the previous suggestion; however, it looks like the original sets of images cannot be completely generalized like what I'd previously drawn.

我重视的最新更新这个问题。下面是一个更详细的重新presentation包含原始分割区,将会发生了疏形态运算的相应的图像。同样,左侧是最初分割区域;而右边是将待检测的点。

I have attached the latest updates to this question. Below is a more detailed representation that includes the original segmented regions and the corresponding images that'd undergone a "thinning" morphological operation. Again, the left side is the originally segmented region; while on the right would be the points to be detected.

推荐答案

下面是一个code为例,skeletonizing后的图像定位分支点:

Here is a code example to locate branch points after skeletonizing the image:

import pymorph as m
import mahotas
from numpy import array

image = mahotas.imread('1.png') # load image

b1 = image[:,:,1] < 150 # make binary image from thresholded green channel

b2 = m.thin(b1) # create skeleton
b3 = m.thin(b2, m.endpoints('homotopic'), 15) # prune small branches, may need tuning

# structuring elements to search for 3-connected pixels
seA1 = array([[False,  True, False],
       [False,  True, False],
       [ True, False,  True]], dtype=bool)

seB1 = array([[False, False, False],
       [ True, False,  True],
       [False,  True, False]], dtype=bool)

seA2 = array([[False,  True, False],
       [ True,  True,  True],
       [False, False, False]], dtype=bool)

seB2 = array([[ True, False,  True],
       [False, False, False],
       [False,  True, False]], dtype=bool)

# hit or miss templates from these SEs
hmt1 = m.se2hmt(seA1, seB1)
hmt2 = m.se2hmt(seA2, seB2)

# locate 3-connected regions
b4 = m.union(m.supcanon(b3, hmt1), m.supcanon(b3, hmt2))

# dilate to merge nearby hits
b5 = m.dilate(b4, m.sedisk(10))

# locate centroids
b6 = m.blob(m.label(b5), 'centroid')

outputimage = m.overlay(b1, m.dilate(b6,m.sedisk(5)))
mahotas.imsave('output.png', outputimage)  

这篇关于定位一桥状结构的端部点映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆