#include<opencv2/opencv.hpp>
int draw_(){
Mat img=Mat::zeros(Size(512,512),CV_8UC3);
//圆形
circle(img,Point(37,37),17,Scalar(255,255,255),-1);//实心圆
circle(img,Point(57,57),13,Scalar(255,255,255),3);//空心圆
//直线
line(img,Point(100,100),Point(200,200),Scalar(255,255,255),2,LINE_4,0)
//椭圆
ellipse(img,Point(300,300),Size(100,50),0,0,135,Scalar(255,255,255),-1);//实心
//矩形
rectangle(img,Point(400,400),Point(470,450),Scalar(255,255,255),-1)
//多边形
Point p12[2][6];
p12[0][0]=Point(72,200);
p12[0][1]=Point(142,204);
p12[0][2]=Point(226,263);
p12[0][3]=Point(172,310);
p12[0][4]=Point(117,319);
p12[0][5]=Point(15,260);
p12[1][0]=Point(72,200);
p12[1][1]=Point(142,204);
p12[1][2]=Point(226,263);
p12[1][3]=Point(172,310);
p12[1][4]=Point(117,319);
p12[1][5]=Point(15,260);
Point p5[5];
p5[0]=Point(350,83);
p5[1]=Point(463,90);
p5[2]=Point(500,171);
p5[3]=Point(421,194);
p5[4]=Point(338,141);
const Point* pts[3]={p12[0],p12[1],p12};
int npts[]={6,6,5};
fillPoly(img,pts,npts,3,Scalar(255,255,255),8);
//文字
putText(img,"learn opencv4",Point(500,500),2,1,Scalar(255,255,255));
imshow("draw",img);
waitKey(0);
return 1;
}