From f22510d1861d1603193860ee578ebbea78b3d345 Mon Sep 17 00:00:00 2001 From: Kabooshki Date: Tue, 17 Sep 2024 12:02:13 -0500 Subject: [PATCH] added a review function when duplicates are detected --- TODO | 2 +- main.py | 22 ++++++++++++++++++---- tester.py | 0 3 files changed, 19 insertions(+), 5 deletions(-) delete mode 100644 tester.py diff --git a/TODO b/TODO index bd382c0..142f31d 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,2 @@ improve accuracy - +create fixer program diff --git a/main.py b/main.py index 1e25278..7177901 100644 --- a/main.py +++ b/main.py @@ -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() diff --git a/tester.py b/tester.py deleted file mode 100644 index e69de29..0000000