5
5
import os
6
6
from tkinter import *
7
7
import shutil
8
+ import blur_detection
8
9
9
10
10
11
# Main >>>
@@ -26,6 +27,7 @@ def quit_button_pressed():
26
27
pressed = False
27
28
28
29
# Check Box variables
30
+ _del_blur = BooleanVar ()
29
31
_original = BooleanVar ()
30
32
_histEqualization = BooleanVar ()
31
33
_dilation = BooleanVar ()
@@ -36,30 +38,34 @@ def quit_button_pressed():
36
38
_rotate = BooleanVar ()
37
39
_five_fold = BooleanVar ()
38
40
_rotate_ang = IntVar (0 )
41
+ _blur_thresh = IntVar (0 )
39
42
40
43
# UI Creation
41
- Checkbutton (root , text = "Original" , variable = _original ).grid (row = 0 , sticky = W )
42
- Checkbutton (root , text = "Hist. Equalization" , variable = _histEqualization ).grid (row = 1 , sticky = W )
43
- Checkbutton (root , text = "Dilation" , variable = _dilation ).grid (row = 2 , sticky = W )
44
- Checkbutton (root , text = "Erosion" , variable = _erosion ).grid (row = 3 , sticky = W )
45
- Checkbutton (root , text = "Blur" , variable = _blur ).grid (row = 4 , sticky = W )
46
- Checkbutton (root , text = "Sharpen" , variable = _sharpen ).grid (row = 5 , sticky = W )
47
- Checkbutton (root , text = "Mirror" , variable = _mirror ).grid (row = 6 , sticky = W )
48
- Checkbutton (root , text = "Rotate All" , variable = _rotate ).grid (row = 7 , sticky = W )
49
-
50
- Label (root , text = "Angle Span in Degrees: " ).grid (row = 7 , column = 2 )
51
- Label (root , text = "(Default: 45)" ).grid (row = 8 , column = 2 )
52
- Entry (root , textvariable = _rotate_ang ).grid (row = 7 , column = 3 )
44
+ Checkbutton (root , text = "Detect & Delete Blurry Images" , variable = _del_blur ).grid (row = 0 , sticky = W )
45
+ Checkbutton (root , text = "Original" , variable = _original ).grid (row = 1 , sticky = W )
46
+ Checkbutton (root , text = "Hist. Equalization" , variable = _histEqualization ).grid (row = 2 , sticky = W )
47
+ Checkbutton (root , text = "Dilation" , variable = _dilation ).grid (row = 3 , sticky = W )
48
+ Checkbutton (root , text = "Erosion" , variable = _erosion ).grid (row = 4 , sticky = W )
49
+ Checkbutton (root , text = "Blur" , variable = _blur ).grid (row = 5 , sticky = W )
50
+ Checkbutton (root , text = "Sharpen" , variable = _sharpen ).grid (row = 6 , sticky = W )
51
+ Checkbutton (root , text = "Mirror" , variable = _mirror ).grid (row = 7 , sticky = W )
52
+ Checkbutton (root , text = "Rotate All" , variable = _rotate ).grid (row = 8 , sticky = W )
53
+
54
+ Label (root , text = "Angle Span in Degrees: " ).grid (row = 8 , column = 2 )
55
+ Label (root , text = "(Default: 45)" ).grid (row = 9 , column = 2 )
56
+ Entry (root , textvariable = _rotate_ang ).grid (row = 8 , column = 3 )
57
+ Label (root , text = "Blur Threshold (Default=7):" ).grid (row = 0 , column = 2 )
58
+ Entry (root , textvariable = _blur_thresh ).grid (row = 0 , column = 3 )
53
59
54
60
Checkbutton (root , text = "Five-Fold (Default: Single-Fold)" , variable = _five_fold ).grid (row = 10 , sticky = W )
55
61
Button (root , text = "Quit" , command = quit_button_pressed , width = 15 ).grid (row = 11 , column = 2 , sticky = W )
56
62
Button (root , text = "Apply" , command = apply_button_pressed , width = 15 ).grid (row = 11 , column = 3 , sticky = W )
57
63
58
64
root .mainloop ()
59
65
60
-
61
66
# Checking [Start] status
62
67
if pressed :
68
+ del_blur = _del_blur .get ()
63
69
original = _original .get ()
64
70
histEqualization = _histEqualization .get ()
65
71
dilation = _dilation .get ()
@@ -71,6 +77,7 @@ def quit_button_pressed():
71
77
global five_fold
72
78
five_fold = _five_fold .get ()
73
79
rot_ang = _rotate_ang .get ()
80
+ blur_thresh = _blur_thresh .get ()
74
81
75
82
if (original is False and histEqualization is False and dilation is False and
76
83
erosion is False and blur is False and sharpen is False and mirror is False ):
@@ -90,6 +97,12 @@ def quit_button_pressed():
90
97
else :
91
98
rotationAngle = None
92
99
100
+ # Detect and Delete blurry images
101
+ if del_blur :
102
+ if blur_thresh is 0 :
103
+ blur_thresh = 7
104
+ blur_detection .main (blur_thresh )
105
+
93
106
# Number of folds
94
107
global fold_num
95
108
fold_num = 5 # For 5Folds
0 commit comments