Method for recognizing black body in text image
Patent Information
- Application Number
- CN202211329072.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2042-10-27
AI Technical Summary
目前的实现方法分为两种,一种是分割得到每个字符,提取当前字符的特征,与目标字体的特征进行匹配识别;另一种是通过文本检测得到的文本行,通过识别模型或者判断该行与其他文本行之间的区别,从而确定该行的文字属于哪一种字体,这种方法无法精确定位一行中部分存在黑体的情况
[0015]The above-mentioned method for identifying bold text in text images divides the text image into multiple text lines and then divides each text line into multiple regions at equal intervals. It then captures the relative features of different characters within each image and uses a Softmax classifier to determine whether the regions are bold text. Furthermore, it determines the location of the bold text by identifying the connected components between the regions. This method can effectively identify bold text in text images.
Smart Images

Figure CN115909360B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text detection and recognition technology, and in particular to a method for recognizing boldface text in images. Background Technology
[0002] In book font recognition, the current focus is more on identifying font categories, such as Song or Kai. Current implementation methods fall into two categories: one is to segment each character, extract its features, and match them with the features of the target font; the other is to obtain text lines through text detection, and then determine the font of the text in that line by using a recognition model or judging its differences from other text lines. However, this method cannot accurately locate cases where a line contains parts of boldface.
[0003] Furthermore, since bold is a relative concept, it is difficult to determine whether a text is bold based on a single text. It is necessary to compare the font of a line or the surrounding text to determine whether it is bold. Therefore, the two techniques mentioned above cannot accurately determine whether a text is bold. Summary of the Invention
[0004] Therefore, it is necessary to provide an effective method for identifying bold text in text images to address the aforementioned technical problems.
[0005] A method for recognizing boldfaces in text images, the method comprising: Extract the text lines from the text image and divide the text lines into multiple regions at equal intervals; Capture the relative features of different characters within each text image; Determine whether the above region is a black body region; if so, then... The position of the bold text is determined by finding the connected components between the regions.
[0006] In one embodiment, obtaining the text line of the text image includes: Extract all text lines from a text image using an OCR detection model.
[0007] In one embodiment, dividing the text line into multiple regions at equal intervals includes: Adjust the text line to a fixed height and divide the text line into multiple regions with equal spacing. These regions include blank areas, text areas, and bold areas.
[0008] In one embodiment, capturing the relative features of different characters within each image includes: Capture the relative features of different characters within the same image; Capture the relative features of text within different images; The black body region is identified using the Softmax classifier.
[0009] In one embodiment, determining the position of the bold text by finding the connected components between the regions includes: The position of a single bold character is determined by finding the connected components between the regions; The position of a boldface character is determined by finding the connected components between different boldface characters.
[0010] In one embodiment, the method further includes: Extract the bold text content using an OCR recognition model; Output the position and content of the bold text.
[0011] In one embodiment, the method further includes: Perform semantic checks on the output bold text to determine if there are any errors. If not, then... Output the bold text as the correct bold text; if so, then... Extract the characters from the line preceding to the line following the given bold text.
[0012] In one embodiment, the step of extracting the characters from the line preceding to the line following the position of the bold text content further includes: Add the character before or after the erroneous bold text in sequence; Determine if the bold text after adding the characters still contains semantic errors; if not, then... Output the bold text as the correct bold text; if so, then... Add the character before or after the bold text again; Determine whether the bold text after adding characters still contains semantic errors.
[0013] In one embodiment, the step of performing semantic checks on the output bold text to determine whether errors exist includes, prior to: Pre-stored text images include related words and technical terms.
[0014] In one embodiment, the pre-stored text image, including related words and technical terms, further includes: Compare the bold text content with a single related word or technical term in a pre-stored text image, or compare the bold text content with a combination of multiple related words or technical terms in a pre-stored text image.
[0015] The above-mentioned method for identifying bold text in text images divides the text image into multiple text lines and then divides each text line into multiple regions at equal intervals. It then captures the relative features of different characters within each image and uses a Softmax classifier to determine whether the regions are bold text. Furthermore, it determines the location of the bold text by identifying the connected components between the regions. This method can effectively identify bold text in text images. Attached Figure Description
[0016] Figure 1 This is a step diagram of a text image boldface recognition method according to an embodiment of this application; Figure 2 This is a partial step diagram of a text image boldface recognition method according to another embodiment of this application; Figure 3 This is another part of the steps of the text image boldface recognition method according to another embodiment of this application; Figure 4 This is a schematic diagram illustrating the process of determining the position of a black body through connected components in a text image black body recognition method according to an embodiment of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] It should be noted that when a component is referred to as being "fixed to" or "set on" another component, it can be directly on the other component or there may be an intermediate component. When a component is considered to be "connected to" another component, it can be directly connected to the other component or there may be an intermediate component present. The terms "vertical," "horizontal," "upper," "lower," "left," "right," and similar expressions used in this application's specification are for illustrative purposes only and do not represent the only possible implementation.
[0019] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0020] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature and the second feature are in indirect contact through an intermediate medium. Furthermore, "above," "over," and "on top" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0021] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used in this application includes any and all combinations of one or more of the associated listed items.
[0022] like Figure 1 As shown, in one embodiment, a method for recognizing bold text in an image includes the following steps: Step S110: Obtain the text lines of the text image and divide the text lines into multiple regions at equal intervals.
[0023] Specifically, such as Figure 4 As shown, a line of text in a text image is divided into multiple regions at equal intervals, i.e., multiple small blocks in the image.
[0024] Step S120: Capture the relative features of different characters within each image.
[0025] Specifically, considering that the boldface is relative to other fonts in a book, this embodiment uses a dual-attention module to capture features and thus determine the differences between the characters.
[0026] Step S130: Determine whether the above area is a black body region. If so, execute... Specifically, the relative features of each character captured by the aforementioned dual attention mechanism module are used to determine the bold area through a Softmax classifier.
[0027] Step S140: Determine the position of the bold text by finding the connected components between the regions.
[0028] Specifically, a connected component is an image region consisting of foreground pixels with the same pixel value and adjacent positions; in other words, it's the same region with similar pixel values. Once the connected components between regions are determined, it can be determined whether the regions belong to the same connected component. The position of the boldface can be determined by distinguishing it from other fonts.
[0029] The above-mentioned method for identifying bold text in text images divides the text image into multiple text lines and then divides each text line into multiple regions at equal intervals. It then captures the relative features of different characters within each image and uses a Softmax classifier to determine whether the regions are bold text. Furthermore, it determines the location of the bold text by identifying the connected components between the regions. This method can effectively identify bold text in text images.
[0030] like Figure 2 and Figure 3 As shown, in one embodiment, a method for recognizing bold text in an image includes the following steps: Step S210: Extract all text lines from the text image using an OCR (Optical Character Recognition) detection model.
[0031] OCR refers to the process of scanning text documents and then analyzing and processing image files to obtain text and layout information.
[0032] Step S220: Adjust the text line to a fixed height and divide the text line into multiple regions with equal spacing. These regions include blank areas, text areas, and bold areas.
[0033] Specifically, since the layout or font size of different text images may vary, the height of the text line images is fixed to the same height, thereby unifying the text font size and ensuring that each area contains one character. For consecutive letters, numbers, or formulas, multiple letters, numbers, or formulas located in the same area are considered as one character.
[0034] Step S230: Capture the relative features of different characters within the same image.
[0035] Specifically, a global attention mechanism (wide-channel attention mechanism) is first calculated on each image, which can better capture the relative features of different texts within the same image.
[0036] Step S240: Capture the relative features of text within different images.
[0037] Specifically, a global attention mechanism is then applied to all images in a batch of input images to better capture the relative features of text within different images.
[0038] Step S250: Identify the black body region using the Softmax classifier.
[0039] Step S260: Determine whether the above area is a black body region. If so, execute... Specifically, by combining the wide-channel attention mechanism and the batch-channel attention mechanism mentioned above, the relative features of each character can be captured, and then the Softmax classifier can be used to determine whether it is a bold text region.
[0040] It should be noted that an LSTM temporal model can be added after the final dual attention mechanism to better capture the correlation between adjacent small blocks, and the final output result is as follows. Figure 4 As shown in the first line, you can see whether each small block is bold (the left part is not bold, and the characters in the two rightmost areas are bold). Step S270: Determine the position of a single bold character by finding the connected components between the regions.
[0041] Specifically, such as Figure 4 As shown, the first line is a text line indicating whether each region is a bold text, and the second line is a text line indicating the position of the bold text character after searching for connected components.
[0042] Step S280: Determine the position of the bold characters by finding the connected components between different bold characters.
[0043] Specifically, Figure 4 The third line is the text line whose position is obtained by searching for connected components twice.
[0044] Step S290: Extract the bold text content using an OCR recognition model.
[0045] Specifically, OCR can extract text information from text images.
[0046] Step S2100: Output the position and content of the bold text.
[0047] Specifically, the text images from which the boldface characters are extracted usually belong to a specific profession or field. Therefore, the characters or titles used are mostly the same or similar, that is, they all use certain nouns or characters or a combination of nouns and characters from that profession or field. Therefore, after outputting the position and content of the boldface, the text of the boldface can be checked to determine whether the extracted boldface is correct.
[0048] Step S2110: Pre-store relevant words and technical terms for the text image.
[0049] Specifically, a professional or field-specific thesaurus is established based on the profession or field described in the text image. The content of this thesaurus is continuously added during the execution of the method, or added directly from relevant searches on the network.
[0050] Step S2120: Compare the bold text content with a single related word or technical term in the pre-stored text image, or compare the bold text content with a combination of multiple related words or technical terms in the pre-stored text image.
[0051] Specifically, if the bold text consists of multiple nouns, the bold text is split into parts, and each part is searched separately. Then, the professional terms obtained from the search are compared with the bold text to determine their similarity.
[0052] Step S2130: Perform a semantic check on the output bold text to determine if there are any errors. If not, proceed with... Specifically, the professional terms or combinations thereof obtained from the search are compared with those in bold to determine whether they are consistent.
[0053] Step S2140: Output the bold text as the correct bold text; if so, then... Step S2150: Extract the characters from the line before and after the position of the bold text.
[0054] Specifically, to avoid problems with boldface recognition, a second check is required. First, extract the characters from the line before to the line after the problematic boldface to ensure that even if there are unrecognized parts, the unrecognized boldface can be included in the newly extracted line.
[0055] Step S2160: Add the character before or after the erroneous bold text in sequence.
[0056] Specifically, if a portion of the bold text is not identified, it must be located in a position adjacent to the extracted bold text.
[0057] Step S2170: Determine whether the bold text after adding the characters still contains semantic errors. If not, proceed. Step S2140: Output the bold text as the correct bold text; if so, then... Step S2180: Add the character before or after the bold text again.
[0058] Then repeat steps S2160 and S2170 until there are no errors in the bold text.
[0059] The aforementioned method for identifying bold text in images divides the text image into multiple lines, and then further divides each line into equally spaced regions to correspond to individual characters. A dual-attention mechanism is then used to capture the relative features of different characters within each image. A Softmax classifier is used to determine whether a region is bold. Furthermore, the location of the bold text is determined by identifying the connected components between these regions. This method effectively identifies bold text in text images. Since bold text regions often represent key information, titles, or chapter information in books, this method can assist in acquiring key knowledge points and plays a crucial role in the structured recognition of book content. By checking for errors in the bold text, mistakes in bold text recognition can be avoided.
[0060] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0061] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method for recognizing boldfaces in text images, characterized in that, The method includes: Extract the text lines from the text image and divide the text lines into multiple regions at equal intervals, including: Adjust the text line to a fixed height and divide the text line into multiple areas with equal spacing. These areas include blank areas, text areas, and bold areas. Capture the relative features of different characters within each image, including: Capture the relative features of different characters within the same image; Capture the relative features of text within different images; The black body region is identified using the Softmax classifier; Determine whether the above region is a black body region; if so, then... The position of the bold text is determined by finding the connected components between the regions; Extract the bold text content using an OCR recognition model; Output the bold text; Perform semantic checks on the output bold text to determine if there are any errors. If not, then... Output the bold text as the correct bold text; if so, then... Extract the characters from the line preceding to the line following the position of the bold text; Add the character before or after the erroneous bold text in sequence; Determine if the bold text after adding the characters still contains semantic errors; if not, then... Output the bold text as the correct bold text; if so, then... Add the character before or after the bold text again; Determine whether the bold text after adding characters still contains semantic errors.
2. The method for recognizing boldfaces in text images according to claim 1, characterized in that, The acquisition of text lines from the text image includes: Extract all text lines from a text image using an OCR detection model.
3. The method for recognizing boldfaces in text images according to claim 1, characterized in that, The method of determining the position of the bold text by finding the connected components between each region includes: The position of a single bold character is determined by finding the connected components between the regions; The position of a boldface character is determined by finding the connected components between different boldface characters.
4. The method for recognizing boldfaces in text images according to claim 1, characterized in that, Before performing semantic checks on the output bold text to determine if errors exist, the process also includes: Pre-stored text images include related words and technical terms.
5. The method for recognizing boldfaces in text images according to claim 4, characterized in that, The pre-stored text image includes related words and technical terms, and then further includes: Compare the bold text content with a single related word or technical term in a pre-stored text image, or compare the bold text content with a combination of multiple related words or technical terms in a pre-stored text image.
Citation Information
Patent Citations
Underlined text image preprocessing method and device
CN102446274A
Method for acquiring first-appearing aviation keywords based on multi-head self-attention model
CN114462406A
Character recognition device, character recognition method, and image forming device
JP2019012440A