Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1576510

Browse files
committed
circle
1 parent bc68713 commit 1576510

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎ch06-绘图函数/画圆圈.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# @Time : 2017年7月17日 下午12:03
3+
# @Author : play4fun
4+
# @File : 画圆圈.py
5+
# @Software: PyCharm
6+
7+
"""
8+
画圆圈.py:随机覆盖,不同颜色,
9+
"""
10+
11+
import cv2
12+
import numpy as np
13+
14+
canvas = np.zeros((300, 300, 3), dtype="uint8")
15+
16+
for i in range(0, 25):
17+
radius = np.random.randint(5, high=200)
18+
color = np.random.randint(0, high=256, size=(3,)).tolist()
19+
pt = np.random.randint(0, high=300, size=(2,))
20+
cv2.circle(canvas, tuple(pt), radius, color, -1)
21+
22+
cv2.imshow("Canvas", canvas)
23+
cv2.waitKey(0)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /