Python 基于OpenCV 在一张图片上叠加点

Python 基于OpenCV 在一张图片上叠加点

1、安装 OpenCV

pip install opencv-python

2、cv2.circle 用法

cv2.circle(img, center, radius, color[, thickness[, lineType[, shift]]])

作用

  • 根据给定的圆心和半径等画圆

参数说明

  • img:输入的图片
  • center:圆心位置,如 (100, 100)
  • radius:圆的半径,如 10
  • color:圆的颜色,如 (0, 0, 255) 红色,BGR
  • thickness:圆形轮廓的粗细(如果为正)。负厚度表示要绘制实心圆。
  • lineType: 圆边界的类型。
  • shift:中心坐标和半径值中的小数位数。

3、代码

#-*-coding:utf-8-*-
import cv2 as cv
from netCDF4 import Dataset

index = [(95, 143), (143, 158), (134, 164), (1348, 327), (1351, 338), (1137, 411), (1019, 459), (1357, 520), (1319, 635), (1366, 655), (1357, 701)]
path = r"D:\work\fire_point\fy\china_standard.png"
image = cv.imread(path)
print(image.shape)
# 循环列表,添加多个点到图片上
for coor in index:
    #print(coor)
    cv.circle(image,coor, 10, (0,0,255), -1) #中心坐标,半径,颜色(BGR),线宽(若为-1,即为填充颜色)

# 保存图片
cv.imwrite(r"D:\work\fire_point\fire_point\out\fy.png", image)

4、结果图
在这里插入图片描述

https://blog.csdn.net/u011520181/article/details/83933325?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

  • 3
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值