1、findContours函数原型以及参数介绍
void findContours
(
InputOutputArray image, //输入图像,必须是8位单通道图像,并且应该转化成二值的
OutputArrayOfArrays contours, //检测到的轮廓,每个轮廓被表示成一个point向量
OutputArray hierarchy, //可选的输出向量,包含图像的拓扑信息。其中元素的个数和检测到的轮廓的数量相等
int mode, //说明需要的轮廓类型和希望的返回值方式
int method, //轮廓近似方法
Point offset = Point() //轮廓点相对偏移点
)
2、测试代码
#include <stdio.h>
#include <iostream>
#include <vector>
#include "core.hpp"
#include "highgui.hpp"
#include "imgproc.hpp"
using namespace cv;
using namespace std;
int main()
{
//1 加载和现实原图
Mat matSrc = imread("1.j