A
A
alst1612020-02-28 21:09:40
OpenCV
alst161, 2020-02-28 21:09:40

How to clean up such images using OpenCV?

I need to bypass the captcha, I'm studying the possibilities of opencv. I can not make a normal contour to select and process a figure. How can you get rid of these stripes?
5e5956836131d342511997.gif5e59568b6dde1713483328.gif5e5956915ccf8122739908.gif5e595698c3577179779412.gif5e59569e041fa981729420.gif5e5956a2d74f4094986343.gif5e5956aba4b2e297860359.gif

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Pankov, 2020-02-28
@trapwalker

The captcha is weak:
- fonts do not vary,
- size is fixed,
- single-pixel lines,
- noise of the same type.
Don't worry too much about lines. Transfer the image to lab; work in the monochrome luminance channel. Choose a similar font and size, train 10 neurons for your number each. Scan in pixel increments. That will be enough
But! The lines are single pixel thick, high contrast, and usually differ in color from the background figure.
You just want to get rid of it, don't you?
It can be done algorithmically.
We sort through all the pixels and analyze the neighboring ones. When a contrasting pixel is found, we run the "bark beetle" algorithm with an additional condition. If the angles between the first pixel and the subsequent pre-colored ones begin to differ by more than the threshold epsilon, which can also decrease depending on the distance, then we stop the bark beetle process, the line is not confirmed. By the fact of the natural completion of the bark beetle, we take for each point the average color of the two in the direction perpendicular to the line.

X
xmoonlight, 2020-02-29
@xmoonlight

orig AND blur orig
Blur and multiply.
We get only large objects (numbers without lines).

M
mayton2019, 2020-03-01
@mayton2019

The stripes will not prevent the neural network from recognizing the characters. Don't get distracted by nonsense.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question