OpenCV绘图函数(2)绘制圆形函数circle()的使用

news/2025/3/28 8:36:11/
  • 操作系统:ubuntu22.04
  • OpenCV版本:OpenCV4.9
  • IDE:Visual Studio Code
  • 编程语言:C++11

算法描述

绘制一个圆。
cv::circle 函数用于绘制一个给定中心和半径的简单圆或填充圆。

函数原型

void cv::circle	
(InputOutputArray 	img,Point 	center,int 	radius,const Scalar & 	color,int 	thickness = 1,int 	lineType = LINE_8,int 	shift = 0 
)		

参数

  • 参数img 绘制圆的图像。
  • 参数center 圆的中心点。
  • 参数radius 圆的半径。
  • 参数color 圆的颜色。
  • 参数thickness 如果为正数,则代表圆轮廓的厚度;如果是负数(如FILLED),则表示绘制填充的圆。
  • 参数lineType 圆边界的类型。参见LineTypes。
  • 参数shift 中心坐标和半径值中的小数位数。

代码示例

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>int main()
{// Create a blank imagecv::Mat image = cv::Mat::zeros( 512, 512, CV_8UC3 );// Define the center of the circlecv::Point center( 256, 256 );  // Center coordinates// Define the radius of the circleint radius = 100;  // Radius in pixels// Define the color of the circlecv::Scalar color( 0, 255, 0 );  // Green color// Define the thickness of the circleint thickness = 2;  // Positive value for outline// Define the line typeint line_type = cv::LINE_AA;  // Anti-aliased line// Define the shift valueint shift = 0;  // No fractional bits// Draw the circlecv::circle( image, center, radius, color, thickness, line_type, shift );// Display the imagecv::imshow( "Circle Example", image );cv::waitKey( 0 );return 0;
}

运行结果

在这里插入图片描述


http://www.ppmy.cn/news/1518704.html

相关文章

进阶SpringBoot之 Shiro(2)环境搭建

Spring Boot 创建 Web 项目&#xff0c;pom.xml 导入 Thymeleaf 依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency> resources 目录下 templates 包新…

C++基础(1)——入门知识

目录 1.C版本更新 2.C参考⽂档&#xff1a; 3.C书籍推荐 4.C的第⼀个程序 5.命名空间 5.1namespace的价值 5.2namespace的定义 5.3 命名空间使⽤ 6.C输⼊&输出 7.缺省参数 8.函数重载 9.引⽤ 9.1引⽤的概念和定义 9.2引⽤的特性 9.3引⽤的使用 9.4const引⽤…

【目标检测】YOLOV3

YOLOv3: An Incremental Improvement 1、YOLO V3 Structure YOLO V3 网络结构借鉴类似 ResNet&#xff08;残差网络结构&#xff09;和 FPN&#xff08;Feature Pyramid Networks&#xff09;网络结构方式。 残差网络&#xff1a;残差网络通过在网络中引入跳跃连接&#xff08…

智能导诊系统:帮助患者找医院、找科室、找医生,解决“知症不知病”“知病不知科”“挂错号”问题

方案概述 智能导诊是基于医疗大模型、知识图谱、人机交互&#xff0c;帮助患者找医院、找科室、找医生&#xff0c;解决“知症不知病”“知病不知科”“挂错号”问题&#xff0c;根据病情分级导流&#xff0c;助力分级诊疗。支持通过语音、文字、点选、图片等多种方式与患者沟…

根据xml模板导出excel

依赖 <poi.version>5.2.3</poi.version> <dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>${poi.version}</version> </dependency> <dependency><groupId>org…

FFmpeg源码:ffurl_seek2、ffurl_seek、avio_size函数分析

一、ffurl_seek2函数 ffurl_seek2函数定义在FFmpeg源码&#xff08;本文演示用的FFmpeg源码版本为7.0.1&#xff09;的源文件libavformat/avio.c中&#xff1a; int64_t ffurl_seek2(void *urlcontext, int64_t pos, int whence) {URLContext *h urlcontext;int64_t ret;if …

Linux 用户缓冲区

1. 文件描述符的分配规则 我们知道Linux进程默认情况下会有3个缺省打开的文件描述符&#xff0c;分别是标准输入stdin--0&#xff0c; 标准输出stdout--1&#xff0c; 标准错误stderr--2。0,1,2对应的物理设备一般是&#xff1a;键盘&#xff0c;显示器&#xff0c;显示器.接下…

华发股份:销售排名稳居TOP10 谱写高质量发展新篇章

2024年8月30日晚&#xff0c;华发股份&#xff08;600325.SH&#xff09;发布2024年半年度报告。报告显示&#xff0c;公司实现营业总收入248.42亿元&#xff0c;归母净利润12.65亿元。面对复杂多变的宏观环境和行业调整的挑战&#xff0c;华发股份依然能够稳固其经营根基&…