findContours 是 opencv 下的轮廓提取函数。

1. api 分析

findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy
  • image,一般为单通道图像;
  • mode:轮廓检索模式(retrieve)
    • cv2.RETR_EXTERNAL,只检测外部轮廓,也即对所有轮廓hierarchy[i][2] == hierarchy[i][3] == -1

      • hierarchy[i],一级索引指的是全部检索到的轮廓,轮廓由四个元素构成的元组组成,
    • cv2.RETR_LIST:提取所有轮廓,并放置在 list 中,对检测到的轮廓不建立等级关系;
    • cv2.RETR_TREE:提取所有轮廓,建立网状的轮廓结构;
  • method:轮廓的近似方法,是提取轮廓上所有的像素点,还是一些关键点。
    • 如对于一条线段是提取所有点,还是仅提取两个端点;
  • contours:检索到的轮廓,为构成轮廓的点集;

2. 轮廓的层次结构

python opencv3 —— findContours的更多相关文章

  1. python opencv3添加opencv-contrib

    不需要编译或其他操作,只需一句话安装第三方库利用sift等特征提取算法: sudo pip3 install opencv-contrib-python 附网站:https://pypi.python ...

  2. python opencv3 给图片加中文

    转自:https://www.cnblogs.com/arkenstone/p/6961453.html opencv3.2将中文输出到图片上 opencv自带的putText函数无法输出utf8类型 ...

  3. python opencv3 背景分割 mog2 knn

    git:https://github.com/linyi0604/Computer-Vision 使用mog2算法进行背景分割 # coding:utf-8 import cv2 # 获取摄像头对象 ...

  4. python opencv3 运动检测

    git:https://github.com/linyi0604/Computer-Vision 思路:  开启摄像头后 设置一个当前帧为背景, 在之后检测到的帧都与背景对比不同,对不同的地方进行检测 ...

  5. python opencv3 矩形 圆形边框

    git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 读入图像 ...

  6. python opencv3 轮廓检测

    git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 创建一个2 ...

  7. python opencv3 写字画圈画矩形

    python opencv练习 自定义一张[512, 512, 3]的图像 在上面写写字,画画圈和矩形 显示 代码为: import cv2 import numpy as np img = np.z ...

  8. python opencv3 检测人

    git:https://github.com/linyi0604/Computer-Vision # coding:utf-8 import cv2 # 检测i方框 包含o方框 def is_insi ...

  9. python opencv3 FLANN单应性匹配

    git:https://github.com/linyi0604/Computer-Vision 匹配准确率非常高. 单应性指的是图像在投影发生了 畸变后仍然能够有较高的检测和匹配准确率 # codi ...

随机推荐

  1. 78.pipe多管道云端,客户端通信

    压力测试截图: 云端 定义管道缓存区大小,最多连接数量(线程个数),当前线程个数,管道名字 //缓冲区大小 #define SIZE 4096 //最多连接数量 #define MAX_CONNECT ...

  2. 一文了解sun.misc.Unsafe

    Java语言和JVM平台已经度过了20岁的生日.它最初起源于机顶盒.移动设备和Java-Card,同时也应用在了各种服务器系统中,Java已成为物联网(Internet of Things)的通用语言 ...

  3. HDU4630-No Pain No Game(离线,线段树)

    Problem Description Life is a game,and you lose it,so you suicide. But you can not kill yourself bef ...

  4. BZOJ2565: 最长双回文串(Manacher)

    Description 顺序和逆序读起来完全一样的串叫做回文串.比如acbca是回文串,而abc不是(abc的顺序为“abc”,逆序为“cba”,不相同).输入长度为n的串S,求S的最长双回文子串T, ...

  5. 【2017"百度之星"程序设计大赛 - 复赛】Arithmetic of Bomb

    [链接]http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=777&pid=1001 [题意] 在这里写 [题解] ...

  6. 设计模式六大原则(二):里氏替换原则(Liskov Substitution Principle)

    里氏替换原则(LSP)由来: 最早是在 妖久八八 年, 由麻神理工学院得一个女士所提出来的. 定义: 1:如果对每一个类型为 T1的对象 o1,都有类型为 T2 的对象o2,使得以 T1定义的所有程序 ...

  7. CSU1660: K-Cycle

    Description A simple cycle is a closed simple path, with no other repeated vertices or edges other t ...

  8. spring 通过编程来获取属性文件

    配置可以读取属性: <beans profile="dev"> <context:property-placeholder ignore-resource-not ...

  9. Flask项目之手机端租房网站的实战开发(九)

    说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 接着上一篇博客继续往下写 :https://blog.csdn.net/qq_41782425/article/details/8 ...

  10. 【Codeforces Round #431 (Div. 2) B】 Tell Your World

    [链接]点击打开链接 [题意] n个点,x从左到右严格递增的顺序给出 让你划两条平行的,且没有相同点的直线; 使得它们俩各自最少穿过一个点. 且它们俩穿过了所有的点. [题解] 枚举第一个点和哪个点组 ...