A method for letter text recognition based on computer vision

By combining the Euler number of images, the graph segment features at a specific height or width, and the ratio of height to width, letter image recognition is performed using a computer vision-based method, which solves the problems of large calculations, difficulty in processing noise and overfitting in the prior art, and achieves a high accuracy and robust recognition effect.

CN114332891BActive Publication Date: 2025-04-15SHAANXI UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111676538.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-04-15
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

When existing image recognition technology deals with interference and noise introduced by factors such as motion jitter, natural light and weather conditions, the calculation amount is too large, it is difficult to process missing data, and it is prone to overfitting, resulting in low recognition accuracy.

Method used

The letter text recognition method based on computer vision is adopted to achieve simple and fast recognition of letter images by combining Euler's number of images, segment features at a specific height or width, and ratios of height to width. Specific steps include obtaining English character images, converting them into binary images, calculating Euler numbers and classifying them, and identifying letters based on specific features.

Benefits of technology

The accuracy and robustness of image recognition are improved, the calculation amount is reduced, errors due to image shape distortion and color distortion are avoided, and the stability of recognition is enhanced through the learning of feature library.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114332891B_ABST
    Figure CN114332891B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for letter text recognition based on computer vision, including converting the acquired English character image into a binary image by a terminal; scanning the pixels of the image in sequence and recording the corresponding number of segments, the number of adjacent segments and the length of the segment; calculating the Euler number E of the image and classifying it; for character images with the same Euler number, judging the number of holes in the new image according to the number of segments at different positions of the character image, the ratio of the height to the width of the character image, and adding a straight line with the same foreground color at a specific width position of the image, and then performing letter recognition on the character image. The present invention adopts a method combining the Euler number of the image with the segment features at a specific height or width of the image and the ratio of the height to the width to realize simple and rapid recognition of letter images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a letter text recognition method based on computer vision. Background Art

[0002] In formal official documents, after setting the fonts for all levels and types of the body text, you should select the entire text again and set the Western font to the "Times New Roman" format. Due to its classic and stable appearance, "Times New Roman" is often selected as one of the standard fonts and is widely used in books, magazines, reports, official documents, advertisements, and screen displays.

[0003] Image recognition technology is developing rapidly at this stage, and intelligent scanning recognition technology is also constantly being updated and iterated. In actual traffic scenarios, due to the influence of various factors such as motion jitter, natural light, and weather conditions, a certain degree of interference and noise will inevitably be introduced into the collected images. Therefore, there is an urgent need for continuously advanced technologies to accurately recognize images. However, the existing recognition technology still needs to be continuously improved due to problems such as excessive computational complexity, difficulty in processing missing data, and proneness to overfitting. Summary of the invention

[0004] In order to overcome the deficiencies of the above-mentioned prior art, the object of the present invention is to provide a method for letter text recognition based on computer vision, which adopts a method combining the Euler number of the image and the segment features at a specific height or width of the image and the ratio of height to width to achieve simple and fast recognition of letter images.

[0005] In order to achieve the above object, the technical solution adopted by the present invention is:

[0006] A method for letter text recognition based on computer vision comprises the following steps:

[0007] Step 1: Get the English character image and convert it into a binary image;

[0008] Step 2: Scan the pixels of the binary image from left to right and from bottom to top and record the corresponding number of segments, number of adjacent segments, and segment length:

[0009] Step 3: Calculate the Euler number E of the binary image and classify it:

[0010] Step 4: For character images with the same Euler number, determine the number of holes in the new image based on the number of segments at different positions of the binary image, the ratio of the character image height to width, and after adding a straight line with the same foreground color at a specific width position of the image, and then perform letter recognition on the character image.

[0011] The English character image in step 1 is based on the Western font format "Times New Roman" commonly used in formal papers at this stage.

[0012] In step 1, the terminal converts the acquired character image into a binary image specifically as follows: the terminal performs operations of converting the acquired character image from color to grayscale, filtering and denoising the image, and binarizing the image to obtain a binary image of m rows and n columns.

[0013] In step 2, the pixels of the image are sequentially scanned and the corresponding number of segments, the number of adjacent segments and the length of the segments are recorded. Specifically, the pixels of the mth row (m=1, 2, ..., M) or nth column (n=1, 2, ..., N) of the image are sequentially scanned, and the number of segments of the mth row (or nth column) and the number of adjacent segments formed by the segments of the m-1th row (or n-1th column) are recorded. At the same time, the ratio of the height to the width of the image and the number of segments at half the height and at a specific height or width multiple of the letter image are recorded.

