IplImage* img;
//画矩形
cvRectangle(img,cvPoint(100,100),cvPoint(200,200),cvScalar(255,0,0),1);
//画圆
cvCircle(img,cvPoint(100,100),20,cvScalar(0,255,0),1);
//画线段
cvLine(img,cvPoint(100,100),cvPoint(200,200),cvScalar(0,255,0),1);
//画多边形
CvPoint curve1[]= {10,10, 10,100, 100,100, 100,10};
CvPoint curve2[]= {30,30, 30,130, 130,130, 130,30, 150,10};
CvPoint* curvearr[2]={curve1,curve2};
int ncurvepts[2]={4,5};
int ncurves= 2;
int iscurveclosed= 1;
int linewidth=1;
cvPolyLine(img,//图像
curvearr,//折线的顶点指针数组
ncurvepts,//折线的定点个数数组大小,pts指针数组大小
ncurves,//折线的线段数量
iscurveclosed,//是否封闭,如果封闭,开始点和结束点连线
cvScalar(0,255,255),//折线的颜色
linewidth//线条的粗细程度
);//绘制简单线段或折线
//画填充的多边形
cvFillPoly(img,
原文章:
http://blog.csdn.net/lov_zhu/article/details/7681141