网络编程
位置:首页>> 网络编程>> Python编程>> 使用OpenCV circle函数图像上画圆的示例代码

使用OpenCV circle函数图像上画圆的示例代码

作者:csdn_1HAO  发布时间:2021-03-12 17:30:41 

标签:OpenCV,circle,画圆

OpenCV中circle与rectangle函数显示,只不过rectangle在图像中画矩形,circle在图像中画圆。


void circle(Mat img, Point center, int radius, Scalar color, int thickness=1, int lineType=8, int shift=0)

img为源图像

center为画圆的圆心坐标

radius为圆的半径

color为设定圆的颜色,规则根据B(蓝)G(绿)R(红)

thickness 如果是正数,表示组成圆的线条的粗细程度。否则,表示圆是否被填充

line_type 线条的类型。默认是8

shift 圆心坐标点和半径值的小数点位数

示例程序:


#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
 Mat src = imread("C:\\tupian\\test1.jpg", 3);
 circle(src, Point(src.cols/ 2, src.rows / 2), 30, Scalar(0, 0, 255));
 imshow("src", src);
 waitKey(0);
 return 0;
}

总结

以上所述是小编给大家介绍的使用OpenCV circle函数图像上画圆的示例代码网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!

来源:https://blog.csdn.net/caomin1hao/article/details/81876836

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com