-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify_rectangle.py
38 lines (33 loc) · 1016 Bytes
/
verify_rectangle.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
import cv2
import os
PATH_TO_IMAGE_FOLDER = r'E:\TableBank-Recognition\Recognition\images'
with open('detect_v1/rec_deet.txt') as f:
old_list = f.readlines()
old_list = [line.strip() for line in old_list]
with open('detect_v1/wrong.txt') as f:
wrong_list = f.readlines()
wrong_list = [line.strip() for line in wrong_list]
for line in wrong_list:
old_list.remove(line)
counter = 0
new_list = []
with open('rec_deet.txt') as f:
flist = f.readlines()
flist = [line.strip() for line in flist]
for file in flist:
if file in old_list:
counter += 1
new_list.append(file)
continue
img = cv2.imread(os.path.join(PATH_TO_IMAGE_FOLDER, file))
cv2.imshow('FFF', img)
q = cv2.waitKey()
if q != 32:
print(file)
else:
new_list.append(file)
cv2.destroyAllWindows()
print(counter)
with open('correct.txt', 'w') as f:
for item in new_list:
f.write(item + '\n')