Compare commits
No commits in common. "b03b1aaf14140cf46d5f5eb89025e3e9b2e1120a" and "801277ce2be8b8af73a390ea4513cc01a09de530" have entirely different histories.
b03b1aaf14
...
801277ce2b
24
main.py
24
main.py
|
@ -1,7 +1,6 @@
|
||||||
import cv2
|
import cv2
|
||||||
import pytesseract
|
import pytesseract
|
||||||
import os
|
import os
|
||||||
import numpy
|
|
||||||
directory = 'images'
|
directory = 'images'
|
||||||
|
|
||||||
k = 1
|
k = 1
|
||||||
|
@ -21,22 +20,9 @@ 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')
|
||||||
elif os.path.isfile(f'images/{data}.jpg') == True:
|
else:
|
||||||
cv2.imshow(data, ROI)
|
cv2.imshow(ROI)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(50)
|
||||||
manpage = input("please input the number on the page (if the title is correct, enter nothing)")
|
os.rename(f'{f}', f'images/{data}.{k}.jpg')
|
||||||
print(manpage)
|
k = k + 1
|
||||||
#check if the new name already exists
|
|
||||||
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()
|
||||||
|
|
Loading…
Reference in New Issue