You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
585 B
21 lines
585 B
import argparse |
|
from subprocess import check_output |
|
|
|
import pytesseract |
|
from PIL import Image |
|
|
|
|
|
def resolve(image_path): |
|
print("Resampling the Image") |
|
check_output(["convert", image_path, "-resample", "600", image_path]) |
|
return pytesseract.image_to_string(Image.open(image_path)) |
|
|
|
|
|
if __name__ == "__main__": |
|
argparser = argparse.ArgumentParser() |
|
argparser.add_argument("path", help="Captcha file path") |
|
args = argparser.parse_args() |
|
path = args.path |
|
print("Resolving Captcha") |
|
captcha_text = resolve(path) |
|
print("Extracted Text", captcha_text)
|
|
|