OpenCV findContours
来源:互联网 发布:淘宝u站报名 编辑:程序博客网 时间:2024/05/17 12:53
OpenCV findContours使用笔记
以下面60×60位图为例
Mat img(60, 60, CV_8UC1, Scalar(0));rectangle(img, Point(20,20), Point(30,30), Scalar(255), 1);rectangle(img, Point(30,20), Point(40,30), Scalar(255), 1);rectangle(img, Point(23,23), Point(27,27), Scalar(255), 1);
使用CV_RETR_TREE
vector<vector<Point> > contours; vector<Vec4i> hierarchy; findContours(img, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE);
contours的5个元素输出为:
[20, 20] [20, 21] [20, 22] [20, 23] [20, 24] [20, 25] [20, 26] [20, 27] [20, 28] [20, 29] [20, 30] [21, 30] [22, 30] [23, 30] [24, 30] [25, 30] [26, 30] [27, 30] [28, 30] [29, 30] [30, 30] [31, 30] [32, 30] [33, 30] [34, 30] [35, 30] [36, 30] [37, 30] [38, 30] [39, 30] [40, 30] [40, 29] [40, 28] [40, 27] [40, 26] [40, 25] [40, 24] [40, 23] [40, 22] [40, 21] [40, 20] [39, 20] [38, 20] [37, 20] [36, 20] [35, 20] [34, 20] [33, 20] [32, 20] [31, 20] [30, 20] [29, 20] [28, 20] [27, 20] [26, 20] [25, 20] [24, 20] [23, 20] [22, 20] [21, 20]
[30, 21] [31, 20] [32, 20] [33, 20] [34, 20] [35, 20] [36, 20] [37, 20] [38, 20] [39, 20] [40, 21] [40, 22] [40, 23] [40, 24] [40, 25] [40, 26] [40, 27] [40, 28] [40, 29] [39, 30] [38, 30] [37, 30] [36, 30] [35, 30] [34, 30] [33, 30] [32, 30] [31, 30] [30, 29] [30, 28] [30, 27] [30, 26] [30, 25] [30, 24] [30, 23] [30, 22]
[20, 21] [21, 20] [22, 20] [23, 20] [24, 20] [25, 20] [26, 20] [27, 20] [28, 20] [29, 20] [30, 21] [30, 22] [30, 23] [30, 24] [30, 25] [30, 26] [30, 27] [30, 28] [30, 29] [29, 30] [28, 30] [27, 30] [26, 30] [25, 30] [24, 30] [23, 30] [22, 30] [21, 30] [20, 29] [20, 28] [20, 27] [20, 26] [20, 25] [20, 24] [20, 23] [20, 22]
[23, 23] [23, 24] [23, 25] [23, 26] [23, 27] [24, 27] [25, 27] [26, 27] [27, 27] [27, 26] [27, 25] [27, 24] [27, 23] [26, 23] [25, 23] [24, 23]
[23, 24] [24, 23] [25, 23] [26, 23] [27, 24] [27, 25] [27, 26] [26, 27] [25, 27] [24, 27] [23, 26] [23, 25]
hierarchy的5个元素输出为:
[-1, -1, 1, -1]
[2, -1, -1, 0]
[-1, 1, 3, 0]
[-1, -1, 4, 2]
[-1, -1, -1, 3]
hierarchy的元素类型是Vec4i,分别表示对应轮廓的后继轮廓、前趋轮廓、子轮廓、父轮廓的索引号,-1表示不存在。
- OpenCV findContours
- opencv.cv2.findContours()函数
- opencv findContours使用问题
- OpenCV - findContours函数使用
- opencv findContours 相关
- opencv 轮廓查找 findContours
- opencv Findcontours异常
- OpenCV中findContours详解
- opencv findContours家族全集
- OpenCV findcontours参数说明
- opencv findContours 崩溃CrtDbgBreak
- Opencv--findContours()的使用陷阱
- opencv中的findContours的使用
- OpenCV之findContours函数解读
- opencv中findContours导致crash
- OpenCV Tutorial: 輪廓(findContours、drawContours)
- opencv findContours和drawContours使用方法
- OpenCV之findContours函数解读
- 用Kotlin语言写一个简单的Android Demo(有详细步骤和各种解决方法)
- 总结PHP如何获取当前主机、域名、网址、路径、端口和参数等
- tensorflow之双向循环神经网络
- PHP用支付宝沙箱账号测试支付功能
- SpringBoot配置属性之Server
- OpenCV findContours
- linux----TCP
- ADO.NET データベース接続方式
- cordova build android -- 报错 gradle 异常
- 文件上传漏洞(绕过姿势)
- UnicodeEncodeError: 'ascii' codec can't encode characters in position 9-14: ordinal not in range(128
- 今天开始拜读一本大神写的书《实战Java高并发程序设计 》
- java-FTPClient-ftp 上传文件、创建目录(支持中文目录、文件名)
- open/close函数的使用