Opencv 绘图函数

来源:互联网 发布:模拟电路软件 编辑:程序博客网 时间:2024/05/16 06:44

绘制线段:

void cvLine(CvArr *img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_type=8, int shift=0);

pt1, pt2 指定线段的起点和终点

color 指定线段的颜色

thickness 指定线段的粗细

type 指定线段的类型

shift 坐标值的小数点位数


绘制矩形:

void cvRectangle(CvArr *img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_type=8, int shift=0);

pt1, pt2 指矩形一条对角线上的两个顶点。


绘制圆点:


void cvCircle(CvArr *img, CvPoint center, int radius, CvScalar color, int thickness=1, int line_type=8, int shift=0);


绘制椭圆圆弧和椭圆扇形:

void cvEllipse(CvArr *img, CvPoint center,  CvSize axes, double angle,double start_angle, double end_angle, CvScalar color, int thickness=1, int line_type=8, int shift=0);

axes: 指定椭圆的半轴长度

angle:指定椭圆的偏转角,为正时是逆时针偏转角,为负时是顺时针偏转角

start_angle, end_angle 指定椭圆弧的起始和终止角


填充多边形内部:

void cvFillPoly(CvArr *img, CvPoint **pts, int *npts, int contours, CvScalar color, int thickness=1, int line_type=8, int shift=0);

pts 指向多边形的顶点数组指针

npts 为多边形的顶点个数的数组

contours 组成填充区域的线段的数量


绘制多边形:

void cvPolyLine(CvArr *img, CvPoint **pts, int *npts, int is_closed, CvScalar color, int thickness=1, int line_type=8, int shift=0);

1 0
原创粉丝点击