English (unofficial) translations of posts at kexue.fm
Source

A Brief Exploration of OCR Technology: 5. Text Segmentation

Translated by DeepSeek V4 Pro. Translations can be inaccurate, please refer to the original post for important stuff.

After the previous step, having obtained the single-line text regions, we can find a way to segment the single-line text into individual characters. Since the model in the third step is built for individual characters, this step is also essential.

Uniform Segmentation

Based on the assumption of square Chinese characters, the simplest segmentation method is actually uniform segmentation. This means cutting the single-line text directly into square images based on the height without any additional judgment. This approach can handle most single-line text, as shown in the top image below.

Successful uniform segmentation
Failed uniform segmentation

Of course, the drawbacks of uniform segmentation are also obvious. Most Chinese characters are square, but most English letters and numbers are not. Therefore, when mixed Chinese and English text appears, uniform segmentation fails, as shown in the bottom image above.

Statistical Segmentation

As can be seen from the figures, after the previous operations, the characters are well-separated. Therefore, another simple approach is to perform a vertical summation of the single-line text image; the columns where the sum is zero are the columns to be cut.

This statistical approach can effectively solve the problem of segmenting mixed Chinese and English text images, but it also has certain drawbacks. The most obvious is that characters such as "Xiao" or "De" may be split into two parts.

Comparison

A better approach is to combine the results of the previous two methods and determine whether to cut by comparing whether the preceding and succeeding regions form a square. The specific steps are:

  1. Derive candidate cutting lines through the statistical summation approach;

  2. If the sum of the distances from a candidate cutting line to its adjacent left and right candidate cutting lines exceeds 1.2 times the height, then the candidate cutting line is confirmed as a cutting line;

  3. If the resulting region is a distinct elongated rectangle and cannot be segmented according to the above two steps, then apply uniform segmentation.

These three steps are relatively simple and are based on two assumptions: 1. The ratio of the width to the height for digits and English characters is greater than 60%; 2. The ratio of the width to the height for Chinese characters is less than 1.2. Testing shows that this algorithm works well for segmenting the text features extracted in the previous steps.

When reposting, please include the original link of this article: https://kexue.fm/archives/3823

For more detailed information regarding reposting, please refer to: Scientific Space FAQ