[0014] The specific steps of calculating the Euler number E of the image and classifying it in step 3 are as follows: after the image scanning is completed, the number of image segments NR and the number of adjacent image segments NBR are accumulated, the Euler number E of the image is calculated using the formula E=NR-NBR, and the character image is classified according to the Euler number of the image.

[0015] The multiple of the image width in step 4 refers to the ratio of the sequence number of the image segment pixel column at a specific position to the total width m of the circumscribed rectangle of the alphabetic character image, with the positive direction from left to right.

[0016] In step 4, adding a straight line with the same foreground color at a specific height or width position of the image to determine the number of holes in the new image means adding a straight line that is not shorter than the height of the character image at half the width of the image, and combining it with the original image to form a new image with the same color as the foreground color of the character image. The number of holes in the new image will be used as a new method of distinction.

[0017] In step 4, for character images with the same Euler number, letter recognition is performed according to the number of segments at different positions of the character images, specifically:

[0018] When the calculated Euler number is -1, the character is judged to be the letter "B" and the recognition ends;

[0019] When the calculated Euler number is not 1, further judgment is made. When the calculated Euler number is 0, the character corresponds to six letters: A, D, O, P, Q or R. The ratio of the character image height to width, the image height multiples of 0.20, 0.35, 0.49, and the number of image segments with an image width multiple of 0.22 are further calculated.

[0020] When the calculated Euler number is not -1 and 0, further judgment is made. When the calculated Euler number is 1, the character corresponds to 19 letter images: C, E, F, G, H, I, J, K, L, M, N, S, T, U, V, W, X, Y or Z. A straight line not shorter than the character image height is added at half the width of these images, and combined with the original image to form a new image with the same color as the foreground color of the character image. The number of holes in these new images is continued to be calculated and classified. At the same time, the ratio of the height to the width of the original character image is calculated, and the number of segments at half the height, half the width, and multiples of the image height of 0.06, 0.14, 0.15, 0.30, 0.33, 0.35, 0.63, 0.81, and multiples of the image width of 0.14 and 0.22 are further judged.

[0021] When the calculated Euler number is not -1, 0 or 1, the image content is not this type of alphabetic character and the recognition ends.

[0022] The ratio of the character image height to width in step 4 refers to the ratio of the height to width of the circumscribed rectangle of each image.

[0023] The image segment refers to a single or multiple target pixels separated by the background or image boundary in each row of the binary image.

[0024] Beneficial effects of the present invention:

[0025] The present invention is based on the study of the English character morphology used in formal texts, extracts letter features in images, classifies letters according to the Euler number of the image to reduce the amount of calculation, and further identifies character images with the same Euler number by calculating the number of segments at a specific height, avoiding the defects of the prior art due to the inevitable errors such as shape distortion and color distortion during image acquisition, as well as the normalization of character image size. By setting some simple judgment conditions for the image and adding learning samples in various forms and scenes to the feature library, the system continuously deepens the recognition and recognition probability of letter character image logo recognition, with high recognition accuracy and strong robustness. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 It is a flowchart of letter recognition of the present invention.

[0027] Figure 2 A diagram illustrating the segment and adjacent segments.

[0028] Figure 3 This is an illustration of the letter “B”. In the figure, 1 is the connected domain, and 2 is the hole.

[0029] Figure 4This is a diagram illustrating the connected domains and holes of letters "A", "D", "O", "P", "Q" and "R". In the figure, 1-connected domain, 2-hole.

[0030] Figure 5 This is a schematic diagram for identifying the letters "A", "D", "O", "P" and "R".

[0031] Figure 6 A diagram illustrating the connected domain and holes of the letter "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "S", "T", "U", "V", "W", "X", "Y" or "Z", where 1-connected domain, 2-hole.

[0032] Figure 7 A schematic diagram of the bounding rectangle, height, width, and adding a straight line at half the width of an alphabetic character image.

[0033] Figure 8 Schematic diagram of adding straight lines at half the width of the 19-letter character image with Euler number 1. In the figure, 1-connected domain, 2-hole.

[0034] Fig. 9 This is a schematic diagram for identifying the four letters S, E, F, and Z.

[0035] Fig.10 This is a schematic diagram for identifying the four letters L, C, G, and K.

