基于zhang 的骨架提取

 最近在学图像处理的骨架提取,发现很多中文教材对这个方面讲的很有欠缺,于是我决定看英文原文的论文。看了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的图像骨架提取算法可以得到比较平滑的边界。具体的算法如下:
基于zhang <wbr>的骨架提取
      定义,B(P1)为p1点的非零邻域的个数,A(P1)为p1点周围8个像素点灰度值以0-1顺序排列的个数(一部分国内教材没介绍A(P1)的具体含义,导致看不懂原理),如上图所示。之后,进行对每个像素点如下图所示操作:
基于zhang <wbr>的骨架提取      该算法的伪代码如下所示:

Zhang-Suen thinning steps:

  1. While points are deleted do
  2.     For all pixels p(i,j) do
  3.         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
  4.            Delete pixel p(i,j)
  5.         end if
  6.     end for
  7. end while

Where A(P1) is the number of 0 to 1 transitions in a clockwise direction from P9 back to itself, and B(P1) is the number of non-zero neighbors of P1.

    我在国外上面的链接上找到了这个算法的opencv编程实现,效率很高。源代码和用法见文件内(thin.cpp):

http://pan.baidu.com/s/1yFzUe。

  • 6
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值