From 1040e754e5c9ac267382455e4a399852f7b13d21 Mon Sep 17 00:00:00 2001 From: Kabooshki Date: Tue, 17 Sep 2024 13:04:49 -0500 Subject: [PATCH 1/2] reverted --- main.py | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/main.py b/main.py index b1a5fed..1e25278 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,9 @@ import cv2 import pytesseract import os -import numpy directory = 'images' +k = 1 # iterate over files in # that directory for filename in os.listdir(directory): @@ -20,21 +20,9 @@ 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') - 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() - cv2.destroyAllWindows() \ No newline at end of file + else: + cv2.imshow(ROI) + cv2.waitKey(50) + os.rename(f'{f}', f'images/{data}.{k}.jpg') + k = k + 1 + cv2.destroyAllWindows() From 9aaeb28ffc37a725e6a425fb2ec522327187864d Mon Sep 17 00:00:00 2001 From: Kabooshki Date: Tue, 17 Sep 2024 13:05:33 -0500 Subject: [PATCH 2/2] added function to review duplicates --- main.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 1e25278..b1a5fed 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,9 @@ import cv2 import pytesseract import os +import numpy directory = 'images' -k = 1 # iterate over files in # that directory for filename in os.listdir(directory): @@ -20,9 +20,21 @@ 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') - k = k + 1 - cv2.destroyAllWindows() + 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() + cv2.destroyAllWindows() \ No newline at end of file