A text line character recognition rate optimization method and computer readable storage medium

By constructing and matching graph models, the character recognition process was optimized, which solved the problem of low recognition accuracy caused by background pattern interference and font rotation and tilt, and improved the accuracy of character recognition.

CN117197812BActive Publication Date: 2025-11-04SHENZHEN HUAHAN WEIYE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311001311.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-08
Publication Date
2025-11-04
Estimated Expiration
2043-08-08

AI Technical Summary

Technical Problem

Existing character recognition methods suffer from problems such as multiple character recognition and misrecognition when faced with background pattern interference, font rotation and tilt during printing, etc., resulting in low recognition accuracy.

Method used

By constructing an initial structural graph model, dividing it into sub-graph models, and constructing a standard structural graph model based on the input text structure information, the graph model is used for isomorphic graph matching to optimize the character recognition process.

Benefits of technology

It improves the accuracy of character recognition, especially in complex environments and texts with fixed structures, enhancing the accuracy of recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117197812B_ABST
    Figure CN117197812B_ABST
Patent Text Reader

Abstract

A text line character recognition rate optimization method and a computer readable storage medium, the method comprising: constructing an initial structure graph model for each text line of a text image, the nodes of the initial structure graph model recording character recognition data of characters in the text line, and then dividing the initial structure graph model of each text line into a plurality of sub-graph models according to nodes where separator characters are located; constructing a standard structure graph model according to input text structure information, matching an isomorphic graph of the standard structure graph model in the sub-graph model, and taking characters corresponding to the isomorphic graph as optimal character recognition results matched with the input text structure information. Since graph modeling and isomorphic graph matching are used, and characters corresponding to the isomorphic graph are taken as optimal character recognition results matched with the input text structure information, the character recognition accuracy in a complex environment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image processing, and particularly relates to a text line character recognition rate optimization method and a computer readable storage medium. BACKGROUND

[0002] In recent years, visual recognition is applied more and more widely in various industries, and character recognition is one of the important scenarios. Generally, the character recognition method usually has two stages of character segmentation and character recognition. However, in actual application scenarios, there are factors such as background pattern interference, font printing rotation and inclination. The general character recognition method often has multiple recognition and misrecognition of characters when facing the above scenarios. Therefore, it is necessary to improve the existing technology to improve the accuracy of character recognition. SUMMARY

[0003] The technical problem solved by the present application is to improve the accuracy of character recognition of text images.

[0004] According to a first aspect, a text line character recognition rate optimization method is provided in an embodiment, comprising:

[0005] obtaining a text image;

[0006] performing character segmentation and character recognition on the text image to obtain character recognition data of each character, the character recognition data at least including a character recognition result;

[0007] respectively constructing an initial structure graph model for each text line of the text image, wherein the step of constructing the initial structure graph model comprises: sequentially traversing all characters of the current text line, establishing a node with the current character in the traversal process, recording the character recognition data of the current character in the node, and if there are also characters before the current character, establishing an edge between the established node and the node where the preset number of characters before the current character are located, and the direction of the edge is from the node where the characters before the current character are located to the established node;

[0008] dividing the initial structure graph model of each text line into a plurality of sub-graph models according to the node where the separation character is located;

[0009] receiving input text structure information, constructing a standard structure graph model according to the text structure information, the text structure information including the number n of text characters to be matched and the character type of each character, and the standard structure graph model including n nodes, each node only having edges with left and right adjacent nodes, the direction of the edge being from the left node to the right node, and the i-th node recording the character type of the i-th character;

[0010] matching the isomorphic graph of the standard structure graph model in the sub-graph model, and taking the characters corresponding to the isomorphic graph as the optimal character recognition result matched with the text structure information.

[0011] In one embodiment, if there are characters before the current character, an edge is established between the established node and the node where the preset number of characters before the current character are located, including: if there is only one character before the current character, an edge is established between the established node and the node where the character is located; if there are more than one character before the current character, an edge is established between the established node and the nodes where the first two characters before the current character are located.

[0012] In one embodiment, the character recognition data further comprises character segmentation regions; and the length of an edge in the initial structure graph model is the distance between two nodes, wherein the distance between two characters is the minimum distance of the circumscribed rectangle of the character segmentation regions of the two characters.

[0013] In one embodiment, the text line character recognition rate optimization method further comprises: before the initial structure graph model of each text line is divided into several sub-graph models according to the node where the separation character is located, all edges of the initial structure graph model are traversed, and edges with a length greater than a distance threshold T are deleted.

[0014] In one embodiment, the distance threshold T is determined by the following steps:

[0015] Excluding the separation characters in the text line, all characters in the text line are sequentially traversed, the distances between all adjacent characters are calculated, and a distance set is obtained where di represents the i-th distance value, and N represents the total number of distance values. i

[0016] According to the distance set , a histogram of the distances between characters is calculated where c represents the total number of groups of the histogram, and Cj represents the frequency of the j-th group. j

[0017] The histogram is smoothed to obtain a distance curve, and a sub-pixel maximum value position p of the distance curve is calculated extrem .

[0018] According to the minimum value d min , the standard deviation d std , and the sub-pixel maximum value position p extrem of the distance set , the distance threshold T is calculated.

[0019] In one embodiment, the histogram of the distances between characters is calculated according to the distance set , including: calculating the minimum unit distance d of quantization of the histogram of the distances between characters max and d mean ​​Distance sets Calculate the maximum and average values; calculate the total number of groups. The histogram is initialized to 0; the distance set is traversed. For each distance value d i Calculate h i =(d i -d min ) / d size ,Will Add 1;

[0020] The distance threshold T is determined by the following formula:

[0021] T = d min +d size ×p extrem +2×d std .

[0022] In one embodiment, dividing the initial structural graph model of each text line into several sub-graph models based on the node where the separator character is located includes:

[0023] Find the node containing the separator character in the initial structural graph model, and all nodes connected to the node containing the separator character. Where v i V represents the i-th node connected to the node containing the separator character, and V represents the total number of nodes connected to the node containing the separator character.

[0024] Delete all edges connected to the node containing the separator character. The longest edge between nodes yields the partitioned subgraph model.

[0025] In one embodiment, matching the isomorphic graph of the standard structural graph model in the subgraph model includes:

[0026] Create an m×n matrix M and initialize all elements to 1, where m is the number of nodes in the subgraph model, and m≥n;

[0027] For any node in the subgraph model and any node of the standard structural diagram model like and If the first preset condition and / or the second preset condition are met, then M[i,j] is assigned the value -1, where the first preset condition refers to... The character recognition results are not included in The character type in the second preset condition refers to the character type in the second preset condition. The number of connected edges is less than that of the number of connected edges. The number of connected edges or the One of the connected edges cannot be connected to... Find the edges with the same direction among the connected edges. The superscripts i and j represent the indices of the nodes in the subgraph model and the standard structural graph model, respectively, i∈[0,m-1], j∈[0,n-1].

[0028] If neither the first nor the second preset condition is met, then the judgment is... Connected edges and Check if the connected edges are a complete match. If they are, then obtain the matched node pairs. and Let M[k1,l1] = M[k1,l1]+1, M[k2,l2] = M[k2,l2]+1, where and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match;

[0029] If with Connected edges and If the connected edges do not completely match, then for each matching scenario, obtain the matching node pairs under that scenario. and according to and Length of the side between and Length of the side between and Length of the side between as well as and Length of the side between Calculate the first increase value E1 and the second increase value E2, let

[0030] M[k x ,l x ]=M[k x ,l x ]+E1,M[k y ,l y ]=M[k y ,l y +E2,

[0031] in and denote two nodes connected with node , and denote two nodes connected with node , and , and match the edges between and , and match the edges between and

[0032] .

[0033] In one embodiment, the character recognition data further comprises character recognition scores, the text structure information further comprises lower bounds of character recognition scores of each character, and the i-th node of the standard structure graph model records the lower bound of the character recognition score of the i-th character; and the matching of the isomorphic graph of the standard structure graph model in the sub-graph model comprises:

[0034] An m*n matrix M is established and all elements are initialized to 1, where m is the number of nodes of the sub-graph model, m≥n;

[0035] For any node of the sub-graph model and any node of the standard structure graph model, and satisfy the first preset condition and / or the second preset condition and / or the third preset condition, M[i,j] is assigned a value of -1, where the first preset condition means that the character recognition result in is not contained in the character type in , the second preset condition means that the number of edges connected with is less than the number of edges connected with or one of the edges connected with cannot find an edge with the same direction in the edges connected with , and the third preset condition means that the character recognition score in is less than the lower bound of the character recognition score in , and the superscripts i and j represent the indexes of the nodes in the sub-graph model and the standard structure graph model respectively, i∈[0,m-1] and j∈[0,n-1];

[0036] If the first preset condition, the second preset condition and the third preset condition are not satisfied, it is determined whether the edges connected with match the edges connected with Check if the connected edges are a complete match. If they are, then obtain the matched node pairs. and Let M[k1,l1]=M[k1,l1]+1, M[k2,l2]=M[k2,l2]+1, where and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match;

[0037] If with Connected edges and If the connected edges do not completely match, then for each matching scenario, obtain the matching node pairs under that scenario. and according to and Length of the side between and Length of the side between and Length of the side between as well as and Length of the side between Calculate the first increase value E1 and the second increase value E2, let

[0038] M[k x ,l x ]=M[k x ,l x ]+E1,M[k y ,l y ]=M[k y ,l y +E2,

[0039] in and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match;

[0040] Based on matrix M, nodes corresponding to each node of the standard structural graph model are selected from the subgraph model to obtain the isomorphic graph.

[0041] In one embodiment, the first increase value and the second increase value are determined by the following formula:

[0042]

[0043] In one embodiment, the step of selecting nodes corresponding to each node of the standard structural graph model from the subgraph model based on matrix M to obtain the isomorphic graph includes:

[0044] According to the objective function Obtain nodes in the subgraph model corresponding nodes Where i(j) represents the node The index of the corresponding node, j p and j q This represents the two possible values ​​for index j;

[0045] Node set The resulting graph serves as the isomorphic graph.

[0046] According to a second aspect, one embodiment provides a computer-readable storage medium storing a program that can be executed by a processor to implement the text line character recognition rate optimization method of any of the above embodiments.

[0047] According to the text line character recognition rate optimization method of the above embodiments, firstly, an initial structure graph model is constructed for each text line of the text image. The nodes of the initial structure graph model record the character recognition data of the characters in the text line. Then, the initial structure graph model of each text line is divided into several sub-graph models according to the nodes where the separating characters are located. Next, a standard structure graph model is constructed based on the input text structure information. The isomorphic graph of the standard structure graph model is matched in the sub-graph models, and the character corresponding to the isomorphic graph is taken as the optimal character recognition result that matches the input text structure information. Users can input the text structure information of certain texts with fixed structures (such as dates) as a reference for finding such texts in text images. Since graph models are used for modeling and isomorphic graph matching, the character corresponding to the isomorphic graph is taken as the optimal character recognition result that matches the input text structure information, thereby improving the character recognition accuracy in complex environments. Attached Figure Description

[0048] Figure 1 Flowchart of a text line character recognition rate optimization method according to an embodiment;

[0049] Figure 2 Initial structure graph model established for a text line according to an embodiment;

[0050] Figure 3 Flowchart of calculating distance threshold T according to an embodiment;

[0051] Figure 4 Sub-graph model obtained after partitioning the initial structure graph model shown in Figure 2

[0052] Standard structure graph model constructed according to a text structure information according to an embodiment; Figure 5

[0053] Flowchart of matching isomorphic graph of the standard structure graph model in the sub-graph model according to an embodiment; Figure 6

[0054] Case where one of the edges connected to Figure 7 cannot find an edge with consistent direction in the edges connected to according to an embodiment;

[0055] Schematic diagram of the case where the edge connected to Figure 8 and the edge connected to are completely matched;

[0056] Schematic diagram of the case where the edge connected to Figure 9 and the edge connected to are not completely matched;

[0057] Flowchart of matching isomorphic graph of the standard structure graph model in the sub-graph model according to another embodiment; Figure 10

[0058] Flowchart of a text correction step according to an embodiment; Figure 11

[0059] Schematic diagram of text image rotation; Figure 12

[0060] Schematic diagram of text skew; Figure 13

[0061] Flowchart of morphological processing of a text image to obtain a character block preliminary detection image and a background estimation image according to an embodiment; Figure 14

[0062] ​Figure 15 FIG. 1 is a flowchart illustrating a process of obtaining an initial estimation of a rotation angle of a text image according to an embodiment;

[0063] Figure 16 FIG. 2 is a flowchart illustrating a process of generating a sampling point array according to a rotation angle value to sample a character block detection image to obtain a gray scale projection result according to an embodiment;

[0064] Figure 17 FIG. 3 is a diagram illustrating a process of generating a sampling point array to sample a character block detection image to obtain a gray scale projection result according to an embodiment;

[0065] Figure 18 FIG. 4 is a flowchart illustrating a process of extracting a character edge region and a gradient amplitude angle image from a skew estimation image according to an embodiment. DETAILED DESCRIPTION

[0066] The present application will be further described by the detailed description in conjunction with the drawings. Like numerals indicate like elements in different embodiments. In the following embodiments, many specific details are described to provide a thorough understanding of the present application. However, one skilled in the relevant art will readily recognize that the

[0067] In addition, the features, operations or characteristics described in the specification can be combined in any appropriate manner to form various embodiments. Also, the steps or actions in the method description can be adjusted in sequence or modified in any appropriate manner that is apparent to those skilled in the art. Therefore, the various sequences in the specification and the drawings are only for clear description of an embodiment and do not mean that the sequence is necessary. Unless otherwise specified, the sequence must be followed.

[0068] In this document, the ordinal numbers for components, such as "first", "second", etc., are used only to distinguish the described objects, and do not have any sequential or technical meaning. Unless otherwise specified, "connected", "coupled" in this application includes direct and indirect connections (couplings).

[0069] In the embodiment of the present application, the user inputs the text structure information to be recognized in advance, and during execution, the text image is first subjected to character segmentation and character recognition, then all the segmented text lines are constructed into a graph model and subjected to subgraph division, the input text structure information is constructed into a standard structure graph model, and the subgraph and the standard structure graph model are matched, and finally the output structured character meeting the requirements is obtained. Through the pre-input structured information and the graph model, the overall character recognition rate of the text line in a complex scene is enhanced.

[0070] Please refer to Figure 1 The text line character recognition rate optimization method of an embodiment of the present application includes steps 100-600, which are described in detail below.

[0071] Step 100: Obtain a text image. It can be understood that the text image contains text composed of characters, which include but are not limited to numbers, Chinese and English characters, and punctuation marks, etc.

[0072] Step 200: Subject the text image to character segmentation and character recognition to obtain character recognition data of each character, which at least includes character recognition results.

[0073] The character segmentation and character recognition can be implemented by using the existing technology, which will not be described here. It can be understood by those skilled in the art that the character segmentation and character recognition can obtain character recognition results, and in some embodiments, the character segmentation region and the character recognition score can also be obtained, so in some embodiments, the character recognition data can also include the character segmentation region and the character recognition score, wherein the character recognition score represents the confidence of the character recognition result.

[0074] Step 300: Construct an initial structure graph model for each text line of the text image, respectively, wherein the step of constructing the initial structure graph model includes: sequentially traversing all the characters of the current text line, establishing a node with the current character in the traversal process, recording the character recognition data of the current character in the node, and if there are also characters before the current character, establishing an edge between the node established and the node where the preset number of characters before the current character are located, and the direction of the edge is from the node where the characters before the current character are located to the node established.

[0075] Here, the current text line refers to the text line currently being used to construct the initial structural graph model, and the current character is the character currently being traversed. If there are no other characters before the current character in the current text line, no edge creation operation is required. If other characters exist, edges are created between the created node and the nodes containing a preset number of characters preceding the current character. The preset number is set according to the actual situation. In one embodiment, if there is only one character before the current character, an edge is created between the created node and the node containing that character; if there is more than one character before the current character, an edge is created between the created node and the nodes containing the two characters preceding the current character. Figure 2 An initial structural graph model for establishing a text line in one embodiment is given.

[0076] In some embodiments, the length of the side is the distance between the characters of the two nodes, and when the character recognition data includes character segmentation regions, the distance between the characters is the minimum distance between the bounding rectangles of the character segmentation regions of the two characters.

[0077] Step 400: Divide the initial structure graph model of each text line into several subgraph models according to the node where the separator character is located.

[0078] The separator character is preset by the user and can include " / ", "\", "\\", ":", etc. The separator character is significant for dividing text and is used as one of the criteria for subgraph partitioning. Furthermore, if an edge is excessively long, it indicates that the edge may be abnormal. Therefore, in one embodiment, before partitioning the subgraph model based on the node containing the separator character, all edges of the initial structural graph model are traversed, and edges with a length greater than a distance threshold T are deleted. The distance threshold T can be set empirically or obtained through statistical methods. Please refer to [reference needed]. Figure 3 This application provides a method for calculating a distance threshold T in one embodiment, which is described in detail below.

[0079] Step 410: Exclude delimiters from the text line, sequentially traverse all characters in the text line, calculate the distance between all adjacent characters, and obtain the distance set. Where d i Let N represent the i-th distance value, and N represent the total number of distance values.

[0080] Step 420: Based on the distance set Histogram for calculating distances between characters Where c represents the total number of groups in the histogram, C j This represents the frequency of the j-th group.

[0081] Step 430: Smooth the histogram to obtain the distance curve, and calculate the sub-pixel maxima position p of the distance curve. extrem The sub-pixel maxima can be obtained by interpolating the distance curve, and the sub-pixel maxima location p is...extrem This refers to the x-coordinate of the sub-pixel maxima. Smoothing can be achieved using Gaussian smoothing or mean smoothing, while interpolation can be performed using parabolic interpolation or Lagrange interpolation.

[0082] Step 440: Based on the distance set The minimum value d min Standard deviation d std and sub-pixel maximum position p extrem The distance threshold T is calculated.

[0083] It is understandable that, based on the minimum value d min and sub-pixel maximum position p extrem This allows us to obtain the distance value with the highest probability of occurrence, and its standard deviation d. std This can be used to measure the degree of data deviation. When the distance value with the highest probability of deviation reaches a certain level, it is considered abnormal. Therefore, the minimum value d can be used as a reference. min Standard deviation d std and sub-pixel maximum position p extrem Calculate the distance threshold T, and consider edges with a length greater than the distance threshold T as abnormal edges (that is, data with excessive deviation).

[0084] In one embodiment, step 420 is based on the distance set. A histogram for calculating the distances between characters, including: the quantized minimum unit distance of the histogram for calculating the distances between characters. Where d max and d mean Distance sets Find the maximum and average values; then calculate the total number of groups. The histogram is initialized to 0; finally, the distance set is traversed. For each distance value d i Calculate h i =(d i -d min ) / d size ,Will Increment by 1, and after traversing all the data, the final histogram is obtained. In this implementation, the distance threshold T is determined by the following formula:

[0085] T = d min +d size ×p extrem +2×d std .

[0086] In one embodiment, the initial structure graph model of each text line is divided into several sub-graph models based on the node where the delimiter character is located. This includes: finding the node where the delimiter character is located in the initial structure graph model, as well as all nodes connected to the node where the delimiter character is located. where v i represents the ith node connected to the node where the separator character is located, V represents the total number of nodes connected to the node where the separator character is located; then delete all edges connected to the node where the separator character is located, delete the longest edge between the nodes, and obtain the divided sub-graph model.

[0087] Take the initial structure graph model shown in Figure 2 as an example, and the divided sub-graph model is as shown in Figure 4 For convenience of description, the upper P is denoted as P1, the lower P is denoted as P2, the left 2 is denoted as 21, and the right 2 is denoted as 22. Among them, the lengths of edges P1-21, P2-21 and P2-3 are greater than the distance threshold T, and therefore are deleted; / is a separator character, and the nodes connected thereto are 21, 3, 0 and 22, and therefore edges 21- / , 3- / , / -0 and / -22 are deleted, and the edge between nodes 21, 3, 0 and 22 is 21-3, 3-0 and 0-22, wherein 3-0 is the longest, and therefore is also deleted. Finally, three sub-graph models shown in Figure 4 are divided.

[0088] Step 500: receiving input text structure information, and constructing a standard structure graph model according to the text structure information, the text structure information including the number n of characters to be matched and the character type of each character, and the standard structure graph model including n nodes, each node only having edges with left and right adjacent nodes, the direction of the edge being that the left node points to the right node, and the ith node recording the character type of the ith character, wherein n is a positive integer, and the character type may be, for example, a number, a capital letter, a lowercase letter, etc., and the character type of each character may be a set including various character types allowed for the character.

[0089] The text structure information represents the information of the structured text, and the structured text can be matched from the text line using the text structure information. The structured text refers to some text with a fixed format, such as the date "2023 0605". The n nodes of the standard structure graph model correspond to n characters, and the left and right order of the nodes can be arranged according to the order of the characters in the text to be matched. In some embodiments, the text structure information further includes a lower limit of the character recognition score of each character in the text to be matched, and accordingly, the ith node of the standard structure graph model further records the lower limit of the character recognition score of the ith character. Figure 5 A standard structure graph model constructed according to a text structure information in an embodiment is given, and three nodes are taken as an example in the figure, but it does not mean that there can only be three nodes.

[0090] Step 600: matching a same structure graph of the standard structure graph model in the sub-graph model, and taking the characters corresponding to the same structure graph as the optimal character recognition result matched with the text structure information.

[0091] It should be noted that for the sub-graph model with the number of nodes less than the number of nodes of the standard structure graph model, matching is not needed. When matching the graph model, algorithms such as VF2 can be used. In order to improve the accuracy of matching, the application also provides a new method for matching the isomorphic graph of the standard structure graph model in the sub-graph model, please refer to Figure 6 The flow of matching the isomorphic graph of the standard structure graph model in the sub-graph model in an embodiment includes steps 611-617, which are described in detail below.

[0092] Step 611: Establish an m*n matrix M and initialize all elements to 1, where m is the number of nodes of the sub-graph model, m≥n.

[0093] Step 612: Traverse all nodes of the sub-graph model and the standard structure graph model, and for any node of the sub-graph model and any node of the standard structure graph model, determine and whether the first preset condition and / or the second preset condition is met, if yes, execute step 613, otherwise execute step 614.

[0094] The first preset condition means that the character recognition result in is not contained in the character type in , and the second preset condition means that the number of edges connected to is less than the number of edges connected to or one of the edges connected to cannot find an edge with the same direction in the edges connected to , and the superscripts i and j represent the indices of the nodes in the sub-graph model and the standard structure graph model, i∈[0,m-1], j∈[0,n-1]. For the case that one of the edges connected to cannot find an edge with the same direction in the edges connected to , please refer to Figure 7 , where node B1 is node B4 is There is an edge A4-B4 pointing to node B4 in the edges connected to node B4, and all the edges connected to node B1 are from node B1, so edge A4-B4 cannot find an edge with the same direction in the edges connected to node B1.

[0095] Step 613: Assign M[i,j] to -1.

[0096] Step 614: Determine whether the edges connected to and the edges connected to If the connected edges match completely, step 615 is performed, otherwise step 616 is performed.

[0097] Step 615: Obtain the matched node pair and Let

[0098] M[k1, l1] = M[k1, l1] + 1, M[k2, l2] = M[k2, l2] + 1,

[0099] wherein and denote two nodes connected with node , and denote two nodes connected with node , and the edges between and match the edges between and , and and match the edges between and

[0100] . Here, the two edges match means that the directions of the two edges are consistent. The case that the edge connected with Figure 8 matches the edge connected with may refer to , wherein node B1 is and node B2 is

[0101] Since the edges match completely, there is a unique matched node pair, i.e., {A1, C1} and {A2, C2}, the edge A1-B1 matches the edge A2-B2, and the edge B1-C1 matches the edge B2-C2. Step 616: Obtain the matched node pair in each matching case and According to the lengths of the edges between and the lengths of the edges between and the lengths of the edges between and and the lengths of the edges between and , calculate a first increase value E1 and a second increase value E2, and let M[k x , l x ] = M[k x , l x ] + E1, M[k yl y ] = M[k y ,l y ]+E2, wherein and denote two nodes connected to node , and denote two nodes connected to node , and , and , and , and .

[0102] When step 616 is performed, it is explained that the edge connected to and the edge connected to do not match completely, at this time there are multiple matching situations. Please refer to Figure 9 , wherein node B1 is node B3 is At this time there are four matching situations, namely four matching node pairs, which are {A1, C1} and {A3, C3}, {A1, C2} and {A3, C3}, {A2, C1} and {A3, C3}, and {A2, C2} and {A3, C3}, for which the first increase value E1 and the second increase value E2 are calculated, and the corresponding operations are performed. For the length of the edge, taking the matching node pair as {A1, C1} and {A3, C3} as an example, then is the length of edge A1-B1, is the length of edge B1-C1, is the length of edge A3-B3, is the length of edge B3-C3.

[0103] In one embodiment, the first increase value and the second increase value are determined by the following formula:

[0104]

[0105] Step 617: After the traversal is completed, nodes corresponding to each node of the standard structure graph model are selected from the subgraph model according to the matrix M, so as to obtain the isomorphic graph; if the traversal is not completed, the traversal is continued.

[0106] For any node of the subgraph model and any node The larger the element M[i,j] in the matrix, the greater the probability of a match. Based on this, those skilled in the art can select the most likely matching node from the subgraph model as the corresponding node in the standard structural graph model. The subgraph model is then used to select the node with the highest probability of a match. Let the index of the corresponding node be i(j), then the corresponding node is In one embodiment, according to the objective function Obtain nodes in the subgraph model corresponding nodes Where j p and j q Let represent two possible values ​​for index j. The objective function above means that for each index j, select the index i that maximizes M[i(j),j], and different indexes j select different indexes i. Finally, the node set... The resulting graph serves as the isomorphic graph.

[0107] To further improve matching accuracy, character recognition data can be made include character recognition scores, and text structure information can include the lower limit of the character recognition score for each character. Based on this, such as... Figure 10 As shown, the process of matching the isomorphic graph of the standard structural graph model in the subgraph model includes steps 621 to 627.

[0108] Step 621: Create an m×n matrix M and initialize all elements to 1, where m≥n.

[0109] Step 622: Traverse all nodes of the subgraph model and the standard structure graph model. For any node in the subgraph model... And any node of the standard structural diagram model judge and If the first preset condition and / or the second preset condition and / or the third preset condition are met, proceed to step 623; otherwise, proceed to step 624.

[0110] The first and second preset conditions are explained in step 612, while the third preset condition refers to... The character recognition score is less than The lower limit of character recognition score in [the dataset].

[0111] Step 623: Assign the value -1 to M[i,j].

[0112] Step 624: Determine AND Connected edges and Check if the connected edges are completely matched. If so, proceed to step 625; otherwise, proceed to step 626.

[0113] Step 625: Obtain matching node pairs and Let

[0114] M[k1,l1]=M[k1,l1]+1,M[k2,l2]=M[k2,l2]+1.

[0115] This step please refer to the description in step 615, here will not be elaborated.

[0116] Step 626: for each matching case, get the matching node pair under the case and According to the length of the edge between and The length of the edge between and The length of the edge between and The length of the edge between and The length of the edge between and Calculate the first increase value E1 and the second increase value E2, let M[k x ,l x ]=M[k x ,l x ]+E1,M[k y ,l y ]=M[k y ,l y ]+E2. This step please refer to the description in step 616, here will not be elaborated.

[0117] Step 627: after traversal, according to the matrix M, select the node corresponding to each node of the standard structure graph model from the subgraph model, so as to obtain the isomorphic graph. This step please refer to the description in step 617, here will not be elaborated.

[0118] According to the text line character recognition rate optimization method of the above embodiment, first, the initial structure graph model of each text line of the text image is constructed, the node of the initial structure graph model records the character recognition data of the character in the text line, and then the initial structure graph model of each text line is divided into several subgraph models according to the node where the separation character is located; then the standard structure graph model is constructed according to the input text structure information, the isomorphic graph of the standard structure graph model is matched in the subgraph model, and the character corresponding to the isomorphic graph is taken as the optimal character recognition result matched with the input text structure information. The user can input the text structure information of some text with fixed structure as a reference for finding such text in the text image; and since the graph model is used for modeling and isomorphic graph matching, the character corresponding to the isomorphic graph is taken as the optimal character recognition result matched with the input text structure information, so as to improve the recognition accuracy of characters or some fixed structure text in complex environment.

[0119] In some embodiments of the present application, in order to reduce the mis-segmentation and mis-recognition caused by rotation and tilt when printing the font, and further improve the accuracy, the text is corrected before the character segmentation and character recognition of the text image. In this embodiment, a text correction step is further included after step 100 and before step 200. Please refer to Figure 11 The text correction step includes steps 1000-8000, which are described in detail below.

[0120] Step 1000: Calculate the character block preliminary detection image and the background estimation image according to the text image, and calculate the character block detection image based on the image difference according to the character block preliminary detection image and the background estimation image.

[0121] This step is mainly to generate a character block according to the characters in the text image, for example, a "day" character can generate a region similar to a square ■, so as to obtain a character block detection image, which can retain and highlight the approximate position of the character. In order to more accurately detect the character block, the difference method is used to obtain the character block detection image. Specifically, first, the character block preliminary detection image and the background estimation image are obtained by using some image processing methods according to the text image, and then the difference operation is performed, for example, the character block preliminary detection image is subtracted from the background estimation image to obtain the character block detection image. Here, the background refers to the background of the character block.

[0122] Step 2000: Obtain an initial estimation value of the rotation angle of the text image, and determine a second angle range based on the initial estimation value of the rotation angle.

[0123] The rotation angle of the text image refers to the angle of rotation of the text image relative to the normal state. Please refer to Figure 12 Generally, the text is arranged horizontally in the normal state, and after being rotated by a certain angle, it is arranged as shown in the right figure of Figure 12 The angle of rotation is the rotation angle of the text image. The rotation angle of the text image is estimated in the present application, and after obtaining the rotation angle of the text image, the rotation correction can be performed accordingly.

[0124] The initial estimation value of the rotation angle of the text image can be a value pre-set according to experience, or a rotation angle value estimated by using an existing rotation angle estimation method. The second angle range can be an angle range of a preset size including the initial estimation value of the rotation angle, for example, it can be a neighborhood of the initial estimation value of the rotation angle with a preset size. Since the initial estimation value of the rotation angle is a result of preliminary estimation, in order to further make more accurate estimation, the second angle range can be set smaller.

[0125] Step 3000: forming a target function curve according to the gray scale projection results of the multiple rotation angle values in the second angle range, to obtain a second target function curve; wherein the gray scale projection process of each rotation angle value comprises: generating a sampling point array according to the rotation angle value to sample the character block detection image to obtain the gray scale projection result.

[0126] Specifically, first, multiple rotation angle values are selected in the second angle range, and for each rotation angle value, a gray scale projection is performed, and a target function value is calculated according to the gray scale projection result, and a target function curve is formed based on the target function values of the selected multiple rotation angle values, to obtain a second target function curve. In the process of gray scale projection, the sampling point array generated according to the rotation angle value is used to sample the character block detection image to obtain the gray scale value of the sampling point, and the gray scale projection result is calculated using the gray scale value of the sampling point, thereby reducing the calculation amount.

[0127] In some embodiments, the target function value represents the degree of gray scale difference in the orthogonal direction of the gray scale projection, and can be the sum of squared differences of the gray scale projection, and in this case, forming a target function curve according to the gray scale projection results of the multiple rotation angle values in the second angle range, to obtain a second target function curve, comprises: for each rotation angle value in the second angle range, calculating the sum of squared differences of the gray scale projection thereof as the target function value thereof, and forming the second target function curve based on all the rotation angle values in the second angle range and the target function values thereof.

[0128] Step 4000: calculating the angle value corresponding to the sub-pixel maximum value point of the second target function curve as the rotation angle accurate estimation value.

[0129] In an embodiment, the calculation of the angle value corresponding to the sub-pixel maximum value point of the second target function curve can specifically be: performing smoothing processing on the second target function curve, then performing interpolation to obtain the sub-pixel maximum value point of the second target function curve, and then obtaining the angle value corresponding to the sub-pixel maximum value point. The smoothing processing can be Gaussian smoothing or mean smoothing, and the interpolation can be parabolic interpolation or Lagrange interpolation.

[0130] The present application first preliminarily estimates the rotation angle to obtain a rotation angle initial estimation value, and then determines a smaller angle range based on the rotation angle initial estimation value to further make a more accurate estimation, thereby improving the accuracy of the rotation angle estimation through this coarse-to-fine estimation.

[0131] Step 5000: rotating and correcting the text image according to the rotation angle accurate estimation value.

[0132] Step 6000: taking the text image or the reduced text image as a tilt estimation image, and extracting a character edge region and a gradient amplitude angle image in the tilt estimation image.

[0133] The reduced text image is taken as the tilt estimation image to reduce the amount of calculation. The reduction ratio can be set according to actual needs. One embodiment is 40 / H c Those skilled in the art can understand that the character edge region and the gradient amplitude angle image can be extracted by various edge extraction filters, such as Roberts filter, Canny filter, etc., which will not be described here.

[0134] Step 7000: histogram statistics are performed on the region corresponding to the character edge region in the gradient amplitude angle image to obtain a gradient amplitude angle histogram, the gradient amplitude angle histogram is smoothed to obtain a gradient amplitude angle curve, and a sub-pixel maximum point of the gradient amplitude angle curve is calculated as the tilt angle estimation value.

[0135] The maximum point here can be a sub-pixel maximum point to improve the accuracy, and the sub-pixel maximum point can be obtained by interpolation on the smoothed gradient amplitude angle curve. The smoothing can be Gaussian smoothing or mean smoothing, and the interpolation can be parabolic interpolation or Lagrange interpolation.

[0136] Please refer to Figure 13 The text is in a state similar to italic when it is tilted, which affects the correct recognition of the characters. The tilt angle estimation value obtained in this step is an estimation of the text tilt angle, and the tilt correction can be performed according to the text tilt angle after the text tilt angle is obtained.

[0137] Step 8000: tilt correction is performed on the text image according to the tilt angle estimation value.

[0138] The present application estimates the tilt angle after the rotation correction is performed, and it can be understood that this makes the tilt angle estimation value more accurate.

[0139] In some embodiments, the character block preliminary detection image and the background estimation image calculated according to the text image in the above step 1000 can be obtained by performing morphological processing on the text image to generate character blocks according to the characters in the text image to obtain the character block preliminary detection image and obtain the background estimation image. The morphological processing refers to gray erosion, gray dilation, gray opening / closing operation, etc. The morphological processing here can include one or more of them. Please refer to Figure 14 In one embodiment, the process of performing morphological processing on the text image to generate character blocks according to the characters in the text image to obtain the character block preliminary detection image and obtain the background estimation image includes steps 1100-1300.

[0140] Step 1100: performing first morphological processing on the text image to generate character blocks according to the characters in the text image, thereby obtaining a character block preliminary detection image. In an embodiment, the first morphological processing is a gray scale erosion processing, and the template width of the gray scale erosion processing can be max(3.0, H c / 8.0), where H c is a preset character pixel height.

[0141] Step 1200: performing reduction on the character block preliminary detection image to obtain a reduced image. Here, the calculation amount is reduced by appropriately reducing the character block preliminary detection image, and the reduction ratio when reducing can be 8.0 / H c .

[0142] Step 1300: performing second morphological processing on the reduced image to obtain a background estimation image. The purpose of the second morphological processing is to filter out the character blocks in the reduced image and leave the non-character part, i.e., the background part, so as to filter out the non-character interference in the later difference.

[0143] In an embodiment, step 1300 includes: performing median filtering on the reduced image to obtain a median filtering image, performing gray scale closing operation on the median filtering image to obtain a gray scale closing operation image, and taking the gray scale closing operation image as the background estimation image. The median filtering template size can be 3x3, and the gray scale closing operation template size can be max(5.0, 0.5xmax(3.0, H c / 8.0))x2|1, where | represents binary or operation, i.e., converting the values on the left and right sides into binary numbers to perform or operation. This embodiment is advantageous in removing noise in the reduced image and obtaining a more accurate background estimation image through median filtering, gray scale closing operation, etc.

[0144] Based on the embodiment shown in Figure 14 , the character block detection image obtained based on image difference calculation is specifically obtained by subtracting the background estimation image from the reduced image.

[0145] In some embodiments, in order to obtain a more accurate initial estimation value of the rotation angle and reduce the calculation amount, the initial estimation value of the rotation angle in step 2000 can also be calculated by a method similar to steps 3000-4000. Please refer to Figure 15 , and the flow of obtaining the initial estimation value of the rotation angle in this embodiment includes steps 2100-2200, which are described below.

[0146] Step 2100: obtaining a preset first angle range, forming a target function curve according to the gray projection results of a plurality of rotation angle values in the first angle range, and obtaining a first target function curve; wherein the gray projection process of each rotation angle value includes: generating a sampling point array according to the rotation angle value to sample the character block detection image to obtain the gray projection result.

[0147] Specifically, first, a plurality of rotation angle values are selected in the first angle range, and the gray projection is performed for each rotation angle value. The target function value is calculated according to the gray projection result. A target function curve is formed based on the target function values of the selected plurality of rotation angle values, and a first target function curve is obtained. In the process of gray projection, the sampling point array generated according to the rotation angle value is used to sample the character block detection image to obtain the gray value of the sampling point, and the gray projection result is calculated by using the gray value of the sampling point. The first angle range can be large.

[0148] In some embodiments, the target function value is the difference sum of squares of gray projection. At this time, a target function curve is formed according to the gray projection results of a plurality of rotation angle values in the first angle range, and a first target function curve is obtained, which includes: for each rotation angle value in the first angle range, the difference sum of squares of its gray projection is calculated as its target function value, and the first target function curve is formed based on all rotation angle values in the first angle range and the target function values thereof.

[0149] In some embodiments, the plurality of rotation angle values in the first angle range are obtained in the following manner: the angle values in the first angle range are read as rotation angle values according to the first angle step to obtain the plurality of rotation angle values in the first angle range. For example, the first angle range is [0, 5], and the first angle step is 1. The plurality of rotation angle values read are 0, 1, 2, 3, 4, and 5. In one embodiment, the first angle step is determined by the following expression:

[0150]

[0151] wherein S min and S max respectively represent the lower limit value and the upper limit value of the angle of the first angle range, and round() represents the rounding operation.

[0152] In one embodiment, the plurality of rotation angle values in the second angle range can also be selected by steps, that is, the angle values in the second angle range are read as rotation angle values according to the second angle step to obtain the plurality of rotation angle values in the second angle range. In order to realize the coarse-to-fine rotation angle estimation, the second angle range can be set to be smaller than the first angle range, and the second angle step can be set to be smaller than the first angle step. Assuming that the initial estimation value of the rotation angle is S optIn an embodiment, the second angle range can be The second angle step size is

[0153] Step 2200: Calculate the angle value corresponding to the sub-pixel maximum point of the first target function curve as the initial estimation of the rotation angle.

[0154] In an embodiment, the calculation of the angle value corresponding to the sub-pixel maximum point of the first target function curve can be specifically to perform smoothing processing on the first target function curve and then perform interpolation to obtain the sub-pixel maximum point of the first target function curve, and then obtain the angle value corresponding to the sub-pixel maximum point. The smoothing processing can use Gaussian smoothing or mean smoothing, and the interpolation can use parabolic interpolation or Lagrange interpolation method.

[0155] Please refer to Figure 16 In some embodiments, the process of generating the sampling point array according to the rotation angle value to sample the character block detection image to obtain the gray projection result in steps 3000 and 2100 includes steps 10-30, which will be described in detail below.

[0156] Step 10: Take the direction corresponding to the rotation angle value as the projection direction, and take the direction orthogonal to the projection direction as the traversal direction. Generate sampling points on the text image in the projection direction with a first step size and in the traversal direction with a second step size to obtain a sampling point array.

[0157] It can be understood that each rotation angle value corresponds to a direction, similar to the hour hand on a clock. When it is rotated by 90 degrees, it is in the horizontal direction, and when it is rotated by 180 degrees, it is in the vertical direction. In an embodiment, the sampling points can be determined with the center of the text image as the center point of the sampling point array. The first step size and the second step size are set according to actual needs. In an embodiment, the first step size can be set to H c / 8.0, and the second step size can be set to max(1, H c / 60). The generated sampling point array is shown in Figure 17 The black dots in the figure are the sampling points.

[0158] Step 20: Calculate the gray value of each sampling point.

[0159] The gray value of the sampling point can be calculated by the gray values of the pixel points near the sampling point, such as weighted average. In an embodiment, the gray value of the sampling point is determined by the following expression:

[0160]

[0161] wherein w1, w2, w3 and w4 are sampling weight coefficients, inverse distance square weight coefficients are used, normalized bilinear coefficients or Gaussian weight coefficients can also be used; (x, y) represents the coordinates of the sampling point, g(x, y) represents the gray value of the sampling point, and respectively represent the gray values of the pixel points with coordinates and on the text image respectively.

[0162] Step 30: performing gray projection on the sampling point array in the projection direction to obtain a gray projection result.

[0163] Those skilled in the art can understand that the gray projection on the sampling point array in the projection direction is to calculate the mean value of the gray values of each row of sampling points in the projection direction, and therefore the gray projection result includes the mean value of the gray values of each row of sampling points in the projection direction, as shown in the gray projection curve in Figure 17 .

[0164] An embodiment of the present application also provides a new method for extracting the character edge region and the gradient amplitude angle image in the tilt estimation image, please refer to Figure 18 , the embodiment includes steps 6100-6700, which are described below.

[0165] Step 6100: performing mean value filtering on the tilt estimation image to obtain a mean value filtered image.

[0166] In order to accurately estimate the tilt angle of the text, it is necessary to highlight the edges with horizontal gradient on the characters and blur the edges with vertical gradient, for example, for the character "0", it is expected to be approximately a bracket after processing, therefore, in an embodiment, a long strip filter kernel can be used for mean value filtering, that is, the filter kernel size of the mean value filtering is 1xN, wherein N is a preset filter kernel width, and in an embodiment, N=7.

[0167] Step 6200: performing processing on the mean value filtered image using a first edge extraction filter to obtain a first gradient image and a first gradient amplitude angle image.

[0168] Step 6300: performing binarization on the first gradient image using a first binarization threshold to obtain a first character edge region of the tilt estimation image, wherein the first character edge region is a region in the tilt estimation image corresponding to the region with a gray value greater than the first binarization threshold in the first gradient image.

[0169] The first gradient image is binarized to obtain a region with a gray value (indicating a gradient value) greater than a first binarization threshold value. A region in the tilt estimation image corresponding to the region is a first character edge region. In an embodiment, the first binarization threshold value is 1.4*G1, where G1 represents a standard deviation of the first gradient image. The region with a gray value in a range of [1.4*G1, 255] in the first gradient image is obtained after binarization.

[0170] Step 6400: The mean filtered image is processed using a second edge extraction filter to obtain a second gradient image and a second gradient amplitude angle image.

[0171] It should be noted that the step 6400 and the step 6200 can be executed in sequence or simultaneously. In an embodiment, one of the first edge extraction filter and the second edge extraction filter is a Roberts filter, and the other is a Canny filter.

[0172] Step 6500: The second gradient image is binarized using a second binarization threshold value to obtain a second character edge region of the tilt estimation image, where the second character edge region is a region in the tilt estimation image corresponding to a region in the second gradient image with a gray value greater than the second binarization threshold value.

[0173] This step refers to the step 6300. In an embodiment, the second binarization threshold value is 1.4*G2, where G2 represents a standard deviation of the second gradient image. The region with a gray value in a range of [1.4*G2, 255] in the second gradient image is obtained after binarization.

[0174] Step 6600: An intersection of the first character edge region and the second character edge region of the tilt estimation image is obtained to obtain a final character edge region of the tilt estimation image.

[0175] Step 6700: Either of the first gradient amplitude angle image and the second gradient amplitude angle image is taken as a gradient amplitude angle image of the tilt estimation image.

[0176] This embodiment uses two edge extraction filters to extract a character edge region and a gradient amplitude angle image in the tilt estimation image, respectively. The final character edge region and the gradient amplitude angle image are obtained by combining the results of the two, so that the extracted character edge region and the gradient amplitude angle image are more refined and more accurate.

[0177] Those skilled in the art can understand that all or part of the functions of various methods in the above embodiments can be realized by hardware or by a computer program. When all or part of the functions in the above embodiments are realized by a computer program, the program can be stored in a computer readable storage medium, which can include a read-only memory, a random access memory, a magnetic disk, an optical disk, a hard disk, and the like. The above functions are realized by executing the program by a computer. For example, the program is stored in a memory of a device, and the above functions are realized by executing the program in the memory by a processor. In addition, when all or part of the functions in the above embodiments are realized by a computer program, the program can also be stored in a storage medium such as a server, another computer, a disk, an optical disk, a flash disk, or a mobile hard disk, and is saved in a memory of a local device by downloading or copying, or the system of the local device is updated, and the above functions are realized by executing the program in the memory by a processor.

[0178] The above application of specific examples to the present application is described, which is only used to help understand the present application and does not limit the present application. For those skilled in the art, according to the idea of the present application, a number of simple deductions, deformations or substitutions can be made.

Claims

1. A method for optimizing the character recognition rate of a text line, characterized in that, include: Get text image; The text image is segmented and recognized to obtain character recognition data for each character, wherein the character recognition data includes at least the character recognition result; An initial structure graph model is constructed for each line of text in the text image. The steps for constructing the initial structure graph model include: sequentially traversing all characters in the current line of text, establishing a node for the current character during the traversal, recording the character recognition data of the current character in the node, and if there are characters before the current character, establishing an edge between the established node and the nodes containing a preset number of characters before the current character, with the direction of the edge pointing from the node containing the characters before the current character to the established node. The initial structure graph model of each text line is divided into several sub-graph models based on the node where the separator character is located; Receive input text structure information, construct a standard structure graph model based on the text structure information. The text structure information includes the number of characters n to be matched and the character type of each character. The standard structure graph model includes n nodes. Each node has only edges with its left and right adjacent nodes. The direction of the edges is from the left node to the right node. The i-th node records the character type of the i-th character. In the subgraph model, match the isomorphic graph of the standard structural graph model, and take the character corresponding to the isomorphic graph as the optimal character recognition result that matches the text structure information.

2. The text line character recognition rate optimization method as described in claim 1, characterized in that, The step of establishing an edge between the node and the node containing a preset number of characters preceding the current character if there are characters preceding the current character includes: if there is only one character preceding the current character, establishing an edge between the node and the node containing that character; if there is more than one character preceding the current character, establishing an edge between the node and the nodes containing the two characters preceding the current character.

3. The text line character recognition rate optimization method as described in claim 1, characterized in that, The character recognition data also includes character segmentation regions; in the initial structure graph model, the length of the side is the distance between the characters of two nodes, where the distance between the characters is the minimum distance of the outer rectangle of the character segmentation regions of the two characters.

4. The text line character recognition rate optimization method as described in claim 3, characterized in that, Also includes: Before dividing the initial structure graph model of each text line into several subgraph models according to the node where the separator character is located, all edges of the initial structure graph model are traversed, and edges with a length greater than the distance threshold T are deleted.

5. The text line character recognition rate optimization method as described in claim 4, characterized in that, The distance threshold T is determined through the following steps: Excluding delimiters in the text line, iterate through all characters in the text line sequentially, calculate the distance between all adjacent characters, and obtain the distance set. Where d i This represents the i-th distance value, and N represents the total number of distance values; Based on distance set Histogram for calculating distances between characters Where c represents the total number of groups in the histogram, C j This represents the frequency of the j-th group; The histogram is smoothed to obtain a distance curve, and the sub-pixel maxima position p of the distance curve is calculated. extrem ; Based on distance set The minimum value d min Standard deviation d std and sub-pixel maximum position p extrem The distance threshold T is calculated.

6. The text line character recognition rate optimization method as described in claim 5, characterized in that, The distance set A histogram for calculating the distances between characters, including: the quantized minimum unit distance of the histogram for calculating the distances between characters. Where d max and d mean Distance sets Calculate the maximum and average values; calculate the total number of groups. The histogram is initialized to 0; the distance set is traversed. For each distance value d i Calculate h i =(d i -d min ) / d size ,Will Add 1; The distance threshold T is determined by the following formula: T=d min +d size ×p extrem +2×d std 。 7. The text line character recognition rate optimization method as described in claim 1, characterized in that, The initial structural graph model of each text line is divided into several sub-graph models based on the node where the separator character is located, including: Find the node containing the separator character in the initial structural graph model, and all nodes connected to the node containing the separator character. Where v i V represents the i-th node connected to the node containing the separator character, and V represents the total number of nodes connected to the node containing the separator character. Delete all edges connected to the node containing the separator character. The longest edge between nodes yields the partitioned subgraph model.

8. The text line character recognition rate optimization method as described in claim 1, characterized in that, The process of matching the isomorphic graph of the standard structural graph model in the subgraph model includes: Create an m×n matrix M and initialize all elements to 1, where m is the number of nodes in the subgraph model, and m≥n; For any node in the subgraph model and any node of the standard structural diagram model like and If the first preset condition and / or the second preset condition are met, then M[i,j] is assigned the value -1, where the first preset condition refers to... The character recognition results are not included in The character type in the second preset condition refers to the character type in the second preset condition. The number of connected edges is less than that of the number of connected edges. The number of connected edges or the One of the connected edges cannot be connected to... Find the edges with the same direction among the connected edges. The superscripts i and j represent the indices of the nodes in the subgraph model and the standard structural graph model, respectively, i∈[0,m-1], j∈[0,n-1]. If neither the first nor the second preset condition is met, then the judgment is... Connected edges and Check if the connected edges are a complete match. If they are, then obtain the matched node pairs. and Let M[k1,l1] = M[k1,l1]+1, M[k2,l2] = M[k2,l2]+1, where and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match; If with Connected edges and If the connected edges do not completely match, then for each matching scenario, obtain the matching node pairs under that scenario. and according to and Length of the side between and Length of the side between and Length of the side between as well as and Length of the side between Calculate the first increase value E1 and the second increase value E2, let M[k x ,l x ]=M[k x ,l x ]+E1,M[k y ,l y ]=M[k y ,l y ]+E2, in and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match; Based on matrix M, nodes corresponding to each node of the standard structural graph model are selected from the subgraph model to obtain the isomorphic graph.

9. The text line character recognition rate optimization method as described in claim 1, characterized in that, The character recognition data also includes character recognition scores, and the text structure information also includes a lower limit of the character recognition score for each character. The i-th node of the standard structure graph model also records the lower limit of the character recognition score for the i-th character. The process of matching the isomorphic graph of the standard structural graph model in the subgraph model includes: Create an m×n matrix M and initialize all elements to 1, where m is the number of nodes in the subgraph model, and m≥n; For any node in the subgraph model and any node of the standard structural diagram model like and If the first preset condition and / or the second preset condition and / or the third preset condition are met, then M[i,j] is assigned the value -1, where the first preset condition refers to... The character recognition results are not included in The character type in the second preset condition refers to the character type in the second preset condition. The number of connected edges is less than that of the number of connected edges. The number of connected edges or the One of the connected edges cannot be connected to... Find the edges with the same direction among the connected edges; the third preset condition refers to... The character recognition score is less than The lower limit of character recognition score in the model, where the superscripts i and j represent the indices of nodes in the subgraph model and the standard structural graph model, respectively, i∈[0,m-1], j∈[0,n-1]; If none of the first, second, and third preset conditions are met, then the judgment is... Connected edges and Check if the connected edges are a complete match. If they are, then obtain the matched node pairs. and Let M[k1,l1]=M[k1,l1]+1, M[k2,l2]=M[k2,l2]+1, where and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match; If with Connected edges and If the connected edges do not completely match, then for each matching scenario, obtain the matching node pairs under that scenario. and according to and Length of the side between and Length of the side between and Length of the side between as well as and Length of the side between Calculate the first increase value E1 and the second increase value E2, let M[k x ,l x ]=M[k x ,l x ]+E1,M[k y ,l y ]=M[k y ,l y ]+E2, in and Represents nodes Two connected nodes, and Represents nodes Two connected nodes, and The edges between and The edges between them match. and The edges between and The edges between them match; Based on matrix M, nodes corresponding to each node of the standard structural graph model are selected from the subgraph model to obtain the isomorphic graph.

10. The text line character recognition rate optimization method as described in claim 8 or 9, characterized in that, The first and second increments are determined by the following formula:

11. The text line character recognition rate optimization method as described in claim 8 or 9, characterized in that, The step of selecting nodes corresponding to each node of the standard structural graph model from the subgraph model based on matrix M to obtain the isomorphic graph includes: According to the objective function Obtain nodes in the subgraph model corresponding nodes Where i(j) represents the node The index of the corresponding node, j p and j q This represents the two possible values ​​for index j; Node set The resulting graph serves as the isomorphic graph.

12. A computer-readable storage medium, characterized in that, The medium stores a program that can be executed by a processor to implement the text line character recognition rate optimization method as described in any one of claims 1 to 11.

Citation Information

Patent Citations

  • Character cutting and recognizing method

    CN104616009A

  • Character recognition method and device based on principle of isomorphism, and terminal equipment

    CN108345853A