I'm using pytesseract to get captcha strings for captchas like:

But it does not work as expected. My code is:
captcha_text = pytesseract.image_to_string(Image.open('captcha.png'), lang='eng', config='-c tessedit_char_whitelist=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ --psm 8 --oem 3')
Since there is some noise in the picture, I think we must remove those first. Any ideas?