-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-opencv1.py
49 lines (35 loc) · 910 Bytes
/
test-opencv1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import cv2 as cv
import numpy as np
W=400
def my_ellipse(img, angle):
thickness = 2
line_type = 8
cv.ellipse(img,
(W // 2, W //2),
(W // 4, W // 16),
angle,
0,
360,
(255, 255, 0),
thickness,
line_type)
def my_filled_circle(img, center):
thickness = -1
line_type = 8
cv.circle(img,
center,
W // 32,
(255,123,230),
thickness,
line_type)
atom_window = "Atom Ellipse"
size = W, W, 3
atom_image = np.zeros(size, dtype=np.uint8)
my_ellipse(atom_image, 90)
my_ellipse(atom_image, 0)
my_ellipse(atom_image, 45)
my_ellipse(atom_image, -45)
my_filled_circle(atom_image, (W // 2, W // 2))
cv.imshow(atom_window, atom_image)
cv.moveWindow(atom_window, 0, 200)
cv.waitKey(0)