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

#include
#include 
#include 
#include 
#include
#include 
#include 

#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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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 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> 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;
}

 

你可能感兴趣的:(Opencv,C++,画多边形及圆)