小编Joc*_*240的帖子

如何根据孔的数量计算物体

我正在处理具有形状的图像,并且我正在尝试计算具有 1 个孔的对象和具有 2 个孔的对象。

伊格

我找到了关于它的信息,但它是在 MATLAB 中将 那些有孔的对象分割出来 他们使用了 Euler 特性,我知道在 Python 中存在 skimage 库,但我不能使用它。

我也找到了一些代码,但我无法理解。http://www.cis.rit.edu/class/simg782/homework/hw3/hw3solutions.pdf第 16 页。

PRO hw3 4,A,LA,LC,count
;Find all the holes
Ac=A EQ 0
LC=label region(Ac,/ALL)
;Construct an array with the holes filled in
Afill=(A GT 0) OR (LC GT 1)
;Display the arrays
sa=size(A,/dim)
window,/free,xsize=sa[0],ysize=sa[1]
tvlct,rr,gg,bb,/get
tek color
TV,Afill
window,/free,xsize=sa[0],ysize=sa[1]
TV,LC
;Count the objects with holes. First we
;find all the objects and then match up
;the object labels and the hole …
Run Code Online (Sandbox Code Playgroud)

python image-processing python-3.x

5
推荐指数
1
解决办法
1987
查看次数

标签 统计

image-processing ×1

python ×1

python-3.x ×1