added a review function when duplicates are detected

This commit is contained in:
Kabooshki 2024-09-17 12:02:13 -05:00
parent 84c4122d5f
commit f22510d186
3 changed files with 19 additions and 5 deletions

2
TODO
View File

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

22
main.py
View File

@ -1,6 +1,7 @@
import cv2
import pytesseract
import os
import numpy
directory = 'images'
k = 1
@ -20,9 +21,22 @@ for filename in os.listdir(directory):
print(data)
if os.path.isfile(f'images/{data}.jpg') == False:
os.rename(f'{f}', f'images/{data}.jpg')
else:
cv2.imshow(ROI)
cv2.waitKey(50)
os.rename(f'{f}', f'images/{data}.{k}.jpg')
elif os.path.isfile(f'images/{data}.jpg') == True:
cv2.imshow(data, ROI)
cv2.waitKey(1)
manpage = input("please input the number on the page (if the title is correct, enter nothing)")
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()
k = k + 1
cv2.destroyAllWindows()

View File