[0036] Fig.11 Schematic diagram for identifying the number of segments at half the height of several letters.

[0037] Fig.12 This is a schematic diagram for identifying the three letters U, V, and Y.

[0038] Fig.13 This is a schematic diagram for identifying the two letters I and J.

[0039] Fig.14 This is a schematic diagram for identifying the three letters H, X, and T. DETAILED DESCRIPTION

[0040] The present invention will be further described in detail below in conjunction with the accompanying drawings.

[0041] The object of the present invention is to provide a method for recognizing alphabetic characters based on computer vision:

[0042] Step 1: The terminal converts the acquired character image into a binary image;

[0043] Step 2: sequentially scan the pixels of the image and record the corresponding segment number and the adjacent segment number;

[0044] Step 3: Calculate the Euler number E of the image and classify it;

[0045] Step 4: For character images with the same Euler number, perform letter image recognition based on the number of segments at different positions of the character image, the ratio of the character image height to width, and the number of holes in the new image after adding a horizontal line with the same foreground color at a specific height or width position of the image.

[0046] For step 1: the terminal converts the obtained character image into a binary image. Figure 1 The specific process is as follows: first, the collected single-character image is preprocessed. Common preprocessing methods include image conversion from color to grayscale, image filtering and denoising, and binarization, etc., to obtain a binary image with M rows and N columns, and then the image is subjected to letter recognition. The single-character image is obtained by character segmentation of the collected Times New Roman letter string image. The present invention only recognizes and distinguishes English characters in this format.

[0047] When converting the original color image to a grayscale image, the maximum value method is used to ensure that a grayscale image with greater brightness is obtained. The maximum value method means that the grayscale value of each pixel in the converted image is the maximum value of the R, G, and B components of the pixel in the original color image, where R represents the value of the red component in the original color image, G represents the value of the green component in the original color image, and B represents the value of the blue component in the original color image.

[0048] Filtering can reduce the noise caused by interference such as light, and play a role in enhancing image features. The specific method is: starting from the first pixel in the upper left corner of the image, use the filter window to scan each pixel from left to right and from top to bottom, and use the median of the grayscale values ​​of each point in the window to replace the grayscale value of the pixel at the center of the window. The present invention uses a filter window of 3×3 pixels to enhance the 256-color grayscale image to eliminate fine texture details and noise pixels.

[0049] The enhancement process of the 256-color grayscale image before binarization is to perform histogram equalization on the obtained grayscale image. Histogram equalization is one of the methods of image histogram enhancement. This method will count the number of pixels of each grayscale value, and draw a graph of the number of pixels-grayscale value based on this, so as to obtain a new image with a uniform distribution of grayscale histogram. The grayscale distribution area is uniform, the grayscale spacing of the pixels occupied by the image is enlarged, the image contrast is increased, and the image visual effect is improved, thereby achieving an enhancement effect.

[0050] The specific steps are to first calculate the histogram of the original image, and then deduce the histogram cumulative distribution curve based on it. The curve and the grayscale level of the image are combined to form a transformation function, and the image grayscale is transformed to achieve the enhancement effect.

[0051] When binarizing an image, a suitable threshold is selected. Since the foreground and background are generally clearly distinguished in Times New Roman character images, the present invention uses the histogram of the grayscale image and selects the grayscale value of the trough as the binarization threshold.

[0052] The Euler number of an image is defined as the number of connected domains in the image minus the number of holes in the image. For the segmented character images, the number of connected domains is 1, but the letters "A", "D", "O", "P", "Q", and "R" have one hole, so the Euler number is 0; the letters "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "S", "T", "U", "V", "W", "X", "Y", or "Z" have no holes, so the Euler number is 1; the letter "B" has two holes, so the Euler number is -1. In addition to using the definition, the Euler number of an image can also be calculated based on the number of segments contained in the image and the number of adjacent segments.

[0053] For step 2: sequentially scan the pixels of the image and record the corresponding number of segments, number of adjacent segments, and segment length. Specifically, sequentially scan the mth row of the image (m=1, 2...M), record the number of segments in the mth row and the number of adjacent segments formed with the m-1th row of segments;

[0054] For step 3: calculate the Euler number E of the image and classify it. Specifically, after the image is scanned, the total number of segments NR and the total number of adjacent segments NBR contained in the image can be obtained, and the Euler number E of the image is calculated using the formula E=NR-NBR;

