Remove background text and noise from an image using image processing with OpenCV

前端 未结 3 555
夕颜
夕颜 2021-02-08 18:09

I have these images

For which I want to remove the text in the background. Only the captcha characters should remain(i.e K6PwKA, YabVzu).

3条回答
  •  臣服心动
    2021-02-08 18:48

    Didn't try , but this might work. step 1: use ps to find out what color the captcha characters are. For excample, "YabVzu" is (128,128,128),

    Step 2: Use pillow's method getdata()/getcolor(), it will return a sequence which contain the colour of every pixel.

    then ,we project every item in the sequence to the original captcha image.

    hence we know the positon of every pixel in the image.

    Step 3: find all pixels whose colour with the most approximate values to (128,128,128). You may set a threshold to control the accuracy. this step return another sequence. Lets annotate it as Seq a

    Step 4: generate a picture with the very same height and width as the original one. plot every pixel in [Seq a] in the very excat position in the picture. Here,we will get a cleaned training items

    Step 5: Use a Keras project to break the code. And the precission should be over 72%.

提交回复
热议问题