所以边缘提取的阈值选定会影响最终轮廓发现结果
API介绍
findContours发现轮廓
drawContours绘制轮廓
轮廓发现(find contour)
Code
在二值图像上发现轮廓使用API...,可选
)
流程
输入图像转为灰度图像cvtColor
使用Canny进行边缘提取,得到二值图像
使用findContours寻找轮廓
使用drawContours绘制轮廓
示例代码
c++
using...;
vector> contours;
vectorhierachy;
//图像边缘检测二值化
Canny(src, canny_output, threshold_value...RGB转为灰度
然后再转为二值图像
在通过发现轮廓得到候选点
凸包API调用
绘制显示。...drawContours(dst, convexs, i, color, 2, LINE_8, empty, 0, Point(0, 0));
}
imshow(output_title, dst);
}
八、轮廓周围绘制矩形框和圆形框