16 for map
in os.listdir(input_path):
17 split = map.split(
'.')
18 if split[-1] ==
'png':
19 print(
'starting map: ', map)
20 p = os.path.join(input_path, map)
21 image = cv2.imread(p, flags=cv2.IMREAD_GRAYSCALE)
24 _, im1 = cv2.threshold(im1, 230, 255, cv2.THRESH_BINARY)
25 _, im2 = cv2.threshold(im2, 150, 255, cv2.THRESH_BINARY)
28 for y
in range(image.shape[0]):
29 for x
in range(image.shape[1]):
37 arr.append([map, white, black, bw])
42 initial_path =
'./../data/INPUT/IMGs/'
43 folders = [
'ubremen-cartesium',
'Bushong',
'Frankton',
'Freiburg_Building_079',
'Intel_Reserach_Lab',
'Keweenaw',
44 'Maguayo',
'Moonachie']
45 for folder
in folders:
46 print(
'starting folder: ', folder)
48 tab = [[
'map name',
'count_pixel_white',
'count_pixel_black',
'count_pixel_b&w',
'percentage']]
49 input_path = os.path.join(initial_path, folder)
55 arr.sort(key=sort_percentage)
57 perc = (el[3]/maximum) * 100
58 el.append(str(perc) +
'%')
60 filename = os.path.join(input_path,
'percentage_exploration.txt')
61 file = open(filename,
'w+')
63 tab = tabulate.tabulate(tab, headers=
'firstrow', tablefmt=
"github")
64 file.write(
"Percentage of exploration \n%s" % tab)
69 initial_path =
'./../data/INPUT/IMGs/'
70 for folder
in os.listdir(initial_path):
71 print(
'starting folder: ', folder)
72 tab = [[
'map name',
'count_pixel_white',
'count_pixel_black',
'count_pixel_b&w']]
74 input_path = os.path.join(initial_path, folder)
76 arr.sort(key=sort_pixel)
78 filename = os.path.join(input_path,
'pixel_color_count.txt')
79 file = open(filename,
'w+')
81 tab = tabulate.tabulate(tab, headers=
'firstrow', tablefmt=
"github")
82 file.write(
"Area pixel color: \n%s" % tab)
86 if __name__ ==
'__main__':