一、findContours函数
1、函数原型
该函数从二值图像中检索轮廓。 轮廓是形状分析和对象检测和识别的有用工具。
void cv::findContours (InputArray image, OutputArrayOfArrays contours, OutputArray hierarchy, int mode, int method, Point offset=Point())
void cv::findContours (InputArray image, OutputArrayOfArrays contours, int mode, int method, Point offset=Point())
2、参数详解
image | 源,8 位单通道图像。 非零像素被视为 1。 零像素保持为 0,因此图像被视为二进制。 您可以使用 compare、inRange、threshold、adaptiveThreshold、Canny 等从灰度或彩色图像中创建二值图像。 如果 mode 等于 RETR_CCOMP 或 RETR_FLOODFILL,则输入也可以是标签的 32 位整数图像 (CV_32SC1)。 |
contours | 检测到的轮廓。 每个轮廓都存储为点向量(例如 std::vector<std::vector<cv::Point> >)。 | <