多边形填充与绘制

先创建点集合

使用vector与push_back

在使用polyline(

void cv::polylines ( Mat & img,
const Point *const * pts,
const int * npts,
int ncontours,
bool isClosed,
const Scalar & color,
int thickness = 1,
int lineType = LINE_8,
int shift = 0
)

参数说明
img 作为画布的矩阵
pts 折线顶点数组
npts 折线顶点个数
ncontours 待绘制折线数
isClosed 是否是闭合折线(多边形)
color 折线的颜色
thickness 折线粗细
lineType 线段类型
shift 缩放比例(0是不缩放,4是1/4)

出现点集合后,大部分可省略(注意,该函数不能填充)

  须使用fillpoly(input,点集,scalar,8,0)

drawcounter(input,点集的集合,索引,scalar,-1,8,0)(绘制多个轮廓)(可绘制,可填充)

 

posted @ 2021-04-04 21:02  KAVEI  阅读(88)  评论(0编辑  收藏  举报