Search code examples
image-processingaforgeimage-segmentation

image segmentation when a characters connected in aforge and c#


I have the following image and has binarization。

enter image description here

i need to segmentation this image and recognized the digit.the double digits 4' and '9' that are connected together.

i read a some of document that mention about 'watershed morphology' method.the following image has be implemented a 'watershed segmentation'.

enter image description hereenter image description here

it's obvious that double 44 digits still connected but a 9 digit already segmentation to success.

i need some help how to segmentation a 44 characters!thanks.


Solution

  • zhengchun,

    you need to understand that this is a quite difficult task which, in my opinion, cannot be perfectly solved in all cases.

    In the first place, correctly splitting between characters without prior knowledge on their size and shape is just impossible: just consider the letter W, it could very well be split into two V's; on the opposite, nothing can tell you that two accidentally touching IJ are indeed two different letters rather then a U.

    This means that no "blind" method like the watershed or any other can succeed, whatever the sophistication. Geometry alone is not enough, you need to rely on some description of the font (sizes and shapes).

    To the best of my knowledge, you must let segmentation and recognition work together. What you can do is:

    • use the initial segmentation, hoping that touching and broken characters do not arise so often;
    • starting from the left, try immediate character recognition by splitting after one character width (you will need to try every font character in turn, possibly with different widths);
    • keep the most likely recognition result and continue recognition from that split, to the right;
    • if you expect broken characters, you can as well try recognitions that span two or more blobs and group these. (Gaps between blobs are good hints for splits, unless your characters can be broken or miss parts.)

    You can improve the above procedure by adding heuristics to decide where splits are more likely, such as at a height minimum, but this is tricky. A pinch of black magic...