I\'m trying to clean up the image above I\'ve tried several different methods using open cv, I either erode the original image too much to the point where parts of the
Take a closer look to your captcha. most of the dust in that image has a different grayscale value than the text.
The text is in 140
and the dust is in 112
.
A simple grayscale filtering will help a lot here.
from scipy.misc import imread, imsave
import numpy as np
infile = "A1nO4.png"
outfile = "A1nO4_out.png"
im = imread(infile, True)
out_im = np.ones(im.shape) * 255
out_im[im == 140] = 0
imsave(outfile, out_im)
Now use cv2.dilate
(cv2.erode
on a white on black text) to get rid of the remaining dust.