I am starting learning an openCV and a have question about it.
My target is to recognize captcha.
First I must preprocess an image.
There is an example of captcha here
So problem is how to crop symbols from image and put it into 2D array(bitmap).
I am starting learning an openCV and a have question about it.
My target is to recognize captcha.
First I must preprocess an image.
There is an example of captcha here
So problem is how to crop symbols from image and put it into 2D array(bitmap).
Automatic Partition Detection
The first thing you'd need to do is create the filter array of background colors. This will be the array containing the colors that occur in the background. For that purpose you can just take the offset 20x20 area or leave it as a user option depending on your project standpoint.
Well it didn't go that much pseudo-code.
Now that you have the filter you can limit outer pixels. Now what you need is a vertical raster scan. Or just vertical scan. Over the entire captcha image. Each pixel of the vertical line will be additionally checked if it matches some color from the already-obtained
area
. If all the pixels of the line (that has the size of the image's height) return positive when checked whether pixel is close to or matchesarea
color, an aray indexer will increment so that we have where the last character ends.Edit 1 For 3 seconds I GIMPed the color curves of the image, resulting in a plain background:
So this respectively simplifies the filtering process quite a lot. The color curves magic I did is actually only a brightness/contrast adjustment control, which is maybe the easiest color processing you can implement (after the invert).
I might periodically edit to clarify some more. This will certainly give you a good practice. A real practice.
Doc: