forked from remi2257/sudoku-solver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
131 lines (100 loc) · 2.7 KB
/
settings.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import logging
import os
import tensorflow
from cv2 import FONT_HERSHEY_SIMPLEX
from numpy import pi
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
tensorflow.compat.v1.logging.set_verbosity(tensorflow.compat.v1.logging.ERROR)
# CAMERA
CAMERA_PORT = 1
# PATHS
my_dataset_path = "/media/hdd_linux/DataSet/Mine/"
temp_dataset_path = "/media/hdd_linux/DataSet/Mine/temp"
# ----TEXT DISPLAY----#
RED = (0, 0, 255)
PURPLE = (255, 0, 255)
ORANGE = (0, 127, 255)
GREEN = (0, 255, 0)
BLUE = (255, 0, 0)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
font = FONT_HERSHEY_SIMPLEX
font_scale_normal = 2.0
font_scale_small = 1.1
thickness_normal = 3
thickness_small = 2
# ----RESIZE----#
param_resize_height = 900
param_resize_width = 1600
resize_height_hough = 360
resize_width_hough = 640
output_width = 1365 #853
output_height = 768 # 480
ratio_resize_hough = float(param_resize_height) / resize_height_hough
# ----PREPRO BIG IMAGE----#
block_size_big = 41
block_size_webcam_big = 21
mean_sub_big = 15
mean_sub_webcam_big = 5
# display_prepro_big = True
display_prepro_big = False
# ----GRID COUNTOURS----#
ratio_lim = 2
smallest_area_allow = 75000
approx_poly_coef = 0.1
# ----GRID UPDATE AND SIMILARITY----#
lim_apparition_not_solved = 12
lim_apparition_solved = 60
same_grid_dist_ratio = 0.05
target_h_grid, target_w_grid = 450, 450
# ----HOUGH----#
thresh_hough = 500
# thresh_hough_p = 170
# minLineLength_h_p = 5
# maxLineGap_h_p = 5
# hough_rho = 3
# hough_theta = 3 * pi / 180
thresh_hough_p = 100
minLineLength_h_p = 5
maxLineGap_h_p = 5
hough_rho = 3
hough_theta = 3 * pi / 180
# display_line_on_edges = True
display_line_on_edges = False
# ----PREPRO IMAGE DIGIT----#
block_size_grid = 29 # 43
block_size_webcam_grid = 25
mean_sub_grid = 25
mean_sub_webcam_grid = 5
# display_prepro_grid = True
display_prepro_grid = False
# ----DIGITS EXTRACTION----#
thresh_conf_cnn = 0.98
thresh_conf_cnn_high = 0.99
digits_2_check = 12
lim_bord = 10
thresh_h_low = 15
thresh_h_high = 50
thresh_area_low = 210
thresh_area_high = 900
l_case = 45
l_border = 1
offset_y = 2
min_digits_extracted = 13
# ----LOGGER----#
def logger_gen(level='DEBUG'):
# In the Console
# logging.basicConfig(format='%[levelname]s : %(message)s')
logging.basicConfig(format='%(message)s')
logger = logging.getLogger(__name__)
logger.setLevel(level)
# create a file handler
handler = logging.FileHandler('logger.log')
# create a logging format
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# formatter = logging.Formatter('%(levelname)s - %(message)s')
# handler.setFormatter(formatter)
# add the handlers to the logger
logger.addHandler(handler)
return logger
logger = logger_gen()