Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Captcha #19

Open
Lord-Evil opened this issue Jul 13, 2017 · 2 comments
Open

Captcha #19

Lord-Evil opened this issue Jul 13, 2017 · 2 comments

Comments

@Lord-Evil
Copy link

Btw, instead of using complex image recognition algos there's simpler way I've discoverd, Python method:

import base64
from PIL import Image
import io
def readPort(base64str):
    tablePort={75:"0",36:"1",48:"2",56:"3",55:"4",58:"5",47:"6",44:"7",62:"8",69:"9"}
    pic=base64.b64decode(base64str)
    i=Image.open(io.BytesIO(pic))
    digits=list()
    digit=0
    for x in range(0,i.width):
        row=0
        for y in range(0,i.height):
            p=i.getpixel((x,y))
            if(p==1):
                digit+=p
                row=1
        if(not row):
            if(digit):digits.append(digit)
            digit=0
    try:
        captcha=""
        for d in digits:
            captcha+=tablePort[d]   
        return int(captcha)
    except:
        return digits

Each digit has always the same amount of pixels excluding some noise pixels with values >1

@MrSonicMaster
Copy link
Owner

Cool, thanks for the suggestion. The image recognition I use is Tesseract OCR, and its loaded on my VPS. It takes less a very short amount of time to process such a small image, and also doesn't use up many resources on my vps, but it would still be good to not have it rely on my server staying online.

@Lord-Evil
Copy link
Author

I never had much experience with image recognition software and the one I've tried to use at fist didn't do a good job solving this "captcha", so it just hit me that chars might have the same amount of pixels if noises are removed :-D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants