K
K
KvanTTT2012-01-21 19:25:29
Text recognising
KvanTTT, 2012-01-21 19:25:29

Algorithm for determining a rectangular area containing a word in an image?

Please tell me a universal, stable, not very complicated algorithm for finding the nearest rectangular area containing a word in an image from a given point.
4170157800a98019de7575244e686291.png
The input data is the point X, Y (marked with a red cross in the figure).
The output is a Left, Top, Width, Height rectangle (marked in blue in the figure).
Universality means working with any sizes, font colors and as many types of fonts as possible.
At the moment, an algorithm has been implemented, the idea of ​​which is to count light pixels in columns and rows several times. But it needs refinement and selection of coefficients.
Does anyone have any other ideas? How is segmentation of words and pictures implemented in OCR engines?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
lashtal, 2012-01-21
@lashtal

There are many tasks to be solved here:
Determine where the text (blocks of text) is, rotate it correctly, determine if there was a click inside this area.
The words can then be highlighted using Connected-component labeling ( en.wikipedia.org/wiki/Connected_Component_Labeling ) probably.
In general, there are free OCR libraries, they should definitely be able to do this.

V
Vitaly Zheltyakov, 2012-01-21
@VitaZheltyakov

Something like this:
- First, discolor and reduce the number of colors to 2 (black and white);
- We go in one direction (up, down, left or right) and look for 1-2 completely white lines. We write down the coordinates of the internal;
- Repeat for all directions;
- We get the area limited by internal coordinates;
- Repeat for her;
- Next comes the breakdown into letters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question