-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
Description
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