opencv(c++/opencv):基本图形绘制(线line、椭圆ellipse,矩阵rectangle,圆circle,多边形fillpoly)
程序员文章站
2022-03-31 14:52:14
...
c++版本
效果图:
#include <iostream>
#include <opencv/cv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
//定义画椭圆的函数
void DrawEcllipse(Mat img,double angle)
{
int thickness=2;
int LineType=8;
ellipse(img,
Point(400,400),
Size(200,50),
angle,
0,
360,
Scalar(255,129,0),
thickness,
LineType
);
}
//主函数
int main(void)
{
//创建空白Mat图像
Mat atomImage=Mat::zeros(800,800,CV_8UC3);
DrawEcllipse(atomImage,90);
imshow("test",atomImage);
waitKey(0);
return(0);
}
上一篇: WinAPI: Arc - 绘制弧线
下一篇: C语言编程之用ellipse画椭圆