Ai
1 Star 0 Fork 0

杨雪锋/opencv-python-5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
c4-4.py 755 Bytes
一键复制 编辑 原始数据 按行查看 历史
杨雪锋 提交于 2023-04-14 21:47 +08:00 . update ch4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
# 白色背景
img = np.ones((200,200,3), np.uint8)*255
# 绘制一条线宽为5的红色线段
cv2.line(img,(1,1),(198,198),(0,0,255),5)
# 绘制黑色边框
cv2.rectangle(img,(1,1),(198,198),(0,0,0),2)
# 绘制红色圆
cv2.circle(img,(75,75), 40, (0,0,255), -1)
# 绘制蓝色部分椭圆
cv2.ellipse(img,(125,125),(40,20),0,0,180,(255,0,0),-1)
#绘制紫色多边形
pts = np.array([[20,20],[175,20],[175,175],[20,140]], np.int32)
pts = pts.reshape((-1,1,2))
cv2.polylines(img,[pts],True,(255,0,255),2)
cv2.imshow("img",img)
cv2.waitKey(0)
cv2.destroyAllWindows()
# 为了输出图片
import sys
sys.path.append('..\\utils')
import utils
utils.show_img([img],"fig4-1")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/hopeasy/opencv-python-5.git
git@gitee.com:hopeasy/opencv-python-5.git
hopeasy
opencv-python-5
opencv-python-5
master

搜索帮助