OpenCV中findcontours函数查找轮廓汇总

OpenCV3版本中:hierarchy[i][0]~hierarchy[i][3] 中,0代表与当前轮廓平级的后一个轮廓的的索引编号、1代表与当前轮廓平级的前一个轮廓的索引编号、2代表当前轮廓的子轮廓的索引编号、3代表当前轮廓的父轮廓的索引编号。如果当前轮廓没有对应的平级后一个轮廓、平级前一个轮廓、子轮廓或父轮廓的话,则hierarchy[i][0] ~hierarchy[i][3]的相应位被设置为-1。

OpenCV3版本的关于参数hierarchy源码介绍:

      For each i-th contour contours[i], the elementshierarchy[i][0] , hierarchy[i][1] , hierarchy[i][2] , and hierarchy[i][3] are set to 0-based indicesin contours of the next and previous contours at the same hierarchical level, the first childcontour and the parent contour, respectively. If for the contour i there are no next, previous,parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

有道翻译:

    对于第i个等高线轮廓[i],元素层次结构[i][0],层次结构[i][1],层次结构[i][2],和层次结构[i][3]分别设置为在同一等高线水平下的下一个和先前的等高线的基于0的指数轮廓,第一个子等高线和父等高线。如果等高线i没有next、previous、parent或嵌套等高线(),则层次结构[i]的相应元素将为负数。

等高线:就是轮廓(有道翻译的不行.......,勉强看吧)

 

注意:貌似和OpenCV 的顺序不太一样,OpenCV2的2是父轮廓,3是内嵌轮廓(子轮廓)。

 

关于轮廓查找更加详细的介绍,请转到以下搜集的精彩的博客

findContours函数参数详解:https://blog.csdn.net/dcrmg/article/details/51987348

opencv里findcontours函数中hierarchy的意义:https://blog.csdn.net/a380331382/article/details/64132250

OpenCV中findcontours函数hierarchy轮廓层级详解:https://blog.csdn.net/qq_33810188/article/details/81285867

Opencv笔记——findContours函数:https://blog.csdn.net/yin1203014/article/details/44462791

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值