Compare commits

...

3 Commits

Author SHA1 Message Date
Kabooshki e986b8dd00 removed obsolete iterator 2024-09-17 12:04:41 -05:00
Kabooshki f22510d186 added a review function when duplicates are detected 2024-09-17 12:02:13 -05:00
Kabooshki 84c4122d5f new branch 2024-09-17 11:04:53 -05:00
2 changed files with 19 additions and 7 deletions

2
TODO
View File

@ -1,2 +1,2 @@
improve accuracy improve accuracy
create fixer program

24
main.py
View File

@ -1,9 +1,9 @@
import cv2 import cv2
import pytesseract import pytesseract
import os import os
import numpy
directory = 'images' directory = 'images'
k = 1
# iterate over files in # iterate over files in
# that directory # that directory
for filename in os.listdir(directory): for filename in os.listdir(directory):
@ -20,9 +20,21 @@ for filename in os.listdir(directory):
print(data) print(data)
if os.path.isfile(f'images/{data}.jpg') == False: if os.path.isfile(f'images/{data}.jpg') == False:
os.rename(f'{f}', f'images/{data}.jpg') os.rename(f'{f}', f'images/{data}.jpg')
else: elif os.path.isfile(f'images/{data}.jpg') == True:
cv2.imshow(ROI) cv2.imshow(data, ROI)
cv2.waitKey(50) cv2.waitKey(1)
os.rename(f'{f}', f'images/{data}.{k}.jpg') manpage = input("please input the number on the page (if the title is correct, enter nothing)")
k = k + 1 print(manpage)
if manpage == "\n":
rng = numpy.random.default_rng().random()
os.rename (f'images/{data}.jpg', f'images/{data}.review-{rng}.jpg')
os.rename(f'{f}', f'images/{data}.jpg')
elif manpage != "\n":
if os.path.isfile(f'images/{manpage}.jpg') == True:
rng = numpy.random.default_rng().random()
os.rename (f'images/{manpage}.jpg', f'images/{manpage}.review-{rng}.jpg')
os.rename(f'{f}', f'images/{manpage}.jpg')
elif os.path.isfile(f'images/{manpage}.jpg') == False:
os.rename(f'{f}', f'images/{manpage}.jpg')
cv2.destroyAllWindows()
cv2.destroyAllWindows() cv2.destroyAllWindows()