先上代码
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/video.hpp>
using namespace cv;
using namespace std;
#define WINDOW_WIDTH 600//自定义窗口大小的宏
void DrawFilledCircle(Mat img, Point center) {
int thickness = -1;
int lineType = 8;
circle(img,
center,
WINDOW_WIDTH / 8,
Scalar(0, 0, 255),
thickness,
lineType);
}
int main(int argc, char** argv)
{
Mat img = Mat::zeros(WINDOW_WIDTH, WINDOW_WIDTH, CV_8UC3);
DrawFilledCircle(img, Point(WINDOW_WIDTH/2, WINDOW_WIDTH/2));
imshow("name1", img);
waitKey(0);
return 0;
}
效果
函数解析