-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree.py
More file actions
47 lines (39 loc) · 1.04 KB
/
tree.py
File metadata and controls
47 lines (39 loc) · 1.04 KB
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
#%%
from skimage.draw import line
import numpy as np
from numpy.random import randint
import matplotlib.pyplot as plt
img = np.zeros((150,150), dtype=np.uint8)
r = randint(50,60 , size=1)
c = randint(90,100 , size=1)
s = randint(70,80 , size=1)
#%%
tree = line(100, 75, s, c)
tree2 = line(100, 75, s, r)
rr, cc = line(149, 75, 100, 75)
img[rr, cc] = 1
img[tree] = 1
img[tree2] = 1
number = [1,1]
for i in number:
a = randint(5,30 , size=1)
b = randint(5,30 , size=1)
tree3 = line(s, c, s-a*i, c+b*i)
for k in range(2):
d = randint(5,30 , size=1)
e = randint(5,30 , size=1)
tree4 = line(s-a*i, c+b*i, s-a*i-d, c+b*i+e)
img[tree3] = 1
img[tree4] = 1
for i in number:
a = randint(5,30 , size=1)
b = randint(5,30 , size=1)
tree3 = line(s, r, s-a*i, r-b*i)
for k in range(2):
d = randint(5,30 , size=1)
e = randint(5,30 , size=1)
tree4 = line(s-a*i, r-b*i, s-a*i-d, r-b*i-e)
img[tree3] = 1
img[tree4] = 1
plt.imshow(img)
plt.show()