画矩形的实现
OpenCvSharp.Rect pRect = new OpenCvSharp.Rect(200,200,300,300); Scalar pColor = new Scalar(255,0,0); Cv2.Rectangle(s2,pRect,pColor,2); Cv2.ImShow("矩形",s2);图像里画椭圆
OpenCvSharp实现
//椭圆 OpenCvSharp.Point pp2 = new OpenCvSharp.Point(s2.Cols / 2, s2.Rows / 2); OpenCvSharp.Size pSize = new OpenCvSharp.Size(s2.Cols / 4, s2.Rows / 8); Scalar pColor = new Scalar(0,0,255); Cv2.Ellipse(s2, pp2, pSize, 90, 0, 360, pColor,1,LineTypes.Link8); //圆形 Cv2.Circle(s2,pp2,100,pColor);OpenCvSharp椭圆和圆形的api
//椭圆 // 摘要: // Draws simple or thick elliptic arc or fills ellipse sector 绘制椭圆 // // 参数: // img: // Image. // // center: // Center of the ellipse. // // axes: // Length of the ellipse axes. // // angle: // Rotation angle. // // startAngle: // Starting angle of the elliptic arc. // // endAngle: // Ending angle of the elliptic arc. // // color: // Ellipse color. // // thickness: // Thickness of the ellipse arc. [By default this is 1] // // lineType: // Type of the ellipse boundary. [By default this is LineType.Link8] // // shift: // Number of fractional bits in the center coordinates and axes' values. [By default // this is 0] public static void Ellipse(InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0); public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8); //Circle // 摘要: // Draws a circle 画圆 // // 参数: // img: // Image where the circle is drawn. // // center: // Center of the circle. // // radius: // Radius of the circle. // // color: // Circle color. // // thickness: // Thickness of the circle outline if positive, otherwise indicates that a filled // circle has to be drawn. [By default this is 1] // // lineType: // Type of the circle boundary. [By default this is LineType.Link8] // // shift: // Number of fractional bits in the center coordinates and radius value. [By default // this is 0] public static void Circle(InputOutputArray img, Point center, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0); public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0);