I've been using office document imaging for OCR to get the text from the image. For this image,

I'd like to know the preprocessing steps involved to improve the quality of the image before feeding it to the OCR. So far I've tried binarization (threshold), blur(Gaussian), sharpen, mean removal & increasing the brightness and contrast of the image, but still the OCR engine couldn't get the exact text (may be 50 % success).
I'd like to know the preprocessing steps (in right order) to improve the quality preferably in C#. The image of the screen is captured via a webcam. Thanks.
I have played with your image a bit in C++ with my DIP lib and here is the result:
picture pic0,pic1;
pic0.load("ocr_green.png");
pic0.pixel_format(_pf_u); // RGB -> Grayscale <0-765>
pic0.enhance_range(); // remove DC offset and use full dynamic range <0-765>
pic0.normalize(8,false); // try to normalize ilumination conditions of image (equalize light) based on 8x8 sqares analysis, do not recolor saturated square with avg color
pic0.enhance_range(); // remove DC offset and use full dynamic range <0-765>
pic1=pic0; // copy result to pic1
pic0.pixel_format(_pf_rgba); // Grayscale -> RGBA
int x,y,c,c0,c1;
for (y=0;y<pic1.ys;y++) // process all H lines
{
c0=pic1.p[y][0].dd; c1=c0; // find min and max intensity in H line
for (x=0;x<pic1.xs;x++)
{
c=pic1.p[y][x].dd;
if (c0>c) c0=c;
if (c1<c) c1=c;
}
if (c1-c0<700) // if difference not big enough blacken H line...
for (x=0;x<pic1.xs;x++) pic1.p[y][x].dd=0;
else // else binarize H line
for (x=0;x<pic1.xs;x++)
if (pic1.p[y][x].dd>=155) pic1.p[y][x].dd=765; else pic1.p[y][x].dd=0;
}
pic1.pixel_format(_pf_rgba); // Grayscale -> RGBA

The left image (pic0) is just yours converted to grayscale, enhanced dynamic range to max and equalized illumination.
picture class there ...The right image (pic1) is binarized but only for horizontal lines with high enough change on pixel intensities (as mentioned in my comment)... the rest is set to black...
This image is of a very good quality for OCR. It will binarize seamlessly. Depending on the engine, you will perform the binarization yourself or let the engine do it.
Probably you have to blacken the bottom area so that characters get separated. As the screen layout is fixed, this can be easily automated.
You also need to check if this OCR knows about this font.

You can delimit the white areas by profile analysis (cumulating horizontally).

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With