Skip to content
Advertisement

python – opencv morphologyEx remove specific color

After remove captcha’s background.
The image remain digits and noise.
Noise line is all in one color : RGB(127,127,127)
And then using morphology method.

JavaScript

Some part of digit will be remove.
How to use morphologyEx() remove only color in RGB(127,127,127) ?

enter image description here enter image description here

Advertisement

Answer

In order to eliminate color within a particular range you have to use cv2.inRange() function.

Here is the code:

JavaScript

This is what I got for the two images you have:

Image 1:

enter image description here

Image 2:

enter image description here

You carry on from here.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement