最近在学图像处理的骨架提取,发现很多中文教材对这个方面讲的很有欠缺,于是我决定看英文原文的论文。看了2篇论文,
“A fast parallel algorithm for thinning digital patterns”
by T.Y. Zhang and C.Y. Suen.以及
Parallel thinning with two sub-iteration algorithms”
by Zicheng Guo and Richard Hall.。
看了论文后,发现中文一些教材只是简单截取了论文的片段,导致无法理解(即便是天才,没介绍参数的意义应该也不懂吧)。后来,还发现了3个将其算法用opencv实现的代码。网址如下:
基于以上,已经完美的完成了项目的运行需求。
Zhang and C.Y. Suen的图像骨架提取算法可以得到比较平滑的边界。具体的算法如下:
定义,B(P1)为p1点的非零邻域的个数,A(P1)为p1点周围8个像素点灰度值以0-1顺序排列的个数(一部分国内教材没介绍A(P1)的具体含义,导致看不懂原理),如上图所示。之后,进行对每个像素点如下图所示操作:
![基于zhang <wbr>的骨架提取 基于zhang <wbr>的骨架提取](https://i-blog.csdnimg.cn/blog_migrate/cc5fe53ddbe89208277f1d9dc7165835.jpeg)
Zhang-Suen thinning steps:
- While
points are deleted do -
For all pixels p(i,j) do -
if (a) 2 ≤ B(P1) ≤ 6
(b) A(P1) = 1
(c) Apply one of the following:
1. P2 x P4 x P6 = 0 in odd iterations
2. P2 x P4 x P8 = 0 in even iterations
(d) Apply one of the following:
1. P4 x P6 x P8 = 0 in odd iterations
2. P2 x P6 x P8 = 0 in even iterations
then -
Delete pixel p(i,j) -
end if -
end for - end while
Where
http://pan.baidu.com/s/1yFzUe。