轮廓
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 =