0

I want to bypass a captcha that has lines inside, I was reading that can be done by removing the lines with the algorithm that is below, could help me enter as remove the lines.

enter image description here

def to_break():
    img = Image.open('crop-img1.png')
    img = image.convert("RGBA")
    img.save("input-1.gif", "GIF")
    pixdata = img.load()
    for y in xrange(img.size[1]):
        for x in xrange(img.size[0]):
            if pixdata[x, y][0] < 400:
                pixdata[enter image description here][1][x, y] = (0, 0, 0, 255)

    for y in xrange(img.size[1]):
        for x in xrange(img.size[0]):
            if pixdata[x, y][2] < 600:
                pixdata[x, y] = (0, 0, 0, 255)

    for y in xrange(img.size[1]):
        for x in xrange(img.size[0]):
            if pixdata[x, y][3] > 0:
                pixdata[x, y] = (255, 255, 255, 255)    

    img.save("dni-crop.jpg")
    image = Image.open("dni-crop.jpg")
    text = pytesseract.image_to_string(image)
    captcha=text.replace(' ','').upper()
    return captcha
Torxed
  • 22,866
  • 14
  • 82
  • 131
  • I'm still not sure what your question is. Please take a look at [mcve]. Does the code posted not work and you want us to debug (for a start looks like your formatting is messed up, let alone `pixdata[enter image description here][1]` is plain wrong, probably caused as a result of trying to add the image)? – Bahrom Nov 16 '16 at 15:51
  • Basically I want to remove the captcha lines, but I do not know how, could you help me? – Moises Salinas Nov 16 '16 at 16:32
  • Possible duplicate [what-processing-steps-should-i-use-to-clean-photos-of-line-drawings](http://stackoverflow.com/questions/4632174/what-processing-steps-should-i-use-to-clean-photos-of-line-drawings) – mx0 Nov 16 '16 at 18:28

0 Answers0