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. AQS -> AbstractQueuedSynchronizer

    前言 : 先说说这个 CLH锁: 加锁 1. 创建一个的需要获取锁的 Node 2. 通过 CAS操作 让自己 成为这个尾部的节点,然后令 设置自己的pre 3. 自旋,直到pre节点释放 释放: 1 ...

  2. 对AWS的计费有点糊涂

    对AWS的计费有点糊涂 今天收到亚马逊的账单,就两笔 1. US West (Oregon) Region     Elastic IP Addresses $0.005 per Elastic IP ...

  3. node.js是什么

    node.js是什么 一.总结 一句话总结:Node.js 就是运行在服务端的 JavaScript. 二.node.js是什么 简单的说 Node.js 就是运行在服务端的 JavaScript. ...

  4. gdbserver 使用方法

    1.分别编译出在宿主机运行的交叉调试器arm-linux-gdb和在目标板上运行的gdbserver: 2.在目标板开启gdbserver#gdbserver  宿主机ip:任意指定端口号 ./待调试 ...

  5. 一个奇怪的Java集合问题

    int size = list.size(); Integer existIndex = -1; for (int index = 0; index < size; index++) { Pho ...

  6. [React & Testing] Simulate Event testing

    Here we want to test a toggle button component, when the button was click, state should change, styl ...

  7. telnet不是内部命令也不是外部命令

    转自:https://www.cnblogs.com/sishang/p/6600977.html 处理办法: 依次打开“开始”→“控制面板”→“打开或关闭Windows功能”,在打开的窗口处,寻找并 ...

  8. 第三次作业 201731082208 黄亚恒&肖莉

    Github项目地址:https://github.com/HYHSTUDEY/WordCount.git 作业地址:https://www.cnblogs.com/hyhhyh090628/p/10 ...

  9. Iptables-主机防火墙设置

    基于Iptables构建主机防火墙 Iptables优点: 数据包过滤机制,它会对数据包包头数据进行分析. 1.1.1 加载相关薄块到内核 [root@centos7 ~]# lsmod | egre ...

  10. Request、Response 之 Http 请求

    今天说些什么呢? 说说Request吧! Request是什么: 请求(Request):一个从客户端到服务器的请求信息包括应用于资源的方法.资源的标识符和协议的版本号 request这个对象不用事先 ...