opencv(c++/opencv):基本图形绘制(线line、椭圆ellipse,矩阵rectangle,圆circle,多边形fillpoly)

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);
}


猜你喜欢

转载自blog.csdn.net/weixin_42755384/article/details/88191214