利用Opencv实现画实习圆及正六边形

#include<opencv2/opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include<vector>
#include <iostream>
#include <cmath>

#define R 5
#define Length 15
#define Higth 50


using namespace std;
using namespace cv;

int main()
{
	Mat src(640, 480, CV_8UC3);
	src.setTo(0);

	//第一行,红色行
	vector<Point > contour;
	contour.reserve(6);
	contour.push_back(Point(Length, Higth));
	contour.push_back(Point(Length / 2, (Higth + Length / 2 * sqrt(3))));
	contour.push_back(Point(Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour.push_back(Point(2 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour.push_back(Point(5 * Length / 2, (Higth + (Length / 2 * sqrt(3)))));
	contour.push_back(Point(2 * Length, Higth));

	vector<std::vector<cv::Point >> contours;
	contours.push_back(contour);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(Length + Length / 2, (Higth + (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour1;
	contour1.reserve(6);
	contour1.push_back(Point(Length + 3 * Length, Higth));
	contour1.push_back(Point(Length / 2 + 3 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour1.push_back(Point(Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour1.push_back(Point(2 * Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour1.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour1.push_back(Point(2 * Length + 3 * Length, Higth));

	vector<std::vector<cv::Point >> contours1;
	contours1.push_back(contour1);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours1, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours1, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(5 * Length / 2 + 2 * Length, (Higth + (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour2;
	contour2.reserve(6);
	contour2.push_back(Point(Length + 6 * Length, Higth));
	contour2.push_back(Point(Length / 2 + 6 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour2.push_back(Point(Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour2.push_back(Point(2 * Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour2.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour2.push_back(Point(2 * Length + 6 * Length, Higth));

	vector<std::vector<cv::Point >> contours2;
	contours2.push_back(contour2);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours2, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours2, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(5 * Length / 2 + 5 * Length, (Higth + (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour3;
	contour3.reserve(6);
	contour3.push_back(Point(Length + 9 * Length, Higth));
	contour3.push_back(Point(Length / 2 + 9 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour3.push_back(Point(Length + 9 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour3.push_back(Point(2 * Length + 9 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour3.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour3.push_back(Point(2 * Length + 9 * Length, Higth));

	vector<std::vector<cv::Point >> contours3;
	contours3.push_back(contour3);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours3, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours3, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(5 * Length / 2 + 8 * Length, (Higth + (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);


	//第二行,绿色行
	vector<Point > contour01;
	contour01.reserve(6);
	contour01.push_back(Point(5 * Length / 2, (Higth + (Length / 2 * sqrt(3)))));
	contour01.push_back(Point(2 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour01.push_back(Point(5 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour01.push_back(Point(7 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour01.push_back(Point(4 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour01.push_back(Point(7 * Length / 2, (Higth + (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours01;
	contours01.push_back(contour01);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours01, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours01, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour02;
	contour02.reserve(6);
	contour02.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour02.push_back(Point(2 * Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour02.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour02.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour02.push_back(Point(4 * Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour02.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours02;
	contours02.push_back(contour02);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours02, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours02, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour03;
	contour03.reserve(6);
	contour03.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + (Length / 2 * sqrt(3)))));
	contour03.push_back(Point(2 * Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour03.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour03.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour03.push_back(Point(4 * Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour03.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours03;
	contours03.push_back(contour03);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours03, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours03, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第三行,蓝色行
	vector<Point > contour001;
	contour001.reserve(6);
	contour001.push_back(Point(Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour001.push_back(Point(Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour001.push_back(Point(Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour001.push_back(Point(2 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour001.push_back(Point(5 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour001.push_back(Point(2 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours001;
	contours001.push_back(contour001);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours001, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours001, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour002;
	contour002.reserve(6);
	contour002.push_back(Point(Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour002.push_back(Point(Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour002.push_back(Point(Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour002.push_back(Point(2 * Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour002.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour002.push_back(Point(2 * Length + 3 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours002;
	contours002.push_back(contour002);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours002, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours002, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour003;
	contour003.reserve(6);
	contour003.push_back(Point(Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour003.push_back(Point(Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour003.push_back(Point(Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour003.push_back(Point(2 * Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour003.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour003.push_back(Point(2 * Length + 6 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours003;
	contours003.push_back(contour003);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours003, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours003, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour004;
	contour004.reserve(6);
	contour004.push_back(Point(Length + 9 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));
	contour004.push_back(Point(Length / 2 + 9 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour004.push_back(Point(Length + 9 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour004.push_back(Point(2 * Length + 9 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour004.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour004.push_back(Point(2 * Length + 9 * Length, (Higth + 2 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours004;
	contours004.push_back(contour004);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours004, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours004, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 9 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第四行,红色行
	vector<Point > contour5;
	contour5.reserve(6);
	contour5.push_back(Point(5 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour5.push_back(Point(2 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour5.push_back(Point(5 * Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour5.push_back(Point(7 * Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour5.push_back(Point(4 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour5.push_back(Point(7 * Length / 2, (Higth + 3 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours5;
	contours5.push_back(contour5);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours5, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours5, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour6;
	contour6.reserve(6);
	contour6.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour6.push_back(Point(2 * Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour6.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour6.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour6.push_back(Point(4 * Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour6.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours6;
	contours6.push_back(contour6);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours6, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours6, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour7;
	contour7.reserve(6);
	contour7.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));
	contour7.push_back(Point(2 * Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour7.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour7.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour7.push_back(Point(4 * Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour7.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 3 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours7;
	contours7.push_back(contour7);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours7, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours7, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第五行,绿色行
	vector<Point > contour04;
	contour04.reserve(6);
	contour04.push_back(Point(Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour04.push_back(Point(Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour04.push_back(Point(Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour04.push_back(Point(2 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour04.push_back(Point(5 * Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour04.push_back(Point(2 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours04;
	contours04.push_back(contour04);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours04, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours04, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 , (Higth + 5 *(Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour05;
	contour05.reserve(6);
	contour05.push_back(Point(Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour05.push_back(Point(Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour05.push_back(Point(Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour05.push_back(Point(2 * Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour05.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour05.push_back(Point(2 * Length + 3 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours05;
	contours05.push_back(contour05);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours05, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours05, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour06;
	contour06.reserve(6);
	contour06.push_back(Point(Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour06.push_back(Point(Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour06.push_back(Point(Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour06.push_back(Point(2 * Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour06.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour06.push_back(Point(2 * Length + 6 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours06;
	contours06.push_back(contour06);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours06, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours06, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour07;
	contour07.reserve(6);
	contour07.push_back(Point(Length + 9 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));
	contour07.push_back(Point(Length / 2 + 9 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour07.push_back(Point(Length + 9 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour07.push_back(Point(2 * Length + 9 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour07.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour07.push_back(Point(2 * Length + 9 * Length, (Higth + 4 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours07;
	contours07.push_back(contour07);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours07, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours07, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 9 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第六行,蓝色行
	vector<Point > contour005;
	contour005.reserve(6);
	contour005.push_back(Point(5 * Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour005.push_back(Point(2 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour005.push_back(Point(5 * Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour005.push_back(Point(7 * Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour005.push_back(Point(4 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour005.push_back(Point(7 * Length / 2, (Higth + 5 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours005;
	contours005.push_back(contour005);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours005, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours005, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour006;
	contour006.reserve(6);
	contour006.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour006.push_back(Point(2 * Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour006.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour006.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour006.push_back(Point(4 * Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour006.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours006;
	contours006.push_back(contour006);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours006, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours006, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length+3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour007;
	contour007.reserve(6);
	contour007.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));
	contour007.push_back(Point(2 * Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour007.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour007.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour007.push_back(Point(4 * Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour007.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 5 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours007;
	contours007.push_back(contour007);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours007, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours007, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第七行,红色行
	vector<Point > contour8;
	contour8.reserve(6);
	contour8.push_back(Point(Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour8.push_back(Point(Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour8.push_back(Point(Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour8.push_back(Point(2 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour8.push_back(Point(5 * Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour8.push_back(Point(2 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours8;
	contours8.push_back(contour8);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours8, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours8, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length /2, (Higth + 7 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);
	
	vector<Point > contour9;
	contour9.reserve(6);
	contour9.push_back(Point(Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour9.push_back(Point(Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour9.push_back(Point(Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour9.push_back(Point(2 * Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour9.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour9.push_back(Point(2 * Length + 3 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours9;
	contours9.push_back(contour9);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours9, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours9, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour10;
	contour10.reserve(6);
	contour10.push_back(Point(Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour10.push_back(Point(Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour10.push_back(Point(Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour10.push_back(Point(2 * Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour10.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour10.push_back(Point(2 * Length + 6 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours10;
	contours10.push_back(contour10);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours10, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours10, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour11;
	contour11.reserve(6);
	contour11.push_back(Point(Length + 9 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));
	contour11.push_back(Point(Length / 2 + 9 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour11.push_back(Point(Length + 9 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour11.push_back(Point(2 * Length + 9 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour11.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour11.push_back(Point(2 * Length + 9 * Length, (Higth + 6 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours11;
	contours11.push_back(contour11);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours11, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours11, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 9 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第八行,绿色行
	vector<Point > contour08;
	contour08.reserve(6);
	contour08.push_back(Point(5 * Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour08.push_back(Point(2 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour08.push_back(Point(5 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour08.push_back(Point(7 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour08.push_back(Point(4 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour08.push_back(Point(7 * Length / 2, (Higth + 7 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours08;
	contours08.push_back(contour08);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours08, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours08, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length , (Higth + 8 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour09;
	contour09.reserve(6);
	contour09.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour09.push_back(Point(2 * Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour09.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour09.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour09.push_back(Point(4 * Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour09.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours09;
	contours09.push_back(contour09);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours09, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours09, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour010;
	contour010.reserve(6);
	contour010.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));
	contour010.push_back(Point(2 * Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour010.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour010.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour010.push_back(Point(4 * Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour010.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 7 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours010;
	contours010.push_back(contour010);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours010, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours010, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第九行,蓝色行
	vector<Point > contour008;
	contour008.reserve(6);
	contour008.push_back(Point(Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour008.push_back(Point(Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour008.push_back(Point(Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour008.push_back(Point(2 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour008.push_back(Point(5 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour008.push_back(Point(2 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours008;
	contours008.push_back(contour008);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours008, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours008, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour009;
	contour009.reserve(6);
	contour009.push_back(Point(Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour009.push_back(Point(Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour009.push_back(Point(Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour009.push_back(Point(2 * Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour009.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour009.push_back(Point(2 * Length + 3 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours009;
	contours009.push_back(contour009);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours009, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours009, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour0010;
	contour0010.reserve(6);
	contour0010.push_back(Point(Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour0010.push_back(Point(Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour0010.push_back(Point(Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour0010.push_back(Point(2 * Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour0010.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour0010.push_back(Point(2 * Length + 6 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours0010;
	contours0010.push_back(contour0010);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours0010, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours0010, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour0011;
	contour0011.reserve(6);
	contour0011.push_back(Point(Length + 9 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));
	contour0011.push_back(Point(Length / 2 + 9 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour0011.push_back(Point(Length + 9 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour0011.push_back(Point(2 * Length + 9 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour0011.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour0011.push_back(Point(2 * Length + 9 * Length, (Higth + 8 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours0011;
	contours0011.push_back(contour0011);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours0011, true, Scalar(255, 0, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours0011, Scalar(255, 0, 0));//fillPoly函数的第二个参数是二维数组!!


	circle(src, Point(3 * Length / 2 + 9 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第十行,红色行
	vector<Point > contour12;
	contour12.reserve(6);
	contour12.push_back(Point(5 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour12.push_back(Point(2 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour12.push_back(Point(5 * Length / 2, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour12.push_back(Point(7 * Length / 2, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour12.push_back(Point(4 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour12.push_back(Point(7 * Length / 2, (Higth + 9 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours12;
	contours12.push_back(contour12);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours12, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours12, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour13;
	contour13.reserve(6);
	contour13.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour13.push_back(Point(2 * Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour13.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour13.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour13.push_back(Point(4 * Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour13.push_back(Point(7 * Length / 2 + 3 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours13;
	contours13.push_back(contour13);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours13, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours13, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!
	
	circle(src, Point(3 * Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour14;
	contour14.reserve(6);
	contour14.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));
	contour14.push_back(Point(2 * Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour14.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour14.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour14.push_back(Point(4 * Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour14.push_back(Point(7 * Length / 2 + 6 * Length, (Higth + 9 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours14;
	contours14.push_back(contour14);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours14, true, Scalar(0, 0, 255), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours14, Scalar(0, 0, 255));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	//第十一行,绿色行
	vector<Point> contour011;
	contour011.reserve(6);
	contour011.push_back(Point(Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour011.push_back(Point(Length / 2, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour011.push_back(Point(Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour011.push_back(Point(2 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour011.push_back(Point(5 * Length / 2, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour011.push_back(Point(2 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours011;
	contours011.push_back(contour011);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours011, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours011, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2, (Higth + 11 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour012;
	contour012.reserve(6);
	contour012.push_back(Point(Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour012.push_back(Point(Length / 2 + 3 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour012.push_back(Point(Length + 3 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour012.push_back(Point(2 * Length + 3 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour012.push_back(Point(5 * Length / 2 + 3 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour012.push_back(Point(2 * Length + 3 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours012;
	contours012.push_back(contour012);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours012, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours012, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 3 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour013;
	contour013.reserve(6);
	contour013.push_back(Point(Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour013.push_back(Point(Length / 2 + 6 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour013.push_back(Point(Length + 6 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour013.push_back(Point(2 * Length + 6 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour013.push_back(Point(5 * Length / 2 + 6 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour013.push_back(Point(2 * Length + 6 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours013;
	contours013.push_back(contour013);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours013, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours013, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 6 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	vector<Point > contour014;
	contour014.reserve(6);
	contour014.push_back(Point(Length + 9 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));
	contour014.push_back(Point(Length / 2 + 9 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour014.push_back(Point(Length + 9 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour014.push_back(Point(2 * Length + 9 * Length, (Higth + 12 * (Length / 2 * sqrt(3)))));
	contour014.push_back(Point(5 * Length / 2 + 9 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))));
	contour014.push_back(Point(2 * Length + 9 * Length, (Higth + 10 * (Length / 2 * sqrt(3)))));

	vector<std::vector<cv::Point >> contours014;
	contours014.push_back(contour014);
	//填充区域之前,首先采用polylines()函数,可以使填充的区域边缘更光滑
	cv::polylines(src, contours014, true, Scalar(0, 255, 0), 0, 4);//第2个参数可以采用contour或者contours,均可
	cv::fillPoly(src, contours014, Scalar(0, 255, 0));//fillPoly函数的第二个参数是二维数组!!

	circle(src, Point(3 * Length / 2 + 9 * Length, (Higth + 11 * (Length / 2 * sqrt(3)))), R, Scalar(255, 255, 255), -10, 4, 0);

	cv::imshow("原图", src);
	cv::waitKey(0);

	return 0;
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值