[0055] See also Figure 2 In this figure, there are 3 segments in the first row and 3 segments in the second row, and the total number of segments is 6; the number of adjacent segments is 4 (marked with ovals). Figure 2 , the Euler number of the image E = 3 + 3 - 4 = 2.

[0056] After the above steps to obtain the Euler number of the character image, the following judgment is made:

[0057] (1) See Figure 3 , if the Euler number of the character image is -1, then the character is the letter "B";

[0058] (2) See Figure 4 , if the Euler number of the character image is 0, then the character may be the letter "A", "D", "O", "P", "Q", "R";

[0059] (3) See Figure 6 , if the Euler number of a character image is 1, then the character may be the letter "C", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "S", "T", "U", "V", "W", "X", "Y", or "Z".

[0060] For cases (2) and (3), identification requires methods such as the number of segments at different positions of the character image, the ratio of the character image height to width, and the number of holes in the new image after adding a horizontal line with the same foreground color at a specific height or width position of the image.

[0061] (4) If the image Euler number is not -1, 0, or 1, the image content is not letters in Times New Roman format.

[0062] For step 4: for character images with the same Euler number, letters of the character images are recognized based on the number of segments at different positions of the character image, the ratio of the character image height to width, and the number of holes in the new image after adding a horizontal line with the same foreground color at a specific height or width position of the image.

[0063] Specifically, Figure 5 As shown, for the letter "Q", the character image height and width (height and width diagram see Figure 7 ) is not close to 1:1, and is in the special range of 1.35 to 1.36.

[0064] For the letters "A", "P", "D", "O", and "R", the segment at 0.35 times the character image height is 1 for "A" and "P", and 2 for "D", "O", and "R". Let's discuss in groups:

[0065] (i) A, P: In the segment at 0.2 times the height of the character image, the letter "A" is 2 and the letter "P" is 1;

[0066] (ii) D, O, R: In the segment at 0.49 times the height of the character image, the letter R is 1, and the letters D and O are 2. Continue to determine the number of segments at 0.22 times the width of the character image, the letter D is 1, and the letter O is 2.

