OpenCV | 绘制多边形

#include 
#include 

IplImage *Image1;

CvPoint PointArray1[6];
CvScalar Color;
int PolyVertexNumber;
int Shift;
int main()
{
     CvSize ImageSize1 = cvSize(1000,700);
     Image1 = cvCreateImage(ImageSize1, IPL_DEPTH_8U, 3);

     PointArray1[0]=cvPoint(200,200);
     PointArray1[1]=cvPoint(400,150);
     PointArray1[2]=cvPoint(650,230);
     PointArray1[3]=cvPoint(800,300);
     PointArray1[4]=cvPoint(900,550);
     PointArray1[5]=cvPoint(100,500);

     CvScalar Color=CV_RGB(255,0,0);
     PolyVertexNumber=6;
     Shift=0;

     cvFillConvexPoly(Image1,PointArray1,PolyVertexNumber,Color,CV_AA,Shift);

     cvNamedWindow("FillConvexPoly",0);
     cvShowImage("FillConvexPoly",Image1);
     cvWaitKey(0);
     cvSaveImage("poly.jpg",Image1);
     cvReleaseImage(&Image1);
     return 0;
}

你可能感兴趣的:(opencv)