├── a.jpg
├── b.jpg
├── d.jpg
├── g.jpg
├── s.jpg
├── t.jpg
├── ab.jpg
├── gs.jpg
├── Anti-A.jpg
├── Anti-B.jpg
├── Anti-D.jpg
├── Blood.ico
├── ferraz.pdf
├── gggggg.jpg
├── Control.jpg
├── README.md
├── Output images
├── p1Anti A.png
├── p1Anti B.png
├── p1Anti D.png
├── p1Control.png
├── p2Anti A.png
├── p2Anti B.png
├── p2Anti D.png
├── p2Control.png
├── p3Anti A.png
├── p3Anti B.png
├── p3Anti D.png
├── p3Control.png
├── p4Anti A.png
├── p4Anti B.png
├── p4Anti D.png
├── p4Control.png
├── p5Anti A.png
├── p5Anti B.png
├── p5Anti D.png
└── p5Control.png
├── Blood group determination using python.docx
├── Blood Group detection using Image processing techniques .pdf
├── .idea
├── misc.xml
├── vcs.xml
├── modules.xml
├── Blood-group-Detection-using-python.iml
└── workspace.xml
├── demo.py
└── GUI.py
/a.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/a.jpg
--------------------------------------------------------------------------------
/b.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/b.jpg
--------------------------------------------------------------------------------
/d.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/d.jpg
--------------------------------------------------------------------------------
/g.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/g.jpg
--------------------------------------------------------------------------------
/s.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/s.jpg
--------------------------------------------------------------------------------
/t.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/t.jpg
--------------------------------------------------------------------------------
/ab.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/ab.jpg
--------------------------------------------------------------------------------
/gs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/gs.jpg
--------------------------------------------------------------------------------
/Anti-A.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Anti-A.jpg
--------------------------------------------------------------------------------
/Anti-B.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Anti-B.jpg
--------------------------------------------------------------------------------
/Anti-D.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Anti-D.jpg
--------------------------------------------------------------------------------
/Blood.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Blood.ico
--------------------------------------------------------------------------------
/ferraz.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/ferraz.pdf
--------------------------------------------------------------------------------
/gggggg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/gggggg.jpg
--------------------------------------------------------------------------------
/Control.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Control.jpg
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Blood-group-Detection-using-python
2 | Project for detecting blood group using image processing in python
3 |
--------------------------------------------------------------------------------
/Output images/p1Anti A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p1Anti A.png
--------------------------------------------------------------------------------
/Output images/p1Anti B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p1Anti B.png
--------------------------------------------------------------------------------
/Output images/p1Anti D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p1Anti D.png
--------------------------------------------------------------------------------
/Output images/p1Control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p1Control.png
--------------------------------------------------------------------------------
/Output images/p2Anti A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p2Anti A.png
--------------------------------------------------------------------------------
/Output images/p2Anti B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p2Anti B.png
--------------------------------------------------------------------------------
/Output images/p2Anti D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p2Anti D.png
--------------------------------------------------------------------------------
/Output images/p2Control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p2Control.png
--------------------------------------------------------------------------------
/Output images/p3Anti A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p3Anti A.png
--------------------------------------------------------------------------------
/Output images/p3Anti B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p3Anti B.png
--------------------------------------------------------------------------------
/Output images/p3Anti D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p3Anti D.png
--------------------------------------------------------------------------------
/Output images/p3Control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p3Control.png
--------------------------------------------------------------------------------
/Output images/p4Anti A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p4Anti A.png
--------------------------------------------------------------------------------
/Output images/p4Anti B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p4Anti B.png
--------------------------------------------------------------------------------
/Output images/p4Anti D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p4Anti D.png
--------------------------------------------------------------------------------
/Output images/p4Control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p4Control.png
--------------------------------------------------------------------------------
/Output images/p5Anti A.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p5Anti A.png
--------------------------------------------------------------------------------
/Output images/p5Anti B.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p5Anti B.png
--------------------------------------------------------------------------------
/Output images/p5Anti D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p5Anti D.png
--------------------------------------------------------------------------------
/Output images/p5Control.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Output images/p5Control.png
--------------------------------------------------------------------------------
/Blood group determination using python.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Blood group determination using python.docx
--------------------------------------------------------------------------------
/Blood Group detection using Image processing techniques .pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/anirudhjaishankar/Blood-group-Detection-using-python/HEAD/Blood Group detection using Image processing techniques .pdf
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/demo.py:
--------------------------------------------------------------------------------
1 | import skimage
2 | import skimage.io as ski
3 | import skimage.filters as skif
4 | import skimage.transform as skit
5 | import matplotlib.pyplot as plt
6 | import matplotlib.cm as cm
7 | import cv2
8 | import numpy as np
9 |
10 |
11 | ## INPUT IMAGE
12 | img1 = ski.imread("E:\Blood group\s.jpg")
13 |
14 |
15 | ##Color Plane Extraction: RGB Green Plane
16 | _,img2,_ = cv2.split(img1)
17 |
18 |
19 | ##Auto Threshold: Clustering
20 | t = skif.threshold_otsu(img2, nbins=256)
21 | print(t)
22 | #plt.imshow(g,cmap="gray")
--------------------------------------------------------------------------------
/.idea/Blood-group-Detection-using-python.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 | start
33 |
34 |
35 |
36 |
37 |
38 |
39 |
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 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | 1538638123673
117 |
118 |
119 | 1538638123673
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
--------------------------------------------------------------------------------
/GUI.py:
--------------------------------------------------------------------------------
1 | from tkinter import *
2 | from tkinter import messagebox, filedialog
3 | from PIL import Image, ImageTk
4 | import cv2
5 | import numpy as np
6 | from matplotlib import pyplot as plt
7 |
8 | blood=[False,False,False,False]
9 | q = 1
10 | f = 0
11 | v = 0
12 | p1 = ''
13 | p2 = ''
14 | p3 = ''
15 | p4 = ''
16 |
17 |
18 | class Login(Frame):
19 | def __init__(self, master=None):
20 | Frame.__init__(self, master)
21 | self.master = master
22 | self.init_window()
23 |
24 | def init_window(self):
25 |
26 | # Code Segment for Icon and title
27 |
28 | self.configure(background='powder blue')
29 | self.pack(fill=BOTH, expand=1)
30 | self.master.title("Blood Group Detection System")
31 | self.master.iconbitmap('D:\Blood-group-Detection-using-python\Blood.ico')
32 |
33 | # Code segment for dropdown menu
34 |
35 | menu = Menu(self.master)
36 | self.master.config(menu=menu)
37 |
38 | file = Menu(menu)
39 | stage = Menu(menu)
40 | file.add_cascade(label="Process", menu=stage)
41 | file.add_command(label="Restart",command=self.restart)
42 | file.add_command(label="Exit",command=self.quit)
43 | menu.add_cascade(label="File", menu=file)
44 |
45 | stage.add_command(label="Process 1: Green Plane Extraction", command=self.gp)
46 | stage.add_command(label="Process 2: Auto Threshold", command=self.autothresh)
47 | stage.add_command(label="Process 3: Adaptive Threshold:Ni Black", command=self.Adapthresh)
48 | stage.add_command(label="Process 4: Morphology: Fill Holes", command=self.Fill_holes)
49 | stage.add_command(label="Process 5: Advanced Morphology: Remove small objects", command=self.Remove_small_objects)
50 | stage.add_command(label="Process 6: Histogram", command=self.Histogram)
51 | stage.add_command(label="Process 7: Quantification", command=self.HSV_Luminance)
52 |
53 | # Code segment for labels
54 | l1 = Label(self, text="Reagent Anti-A", font=("Helvetica", 12))
55 | l2 = Label(self, text="Reagent Anti-B", font=("Helvetica", 12))
56 | l3 = Label(self, text="Reagent Anti-D", font=("Helvetica", 12))
57 | l4 = Label(self, text="Control Reagent", font=("Helvetica", 12))
58 | l1.place(x=160, y=475)
59 | l2.place(x=480, y=475)
60 | l3.place(x=780, y=475)
61 | l4.place(x=1070, y=475)
62 |
63 | # Code segment for buttons
64 | e1 = Button(self, text="Choose Image", command=self.imagesel1)
65 | e2 = Button(self, text="Choose Image", command=self.imagesel2)
66 | e3 = Button(self, text="Choose Image", command=self.imagesel3)
67 | e4 = Button(self, text="Choose Image", command=self.imagesel4)
68 | self.ep = Button(self, text="Process", font=("Helvetica", 12), fg='red', relief=SUNKEN)
69 | self.ep.place(x=650, y=575)
70 | e1.place(x=170, y=500)
71 | e2.place(x=490, y=500)
72 | e3.place(x=790, y=500)
73 | e4.place(x=1080, y=500)
74 |
75 | def quit(self):
76 | global q
77 | q = 0
78 | root.destroy()
79 |
80 |
81 | def restart(self):
82 | global q
83 | q = 1
84 | root.destroy()
85 |
86 | def message(self,q):
87 | messagebox.showinfo("Result",q+"Confirmed")
88 |
89 | def start1(self):
90 | self.start(p1,"Anti A")
91 | self.start2()
92 |
93 |
94 | def imagesel1(self):
95 | global v
96 | v += 1
97 | s = filedialog.askopenfilename()
98 | x = ""
99 | i = len(s)-1
100 | while s[i] != '/':
101 | x += s[i]
102 | i -= 1
103 | global p1
104 | p1 = x[::-1]
105 | self.p = Image.open(x[::-1])
106 | r = self.p.resize((300,425),Image.ANTIALIAS)
107 | i = ImageTk.PhotoImage(r)
108 | l = Label(self, image=i)
109 | l.Image = i
110 | l.place(x=75, y=50)
111 | if v == 4:
112 | self.ep.configure(relief=RAISED, fg='green', command=self.start1)
113 |
114 | def start2(self):
115 | self.start(p2, "Anti B")
116 | self.start3()
117 |
118 |
119 |
120 | def imagesel2(self):
121 | global v, p2
122 | v += 1
123 | s = filedialog.askopenfilename()
124 | x = ""
125 | i = len(s)-1
126 | while s[i] != '/':
127 | x += s[i]
128 | i -= 1
129 | p2 = x[::-1]
130 | self.p = Image.open(x[::-1])
131 | r = self.p.resize((300, 425), Image.ANTIALIAS)
132 | i = ImageTk.PhotoImage(r)
133 | l = Label(self, image=i)
134 | l.Image = i
135 | l.place(x=375, y=50)
136 | if v == 4:
137 | self.ep.configure(relief=RAISED, fg='green', command=self.start1)
138 |
139 | def start3(self):
140 | self.start(p3, "Anti D")
141 | self.start4()
142 |
143 |
144 | def imagesel3(self):
145 | global v, p3
146 | v += 1
147 | s = filedialog.askopenfilename()
148 | x = ""
149 | i = len(s)-1
150 | while s[i] != '/':
151 | x += s[i]
152 | i -= 1
153 | p3 = x[::-1]
154 | self.p = Image.open(x[::-1])
155 | r = self.p.resize((300,425),Image.ANTIALIAS)
156 | i = ImageTk.PhotoImage(r)
157 | l = Label(self, image=i)
158 | l.Image = i
159 | l.place(x=675, y=50)
160 | if v == 4:
161 | self.ep.configure(relief=RAISED, fg='green', command=self.start1)
162 |
163 | def start4(self):
164 | self.start(p4, "Control")
165 | self.check()
166 |
167 | def imagesel4(self):
168 | global v, p4
169 | v += 1
170 | s = filedialog.askopenfilename()
171 | x = ""
172 | i = len(s)-1
173 | while s[i] != '/':
174 | x += s[i]
175 | i -= 1
176 | p4 = x[::-1]
177 | self.p = Image.open(x[::-1])
178 | r = self.p.resize((300, 425), Image.ANTIALIAS)
179 | i = ImageTk.PhotoImage(r)
180 | l = Label(self, image=i)
181 | l.Image = i
182 | l.place(x=975, y=50)
183 | if v == 4:
184 | self.ep.configure(relief=RAISED, fg='green', command=self.start1)
185 |
186 | def process1(self, p,r): # Extracting the Green plane
187 | img = cv2.imread(p)
188 | gi = img[:, :, 1]
189 | cv2.imwrite("p1"+r+".png", gi)
190 | return gi
191 |
192 | def process2(self, p,r): # Obtaining the threshold
193 | gi = self.process1(p,r)
194 | _, th = cv2.threshold(gi, 0, 255, cv2.THRESH_OTSU)
195 | cv2.imwrite("p2"+r+".png", th)
196 |
197 | def process3(self, p,r): # Obtaining Ni black image
198 | img = cv2.imread('p2'+r+'.png', 0)
199 | th4 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11, 14)
200 | cv2.imwrite("p3"+r+".png", th4)
201 |
202 | def process4(self,r): # Morphology: fill holes
203 | gi = cv2.imread('p3'+r+'.png', cv2.IMREAD_GRAYSCALE)
204 | th, gi_th = cv2.threshold(gi, 220, 255, cv2.THRESH_BINARY_INV)
205 | gi_floodFill=gi_th.copy()
206 | h, w = gi_th.shape[:2]
207 | mask = np.zeros((h+2, w+2), np.uint8)
208 | cv2.floodFill(gi_floodFill, mask, (0, 0), 255)
209 | gi_floodFill_inv = cv2.bitwise_not(gi_floodFill)
210 | gi_out = gi_th | gi_floodFill_inv
211 | cv2.imwrite('p4'+r+'.png', gi_out)
212 |
213 | def process5(self,r): # Morphing To eliminate small objects
214 | img = cv2.imread('p4'+r+'.png')
215 | kernel = np.ones((5, 5), np.uint8)
216 | open = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
217 | close = cv2.morphologyEx(open, cv2.MORPH_CLOSE, kernel)
218 | cv2.imwrite('p5'+r+'.png', close)
219 |
220 | def process7(self,r): #Histogram
221 | img = cv2.imread('p5'+r+'.png', 0)
222 | img2 = cv2.imread('p1'+r+'.png', 0)
223 | mask = np.ones(img.shape[:2], np.uint8)
224 | hist = cv2.calcHist([img2], [0], mask, [256], [0, 256])
225 | min = 1000
226 | max = 0
227 | n = 0
228 | s = 0
229 | ss = 0
230 | for x, y in enumerate(hist):
231 | if y > max:
232 | max = y
233 | if y < min:
234 | min = y
235 | s += y
236 | n += 1
237 |
238 | mean = s/n
239 | for x, y in enumerate(hist):
240 | ss += (y-mean)**2
241 | ss /= n
242 | sd = abs(ss)**0.5
243 | print(r,"-",sd,"\n")
244 | if sd < 580:
245 | return 1
246 | else:
247 | return 0
248 |
249 |
250 | def start(self, p,r):
251 | global blood
252 | self.process1(p,r)
253 | self.process2(p,r)
254 | self.process3(p,r)
255 | self.process4(r)
256 | self.process5(r)
257 | a = self.process7(r)
258 | print(a," - ",r)
259 | if a == 1:
260 | if r == "Anti A":
261 | blood[0]=True
262 | elif r == "Anti B":
263 | blood[1]=True
264 | elif r == "Anti D":
265 | blood[2]=True
266 | elif r == "Control":
267 | blood[3]=True
268 |
269 | def check(self):
270 | if blood[3]==True:
271 | self.message("Invalid")
272 | elif blood[0] is False and blood[1] is False and blood[2] is True and blood[3] is False:
273 | self.message("O+")
274 | elif blood[0] is False and blood[1] is False and blood[2] is False and blood[3] is False:
275 | self.message("O-")
276 | elif blood[0] is True and blood[1] is False and blood[2] is True and blood[3] is False:
277 | self.message("A+")
278 | elif blood[0] is True and blood[1] is False and blood[2] is False and blood[3] is False:
279 | self.message("A-")
280 | elif blood[0] is False and blood[1] is True and blood[2] is True and blood[3] is False:
281 | self.message("B+")
282 | elif blood[0] is False and blood[1] is True and blood[2] is False and blood[3] is False:
283 | self.message("B-")
284 | elif blood[0] is True and blood[1] is True and blood[2] is True and blood[3] is False:
285 | self.message("AB+")
286 | elif blood[0] is True and blood[1] is True and blood[2] is False and blood[3] is False:
287 | self.message("AB-")
288 |
289 |
290 | def gp(self):
291 | im1 = cv2.imread('p1Anti A.png')
292 | cv2.imshow('Anti-A',im1)
293 | im2 = cv2.imread('p1Anti B.png')
294 | cv2.imshow('Anti-B', im2)
295 | im3 = cv2.imread('p1Anti D.png')
296 | cv2.imshow('Anti-D', im3)
297 | im4 = cv2.imread('p1Control.png')
298 | cv2.imshow('Control', im4)
299 | cv2.waitKey(0)
300 | cv2.destroyAllWindows()
301 |
302 | def autothresh(self):
303 | im1 = cv2.imread('p2Anti A.png')
304 | cv2.imshow('Anti-A', im1)
305 | im2 = cv2.imread('p2Anti B.png')
306 | cv2.imshow('Anti-B', im2)
307 | im3 = cv2.imread('p2Anti D.png')
308 | cv2.imshow('Anti-D', im3)
309 | im4 = cv2.imread('p2Control.png')
310 | cv2.imshow('Control', im4)
311 | cv2.waitKey(0)
312 | cv2.destroyAllWindows()
313 |
314 | def Adapthresh(self):
315 | im1 = cv2.imread('p3Anti A.png')
316 | cv2.imshow('Anti-A', im1)
317 | im2 = cv2.imread('p3Anti B.png')
318 | cv2.imshow('Anti-B', im2)
319 | im3 = cv2.imread('p3Anti D.png')
320 | cv2.imshow('Anti-D', im3)
321 | im4 = cv2.imread('p3Control.png')
322 | cv2.imshow('Control', im4)
323 | cv2.waitKey(0)
324 | cv2.destroyAllWindows()
325 |
326 | def Fill_holes(self):
327 | im1 = cv2.imread('p4Anti A.png')
328 | cv2.imshow('Anti-A', im1)
329 | im2 = cv2.imread('p4Anti B.png')
330 | cv2.imshow('Anti-B', im2)
331 | im3 = cv2.imread('p4Anti D.png')
332 | cv2.imshow('Anti-D', im3)
333 | im4 = cv2.imread('p4Control.png')
334 | cv2.imshow('Control', im4)
335 | cv2.waitKey(0)
336 | cv2.destroyAllWindows()
337 |
338 | def Remove_small_objects(self):
339 | im1 = cv2.imread('p5Anti A.png')
340 | cv2.imshow('Anti-A', im1)
341 | im2 = cv2.imread('p5Anti B.png')
342 | cv2.imshow('Anti-B', im2)
343 | im3 = cv2.imread('p5Anti D.png')
344 | cv2.imshow('Anti-D', im3)
345 | im4 = cv2.imread('p5Control.png')
346 | cv2.imshow('Control', im4)
347 | cv2.waitKey(0)
348 | cv2.destroyAllWindows()
349 |
350 | def Histogram(self):
351 | img1 = cv2.imread('p5Anti A.png', 0)
352 | img2 = cv2.imread('p5Anti B.png', 0)
353 | img3 = cv2.imread('p5Anti D.png', 0)
354 | img4 = cv2.imread('p5Control.png', 0)
355 | plt.hist(img1.ravel(), 256, [0, 256])
356 | plt.show()
357 | plt.hist(img2.ravel(), 256, [0, 256])
358 | plt.show()
359 | plt.hist(img3.ravel(), 256, [0, 256])
360 | plt.show()
361 | plt.hist(img4.ravel(), 256, [0, 256])
362 | plt.show()
363 |
364 | def HSV_Luminance(self):
365 | img1 = cv2.imread(p1)
366 | hsv1 = cv2.cvtColor(img1, cv2.COLOR_BGR2HSV)
367 | cv2.imshow(hsv1, 0)
368 |
369 | img2 = cv2.imread(p2)
370 | hsv2 = cv2.cvtColor(img2, cv2.COLOR_BGR2HSV)
371 | cv2.imshow(hsv2, 0)
372 |
373 | img3 = cv2.imread(p3)
374 | hsv3 = cv2.cvtColor(img3, cv2.COLOR_BGR2HSV)
375 | cv2.imshow(hsv3, 0)
376 |
377 | img4 = cv2.imread(p4)
378 | hsv4 = cv2.cvtColor(img4, cv2.COLOR_BGR2HSV)
379 | cv2.imshow(hsv4, 0)
380 |
381 | cv2.waitKey(0)
382 | cv2.destroyAllWindows()
383 |
384 | def stp_full(self,event=None):
385 | root.attributes("-fullscreen", False)
386 | root.geometry("1020x720")
387 |
388 |
389 |
390 |
391 | while(1):
392 | if q == 0:
393 | break
394 | else:
395 | root = Tk()
396 | root.attributes("-fullscreen",True)
397 | app = Login(root)
398 | root.bind("", app.stp_full)
399 | root.mainloop()
400 |
--------------------------------------------------------------------------------