Opencv 实战学习总结 三
void testpainttestsharp()
{
Mat image = imread("3.jpg");
Point p1 = Point(20, 30);
Point p2;
p2.x = 200;
p2.y = 300;
Scalar color = Scalar(0,0,255);
line(image,p1,p2,color,10,LINE_8);
Scalar color1 = Scalar(255, 0, 255);
Rect rect = Rect(400,100,100,200);
rectangle(image,rect, color1,2,LINE_AA);
ellipse(image,p2,Size(100,200),90,0,360,color1,2,LINE_8);
circle(image,p2,100, color1,10, LINE_8);
Point pts[1][5];
pts[0][0] = Point(100,100);
pts[0][1] = Point(100, 200);
pts[0][2] = Point(200, 200);
pts[0][3] = Point(200, 100);
pts[0][4] = Point(100, 100);
Scalar color2 = Scalar(255, 0, 0);
const Point* ppts[] = { pts[0] };
int npt[] = { 5 };
fillPoly(image, ppts, npt,1, color2, 8);
Scalar color3 = Scalar(10, 255, 200);
putText(image,"hello opencv",Point(0,400), FONT_HERSHEY_COMPLEX,2.0,color3,1,8);
namedWindow("image", WINDOW_AUTOSIZE);
imshow("image", image);
waitKey(0);
}