ellipse函数用来在图片中绘制椭圆、扇形,有两个重载函数。
- void cv::ellipse( InputOutputArray img,
- Point center,
- Size axes,
- double angle,
- double startAngle,
- double endAngle,
- const Scalar & color,
- int thickness = 1,
- int lineType = LINE_8,
- int shift = 0
- )
参数详解:
img:绘制的图像;
center:中心点;
axes:长短轴;
angle:起始的角度;
startangle:弧段的起始角度,
endangle:弧段的结束角度;
color:线条颜色,或者填充的颜色;
thickness:线宽,-1时表示填充;
lineType:线型;
shift:坐标偏移;
注:startangle = 0,endangle = 360时,可绘制出整个椭圆
-
- void cv::ellipse( InputOutputArray img,
- const RotatedRect & box,
- const Scalar & color,
- int thickness = 1,
- int lineType = LINE_8
- )
参数详解:
img:绘制的图像;
box:椭圆的形状,RotatedRect,有三个属性:angle center size
color:线条颜色,或者填充的颜色;
thickness:线宽,-1时表示填充;
lineType:线型
ellipse(msk, Point(200,200), Size(200,100), 30, 0, 360, Scalar(255),2);
ellipse(msk, Point(300,200), Size(100,200), 0, 0, 180, Scalar(255),2);
- RotatedRect e1;
- e1.center = Point(300,200);
- e1.size.width = 300;
- e1.size.height = 200;
- e1.angle = 90;
- ellipse(msk, e1, Scalar(255, 0, 0), 1, LINE_AA);