[0067] like Figure 8 As shown, for the remaining 19 letters, first add a straight line with the same foreground color at half the width of the image, and the height is not shorter than the image height. This straight line and the original image form a new image, and continue to determine the number of holes in the new image. (The new letter image below is uniformly represented by the shape of X'). There are three cases:

[0068] (1) Fig. 9 :The number of holes of E', F', S', and Z' are all 2. Continue to judge the number of segments at 0.63 times the original character image height. Z and S are 1, and F and E are 2. Then judge by groups. For the letters S and Z, continue to judge the number of segments at 0.06 times the character image width. The letter S is 2 and Z is 1. For the letters F and E, continue to judge the number of segments at 0.14 times the character image height. The letter E is 2 and F is 1.

[0069] (2) Fig.10 : The number of holes of C', G', L', and K' are all 1. Continue to judge the number of segments at 0.30 times the original character image height. The letters C and L are 1, and the letters G and K are 2. For C and L, judge the number of segments at 0.81 times the character image height. L is 1 and C is 2. For G and K, judge the number of segments at 0.63 times the character image height. G is 1 and K is 2.

[0070] (3) Fig.11 :N', M', W', I', J', H', T', X', U', V', Y'hole numbers are all 0. Continue to determine the number of segments at half the height of the original character image. For the letter N, the number of segments at half the height is 3; for the letters M and W, the number of segments is 4. Continue to determine the number of segments at 0.14 times the height of the character image. The letter M is 3 and the letter W is 2.

[0071] like Fig.12 : For the letters U, V, and Y, the number of segments at half the height is 2. Continue to determine the number of segments at 0.15 times the character image height. The letter U is 2, while V and Y are both 1. Continue to determine the number of segments at 0.33 times the character image height. Y is 1 and V is 2.

[0072] For the letters I, J, H, T, and X, the number of half-height image segments is 1, and the ratio of the character image height to width is determined.

[0073] like Fig.13 : For the letters I and J, the ratio of height to width is not close to 1:1. In the special range of 1.80-2.50, the number of segments at 0.15 times the height of the character image is further determined. The letter J is 2, while the letter I is 1;

[0074] like Fig.14 : For the last three letters H, T, and X, continue to determine the number of segments at 0.35 times the height of the character image. T is 1, and H and X are both 2. Continue to determine the number of segments at 0.22 times the width of the character image. The letter X is 2, and H is 1.

Claims

1. A method for letter text recognition based on computer vision, characterized in that: The steps include: Step 1: Get the English character image and convert it into a binary image; Step 2: Scan the pixels of the binary image from left to right and from bottom to top and record the corresponding number of segments, number of adjacent segments, and segment length: Step 3: Calculate the Euler number E of the binary image and classify it: Step 4: For character images with the same Euler number, the number of holes in the new image is determined based on the number of segments at different positions of the binary image, the ratio of the character image height to width, and the addition of a straight line with the same foreground color at a specific width position of the image, and then the letter recognition of the character image is performed; The Euler number E of the image is calculated and classified in step 3 as follows: after the image is scanned, the number of image segments NR and the number of adjacent image segments NBR are accumulated, the Euler number E of the image is calculated using the formula E=NR-NBR, and the character image is classified according to the Euler number of the image; In step 4, for character images with the same Euler number, letter recognition is performed according to the number of segments at different positions of the character images, specifically: When the calculated Euler number is -1, the character is judged to be the letter "B" and the recognition ends; When the calculated Euler number is not 1, further judgment is made. When the calculated Euler number is 0, the character corresponds to six letters: A, D, O, P, Q or R. The ratio of the character image height to width, the image height multiples of 0.20, 0.35, 0.49, and the number of image segments with an image width multiple of 0.22 are further calculated. When the calculated Euler number is not -1 and 0, further judgment is made. When the calculated Euler number is 1, the character corresponds to 19 letter images: C, E, F, G, H, I, J, K, L, M, N, S, T, U, V, W, X, Y or Z. A straight line not shorter than the character image height is added at half the width of these images, and combined with the original image to form a new image with the same color as the foreground color of the character image. The number of holes in these new images is continued to be calculated and classified. At the same time, the ratio of the height to the width of the original character image is calculated, and the number of segments at half the height, half the width, and multiples of the image height of 0.06, 0.14, 0.15, 0.30, 0.33, 0.35, 0.63, 0.81, and multiples of the image width of 0.14 and 0.22 are further judged. When the calculated Euler number is not -1, 0 or 1, the image content is not this type of alphabetic character and the recognition ends.

2. The method for letter text recognition based on computer vision according to claim 1, characterized in that: The English character image in step 1 is based on the Western font format "Times New Roman" commonly used in formal papers at this stage.

3. The method for letter text recognition based on computer vision according to claim 1, characterized in that: In step 1, the terminal converts the acquired character image into a binary image specifically as follows: the terminal performs operations of converting the acquired character image from color to grayscale, filtering and denoising the image, and binarizing the image to obtain a binary image of m rows and n columns.

4. The method for recognizing alphabetic text based on computer vision according to claim 1, characterized in that: In the step 2, the pixels of the image are sequentially scanned and the corresponding number of segments, the number of adjacent segments and the length of the segments are recorded. Specifically, the pixels of the mth row or nth column (m=1, 2, ..., M) of the image are sequentially scanned, the number of segments of the mth row (or nth column) and the number of adjacent segments formed by the segments of the m-1th row (or n-1th column) are recorded, and the ratio of the height to the width of the image, as well as the number of segments at half the height and at a specific height or width multiple of the letter image are recorded.

5. The method for letter text recognition based on computer vision according to claim 1, characterized in that: The multiple of the image width in step 4 refers to the ratio of the sequence number of the image segment pixel column at a specific position to the total width m of the circumscribed rectangle of the alphabetic character image, with the positive direction from left to right.

6. The method for letter text recognition based on computer vision according to claim 1, characterized in that: In step 4, adding a straight line with the same foreground color at a specific height or width position of the image to determine the number of holes in the new image means adding a straight line that is not shorter than the height of the character image at half the width of the image, and combining it with the original image to form a new image with the same color as the foreground color of the character image. The number of holes in the new image will be used as a new method of distinction.

7. The method for letter text recognition based on computer vision according to claim 1, characterized in that: The ratio of the character image height to width in step 4 refers to the ratio of the height to width of the circumscribed rectangle of each image.

8. The method for letter text recognition based on computer vision according to claim 1, characterized in that: The image segment refers to a single or multiple target pixels separated by the background or image boundary in each row of the binary image.

Citation Information

Patent Citations

  • Method for binarizing scanned document images containing gray or light colored text printed with halftone pattern

    CN102592126A

  • RMB serial number recognition method based on computer vision

    CN106710063A