Removing background noisy lines from Captcha Image using PYTHON PIL

后端 未结 3 1576
庸人自扰
庸人自扰 2021-02-06 16:26

I have a processed captcha image(Enlarged) look like :
\"captcha\"

As you can see, the font-size of the \"TEXT\

3条回答
  •  攒了一身酷
    2021-02-06 17:02

    I personally use dilate and erode as stated above but combine that with some basic statistics for width and height, try to find outliers and eliminate those lines as needed. After that, a filter which takes the minimum value of a kernel and turns the central pixel that color in a temporary image (iterating down the old image) before using the temporary image as the original should work. In pillow/PIL the minimum based task is accomplished with img.filter(ImageFilter.MINFILTER).

    IF that is not enough, it should produce an identifiable set for which OpenCV's contours and minimum bounding rotated box can be used to rotate a letter for comparison (I reccomend Tesseract or a commercial OCR at this point since they have a ton of fonts and extra features like clustering and cleanup).

提交回复
热议问题