-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimpro.py
More file actions
111 lines (46 loc) · 1006 Bytes
/
impro.py
File metadata and controls
111 lines (46 loc) · 1006 Bytes
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# coding: utf-8
# In[1]:
# In[2]:
# In[43]:
import numpy as np
import matplotlib.pyplot as plt
import os
# In[4]:
cwd=os.getcwd()
# In[5]:
# In[6]:
image_dir=os.path.join(cwd,'image_series')
# In[7]:
image_dir
# In[14]:
files= [f for f in os.listdir(image_dir) if f.endswith('.jpg')]
# In[15]:
files
# In[16]:
redperimage=[]
# In[17]:
greperimage=[]
# In[18]:
for image in files:
img=plt.imread(os.path.join(image_dir,image))
reds=img[:,:,0]
redperimage.append(np.sum(reds))
greens=img[:,:,1]
greperimage.append(np.sum(greens))
# In[19]:
redperimage=np.array(redperimage,dtype=float)
greperimage=np.array(greperimage,dtype=float)
# In[20]:
ratio=redperimage/greperimage
# In[38]:
plt.subplot(211)
# In[39]:
plt.plot(range(0,len(redperimage)),redperimage,'ro')
plt.plot(range(0,len(greperimage)),greperimage,'go')
# In[40]:
plt.subplot(212)
# In[41]:
plt.plot(range(0,len(ratio)),ratio,'ko')
# In[42]:
plt.show()
# In[ ]: