赞
踩
1)coInvert.polyline_drawing(src);
2)void ColorInvert::polyline_drawing(Mat& image)
{
Mat canvas = Mat::zeros(Size(512, 512), CV_8UC3);
Point p1(100, 100);
Point p2(150, 100);
Point p3(200, 150);
Point p4(220, 200);
Point p5(80, 230);
std::vector<Point>pts;
pts.push_back(p1);
pts.push_back(p2);
pts.push_back(p3);
pts.push_back(p4);
pts.push_back(p5);
//fillPoly(canvas, pts,Scalar(255, 255, 255),6,0);
//polylines(canvas, pts, true, Scalar(0, 0, 255), 1, 8); //该函数不能进行填充
std::vector<std::vector<Point>>contours;
contours.push_back(pts);
//drawContours(canvas, contours, -1, Scalar(255, 0, 0), 2);
drawContours(canvas, contours, -1, Scalar(255, 0, 0), -1); //最后一个参数小于0 进行填充
imshow("多边形绘制", canvas);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。