【OpenCV】轮廓与凸包

这篇博客深入探讨了OpenCV库在处理图像轮廓和凸包方面的应用。作者首先介绍了如何绘制轮廓的包围框和圆,接着讲解了如何绘制轮廓的旋转框和椭圆,提供了详细的代码示例,并展示了相应的运行结果。此外,还涵盖了凸包的概念,并给出了相关的代码实现及其运行效果。
摘要由CSDN通过智能技术生成

轮廓

void cv::findContours   (   InputOutputArray image, OutputArrayOfArrays contours,
                            OutputArray hierarchy , int mode,
                            int method            , Point   offset = Point() 

说明:
    hierarchy:层级关系(详见:https://docs.opencv.org/3.1.0/d9/d8b/tutorial_py_contours_hierarchy.html)
    mode:RETR_EXTERNAL、RETR_LIST、RETR_CCOMP、RETR_TREE、RETR_FLOODFILL 
)   

  本节只绘制轮廓形状。

  绘制轮廓的包围框和圆参考:https://docs.opencv.org/master/da/d0c/tutorial_bounding_rects_circles.html

  绘制轮廓的旋转框和椭圆参考:https://docs.opencv.org/master/de/d62/tutorial_bounding_rotated_ellipses.html


代码示例

#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>

using namespace cv;
using namespace std;

Mat src, src_gray;
int thresh = 100, max_thresh = 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值