- 操作系统:ubuntu22.04
- OpenCV版本:OpenCV4.9
- IDE:Visual Studio Code
- 编程语言:C++11
功能描述
绘制多条多边形曲线
原型1
void cv::polylines	(	
InputOutputArray 	img,
InputArrayOfArrays 	pts,
bool 	isClosed,
const Scalar & 	color,
int 	thickness = 1,
int 	lineType = LINE_8,
int 	shift = 0 
)		
参数
- 参数 img 图像.
- 参数 pts 多边形曲线数组
- 参数isClosed 标志是否绘制的多段线是封闭的。如果设置为封闭,函数会为每个曲线从最后一个顶点绘制一条线回到第一个顶点,从而形成封闭的多边形。
- 参数color 多段线的颜色
- 参数thickness 多段线边缘的厚度.
 -参数lineType 线段的类型. 见 LineTypes
- 参数 shift 顶点坐标中的小数位数。
原型2
void cv::polylines	(	
InputOutputArray 	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 一个整数数组,对应于pts中的每个多段线,指明每个多段线包含的顶点数量
- 参数 ncontours 表示要绘制的多段线(或轮廓)的数量
- 参数isClosed 标志是否绘制的多段线是封闭的。如果设置为封闭,函数会为每个曲线从最后一个顶点绘制一条线回到第一个顶点,从而形成封闭的多边形。
- 参数color 多段线的颜色
- 参数thickness 多段线边缘的厚度.
 -参数lineType 线段的类型. 见 LineTypes
- 参数 shift 顶点坐标中的小数位数。
代码示例
参考FastLineDetector(FLD)快速直线检测器的使用方法中的代码示例,其中用到polylines函数










