opencv findContours和drawContours()函数解读
opencv中查找图像轮廓的函数是cv::findContours(),并通过cv::drawContours()将查找到的轮廓绘制到图像上。 函数findContour是从二值图像中来计算轮廓的,它可以使用Canny()函数处理的图像,因为这样的图像含有边缘像素;也可以使用threshold()或者adaptiveThreshold()处理后的图像,其边缘隐含在正负区域的交界处。 void cv::findContours( cv::InputOutputArray image, // 输入的8位单通道“二值”图像 cv::OutputArrayOfArrays contours, // 包含points的vectors的vector cv::OutputArray hierarchy, // (可选) 拓扑信息 int mode, // 轮廓检索模式 int method , // 近似方法 cv : :Point offset = cv::Point() // (可选) 所有点的偏移 ); void cv::findContours( cv::InputOutputArray image, // 输入的8位单通道“二值”图像 cv::OutputArrayOfArrays contours, // 包含points的vectors的vector int mode, //