A method and system for extracting and recognizing characters from images

Through matching with the preset font database and historical sample image database and the Harris corner detection algorithm, the text features are identified and matched, which solves the problem of low accuracy of recognition of wild cursive continuous strokes and improves the accuracy of text recognition and image recognition model. accuracy.

CN118411729BActive Publication Date: 2024-09-06SHANDONG SHENGTONG INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410874316.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-09-06
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

The existing technology has low recognition accuracy when processing pictures containing various text forms, especially wild cursive continuous strokes, which leads to a decrease in the recognition accuracy of the image recognition model and makes it difficult to effectively detect text.

Method used

By matching the input complete font image with the preset font database, the target font database is obtained, combined with the historical sample image database, to calculate the similarity feature parameters, determine the final target text, and use the Harris corner detection algorithm and covariance matrix to identify the corner points. Match text features, determine the characteristics of connected strokes, and improve recognition accuracy.

Benefits of technology

It improves the accuracy and speed of text recognition, enhances the ability to recognize wild cursive continuous strokes, and improves the accuracy of the image recognition model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118411729B
    Figure CN118411729B
Patent Text Reader

Abstract

The present invention discloses a method and system for extracting, identifying and processing characters in pictures. The method comprises: comparing and matching multiple input complete font pictures with a preset multi-font database to obtain a target font database; identifying the complete font picture to be detected with the target font database to obtain a first recognition result target character; acquiring a historical sample image database, collecting multiple target object input historical sample images corresponding to the first recognition result target character; performing pixel point recognition on the complete font picture to be detected and multiple target object input historical sample images, obtaining pixel point information of the target object input historical sample image and pixel point information of the complete font picture to be detected, and calculating similarity feature parameters; determining the target object input historical sample image with the highest matching degree among multiple target object input historical sample images, and determining the target final character in the target object input historical sample image with the highest matching degree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text recognition, and in particular to a method and system for extracting, recognizing and processing text in a picture. Background Art

[0002] There are many pictures with text in the Internet nowadays. There are often many different forms of text in text pictures. Some text is cursive cursive text, and some text is clear text. Therefore, when detecting text in such pictures, it is often difficult to detect the text because various forms of text are gathered together.

[0003] Research has found that when there are a large number of various characters in a text image, recognition will be very difficult, and conventional image recognition models are prone to text recognition errors. Therefore, the large number of various characters that may exist in a text image often causes a decrease in the recognition accuracy of the image recognition model.

[0004] At the same time, when studying the detection of cursive cursive characters, the connected strokes often cause complexity in image detection, resulting in low accuracy in text recognition in the image.

[0005] Therefore, the present application proposes a method for extracting and recognizing text in an image to perform corner point recognition on the text to solve the problem of low text accuracy. Summary of the invention

[0006] The purpose of the present invention is to provide a method and system for extracting and recognizing text in images, which solves the above-mentioned technical problems pointed out in the prior art.

[0007] The present invention provides a method for extracting and recognizing text in an image, comprising the following steps:

[0008] Firstly, multiple input complete font images are compared and matched with a preset multi-font database, and the font database with the highest matching degree with the current target object is obtained as the target font database;

[0009] Calling the matching target font database;

[0010] Obtain a complete font image to be detected, and identify the complete font image to be detected with a target font database to obtain a first recognition result target character;

[0011] Acquire a historical sample image database, collect multiple target object input historical sample images that match the first recognition result target word; use the complete font image to be detected as the current input image, and use the multiple target object input historical sample images corresponding to the first recognition result target word as the target prediction image; perform pixel point recognition processing on the complete font image to be detected and the multiple target object input historical sample images to obtain pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected;

[0012] Calculate similarity feature parameters based on pixel information of the target object input history sample image and pixel information of the complete font image to be detected;

[0013] According to the similarity feature parameters, the target object input history sample image with the highest matching degree among multiple target object input history sample images is determined, and then the target final text in the target object input history sample image with the highest matching degree is determined; the target final text is judged with the first recognition result target text, and if it is determined that the target final text and the first recognition result target text are the same text, the secondary judgment result is correct; the judgment result of the first recognition result target text is regarded as the final judgment result output and sent.

[0014] Preferably, similarity feature parameters are calculated based on pixel information of the target object input history sample image and pixel information of the complete font image to be detected. The specific operation steps are as follows:

[0015] Optical character recognition is performed through the pixel point information of the target object input historical sample image and the pixel point information of the complete font image to be detected to extract text features, wherein the text features include font features, stroke features, and corner features;

[0016] Confirming the font features in the text features of the pixel point information of the complete font image to be detected; confirming the calligraphy form and text identification attribute results of the complete font image to be detected through the font features;

[0017] The stroke features are determined by the calligraphy form of the font features and the text identification attribute results. In the initial state, the stroke features are firstly initially identified using the initial detection model to obtain the initial recognition results of the current strokes. According to the initial recognition results of the current strokes and the text identification attribute results, it is further determined whether there may be connected stroke features in the stroke features corresponding to the font of the complete font image to be detected;

[0018] Further, according to the current suspected connected stroke features, the intersection points where the stroke trajectories are connected are determined, and the number of the intersection points where the stroke trajectories are connected is counted to determine the number of actual corner points;

[0019] Obtaining an initial recognition result of the current stroke, calling a preset corner point number threshold d corresponding to the initial recognition result of the current stroke, and determining whether the actual number of corner points is equal to the preset corner point number threshold d;

[0020] If yes, the number of corner points of the complete font image to be detected is retained, that is, the number of corner points is determined to be normal;

[0021] If not, the stroke feature used to determine the current character feature is finally identified as a connected stroke feature, and the number of corner points of the stroke trajectory of the connected stroke feature is extracted;

[0022] Directly judging the connected stroke features of the pixel point information of the plurality of target object input history sample images according to the text features extracted from the pixel point information of the target object input history sample images, and judging the number of corner points of the stroke trajectory according to the connected stroke features of the target object input history sample images;

[0023] The similarity of connected stroke features is calculated by using the text features of the target object input history sample image and the complete font image to be detected, and the similarity of corner point features is calculated by using the number of corner points.

[0024] Preferably, the similarity of the connected stroke features and the similarity of the number of corner points are calculated by using the text features of the target object input history sample image and the complete font image to be detected. The specific operation steps are as follows:

[0025] Mapping the text features of the multiple target objects input into the historical sample images and the complete font images to be detected into a vector space to form a target text vector space and a text vector space to be detected; cross-segmenting the text vector space to obtain a target text vector block and a text vector block to be detected;

[0026] Use the Harris corner detection algorithm to traverse each text vector block to be detected for smoothing, obtain the (x, y) coordinate pixel point in the text vector block to be detected, calculate the gradient of the (x, y) coordinate pixel point of the text vector block to be detected in the x-axis direction and the y-axis direction, and construct a covariance matrix for each pixel point in the x-axis direction and the y-axis direction;

[0027] Calculating the key value of the text vector block to be detected by using the covariance matrix, weighting the covariance matrix by a Gaussian function, and obtaining the key value of the covariance matrix by weighted calculation;

[0028] A key value threshold e is preset to determine whether the key value of the covariance matrix is ​​greater than the key value threshold e; if the key value of the covariance matrix is ​​less than the key value threshold e, it is determined that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​equal to the key value threshold e, it is determined that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​greater than the key value threshold e, it is determined that there are corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected;

[0029] According to the above steps, all corner points are calculated, and the number of the corner points is counted to obtain the number of corner points of each text vector block to be detected;

[0030] Directly counting the number of corner points of the target text vector block to obtain the number of corner points of each target text vector block;

[0031] Traverse each of the to-be-detected text vector blocks and each of the target text vector blocks to perform similarity matching on the number of corner points, preset a similarity threshold f for the number of corner points, and determine whether the similarity of the number of corner points is less than the similarity threshold f for the number of corner points; if so, the similarity matching of the number of corner points is successful; if not, the target text vector block is eliminated, and the target object input historical sample image of the target text vector block is correspondingly eliminated;

[0032] When the similarity of the number of corner points of each to-be-detected character vector block and each target character vector block in the target character vector space and the to-be-detected character vector space is successfully matched, the target character vector space and the to-be-detected character vector space are matched for similarity of connected strokes, a connected stroke similarity threshold g is preset, and it is determined whether the connected stroke similarity is less than the connected stroke similarity threshold g; if so, the target character vector space is retained; if not, the target character vector space that fails to match is eliminated;

[0033] The target final text in the target object input history sample image of the target text vector space with the largest retained similarity is the target final text of the complete font image to be detected.

[0034] Preferably, the target text vector space and the to-be-detected text vector space are matched for similarity of connected strokes, and the specific operation steps are as follows:

[0035] The corner points are connected by stroke trajectories, and the stroke trajectories between all two adjacent corner points are traversed for disassembly; the corner points of the target text vector block are disassembled to obtain the target stroke trajectory, and the corner points of the to-be-detected text vector block are disassembled to obtain the to-be-detected stroke trajectory;

[0036] When the similarity of the number of corner points is successfully matched, the target stroke trajectory of the target text vector block is traversed to match the similarity of the trajectory features with the stroke trajectory to be detected of the text vector block to be detected; the similarity between the target stroke trajectory and the stroke trajectory to be detected is calculated;

[0037] Preset a trajectory feature similarity threshold j, and determine whether the trajectory feature similarity between the stroke trajectory to be detected and the target stroke trajectory is less than the total similarity threshold j;

[0038] If so, retain the target text vector space of the target text vector block;

[0039] If not, the target text vector block of the target stroke trajectory that does not match the similarity is eliminated, and the target text vector space corresponding to the target text vector block is eliminated;

[0040] When the similarity between the stroke trajectory to be detected and the target stroke trajectory is successfully matched, each vector block of the character to be detected is re-merged with each vector block of the target character;

[0041] Determine the direction of the trajectory of the stroke to be detected and the direction of the target stroke trajectory; connect all corner points in the vector space of the character to be detected with the trajectory of the stroke to be detected to obtain the connected strokes to be detected; connect all corner points in the vector space of the target character with the trajectory of the target stroke to obtain the target connected strokes; perform similarity matching on the connected strokes to be detected and the target connected strokes, and calculate the similarity between the connected strokes to be detected and the target connected strokes;

[0042] A connected stroke similarity threshold d is preset to determine whether the similarity between the connected stroke to be detected and the target connected stroke is less than the connected stroke similarity threshold d; if not, the similarity match between the connected stroke to be detected and the target connected stroke fails, and the target object input history sample image of the target text vector space is eliminated; if so, the target object input history sample image corresponding to the successfully matched target text vector space is retained, and the target final text in the target object input history sample image with the highest similarity is determined to be the target final text of the complete font image to be detected.

[0043] Preferably, the trajectory feature includes a trajectory quantity feature.

[0044] Preferably, the formula for calculating the similarity between the target stroke trajectory and the stroke trajectory to be detected is: ;

[0045] In the formula, Indicates The first target word vector space The similarity between the target stroke trajectory of the target text vector block and the trajectory feature of the stroke trajectory to be detected of the text vector block to be detected, Indicates The first target word vector space The four-square relative position feature to which the trajectory feature of the target stroke trajectory of the target character vector block belongs and the four-square relative position feature to which the trajectory feature of the stroke trajectory to be detected of the character vector block to be detected belongs;

[0046] Indicates the current The first target word vector space similarity between the total number of starting and ending points of the trajectory feature of the target stroke trajectory of the target character vector block and the total number of starting and ending points of the trajectory feature of the stroke trajectory to be detected of the character vector block to be detected; ; is the sum of the target text vector block and the text vector block to be detected;

[0047] Preferably, the formula for calculating the similarity between the connected strokes to be detected and the target connected strokes is: ; In the formula, It is represented by the similarity between the connected strokes to be detected and the target connected strokes, and is also specifically represented by the first The similarity between the target connected strokes in the target text vector space and the connected strokes to be detected in the text vector space to be detected, Indicates The target stroke trajectory in the target text vector space, represents the stroke trajectory to be detected in the vector space of the text to be detected, Represents the comparison coefficient between the target stroke trajectory and the stroke trajectory to be detected; Indicates The first The target stroke trajectories are connected to each other through corner points to form the target connected strokes. Represents the first The stroke trajectories to be detected are connected to each other through corner points to form connected strokes to be detected; m is a constant.

[0048] Accordingly, the present invention also proposes a system for extracting and identifying characters in images, comprising: a database acquisition module, a first recognition target module, a text information detection module, a similarity matching module, a final target font module, and an output result font module;

[0049] The database acquisition module is used to first compare and match multiple input complete font images with a preset multi-font database, obtain the font database with the highest matching degree with the current target object as the target font database; and call the matched target font database;

[0050] The first target recognition module is used to recognize the complete font image to be detected and the target font database to obtain a first recognition result target word when detecting the complete font image to be detected input by the target object;

[0051] The text information detection module is used to obtain a historical sample image database, collect multiple target object input historical sample images corresponding to the first recognition result target word; use the complete font image to be detected as the current input image, and use the multiple target object input historical sample images corresponding to the first recognition result target word as the target prediction image; perform pixel point recognition processing on the complete font image to be detected and the multiple target object input historical sample images to obtain pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected;

[0052] The similarity matching module is used to calculate similarity feature parameters based on the pixel information of the historical sample image input by the target object and the pixel information of the complete font image to be detected;

[0053] The final target font module is used to determine the target object input history sample image with the highest matching degree among multiple target object input history sample images according to the similarity feature parameters, and then determine the target final text in the target object input history sample image with the highest matching degree;

[0054] The output result font module is used to judge the target final text and the first recognition result target word. If it is determined that the target final text and the first recognition result target word are the same text, the secondary judgment result is correct; the judgment result of the first recognition result target word is regarded as the final judgment result output and sent.

[0055] Correspondingly, the present application also relates to a storage medium, in which a computer program is stored. When the computer program is executed by a processor, a method for extracting and recognizing text in an image is implemented.

[0056] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages:

[0057] It can be known from the analysis of the above-mentioned method for extracting and identifying characters in a picture provided by the present invention that, in a specific application, firstly, the pixel point information of the historical sample image input by the target object and the pixel point information of the complete font picture to be detected are used to extract the text features, and the calligraphy form and the text identification attribute result of the complete font picture to be detected are confirmed through the font features in the text features to determine whether it is a real text, and then the calligraphy form is determined through the real text to determine whether it is a writing form such as Songti, Kaishu, Kuangcao, etc.; and further the stroke features are initially recognized to determine whether there may be connected stroke features in the stroke features, and the number of corner points at the connection of the stroke trajectory is determined through the possible existence of connected stroke features; and the similarity is calculated through the connected stroke features and the number of corner points obtained with the complete font picture to be detected to obtain the result of recognizing the text;

[0058] Furthermore, the text features of multiple target object input historical sample images and the complete font image to be detected are mapped into vector space, and the target text vector block and the text vector block to be detected are obtained by cross segmentation, and the corresponding text vector blocks are calculated separately to improve the speed of text detection; Harris corner point detection algorithm is used to traverse each text vector block to be detected for smoothing, and the gradients in the x-axis direction and the y-axis direction are calculated to construct a covariance matrix, and the corner points can be calculated better and faster through the covariance matrix; and the key value is weighted to calculate the covariance matrix; the corner points on the pixel points are effectively identified through the key value; the number of corner points is counted to perform similarity matching of the number of corner points of the target text vector block, and when all the text vector blocks to be detected are successfully matched with each corresponding target text vector block, the similarity of the connected strokes of the target text vector space and the text vector space to be detected is determined, and the target final text in the target object input historical sample image of the target text vector space with the largest similarity is determined to be the target final text of the complete font image to be detected;

[0059] Furthermore, the stroke trajectories between adjacent corner points in the text vector block to be detected and the target text vector block are matched for similarity. When the stroke trajectories of the corresponding text vector blocks are matched successfully, the text data block is re-synthesized into a text vector space, and the stroke trajectories are connected through corner points to form connected strokes. The similarity of the connected strokes is judged, thereby determining the target final text of the complete font image to be detected. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0061] Figure 1 It is the overall flowchart of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0062] Figure 2 It is the similarity flowchart of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0063] Figure 3 It is a schematic diagram of the connected stroke "氵" of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0064] Figure 4 It is a schematic diagram of the connected stroke "纟" of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0065] Figure 5 It is the flowchart of the specific similarity of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0066] Figure 6 It is the flowchart of the connected strokes of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0067] Figure 7 It is a demonstration schematic diagram of the process from the stroke trajectory to the stroke feature recognition of a method for extracting and recognizing text in a picture provided in the first embodiment of the present invention;

[0068] Figure 8 It is the flowchart of a system for extracting and recognizing text in a picture provided in the second embodiment of the present invention;

[0069] Fig. 9 It is a schematic diagram of the structure of a storage medium applying the above-mentioned method for extracting and recognizing text in a picture in the third embodiment;

[0070] Markings: Database acquisition module 10, first recognition target module 20, text information detection module 30, similarity matching module 40, final target font module 50, output result font module 60; processor 1110; communication interface 1120; memory 1130; computer storage medium 1140. Specific embodiments

[0071] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.

[0072] Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making any creative work shall fall within the scope of protection of the present invention.

[0073] The present invention is further described in detail below through specific embodiments in conjunction with the accompanying drawings. Embodiment 1

[0074] like Figure 1 As shown, the present invention proposes a method for extracting and recognizing text in an image, and the specific operation steps are as follows:

[0075] S1: First, multiple input complete font images are compared and matched with a preset multi-font database to obtain a font database with the highest matching degree with the current target object as a target font database;

[0076] S2: calling the matching target font database;

[0077] S3: Obtain a complete font image to be detected, and identify the complete font image to be detected with a target font database to obtain a first recognition result target character;

[0078] S4: Acquire a historical sample image database, collect multiple target object input historical sample images corresponding to the first recognition result target word; use the complete font image to be detected as the current input image, and use the multiple target object input historical sample images corresponding to the first recognition result target word as the target prediction image; perform pixel point recognition processing on the complete font image to be detected and the multiple target object input historical sample images to obtain pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected;

[0079] S5: Calculate similarity feature parameters according to pixel information of the target object input history sample image and pixel information of the complete font image to be detected;

[0080] S6: According to the similarity feature parameters, determine the target object input history sample image with the highest matching degree among multiple target object input history sample images, and then determine the target final text in the target object input history sample image with the highest matching degree; judge the target final text with the first recognition result target text, if it is determined that the target final text and the first recognition result target text are the same text, then the secondary judgment result is correct; the judgment result of the first recognition result target text is regarded as the final judgment result output and sent.

[0081] It should be noted that: a target font database is obtained based on multiple input complete font images and a preset multi-font database, the target font database includes the text recognition results of the complete font images to be detected (i.e., the first recognition result target word), and the first verified text result is obtained; and then a plurality of target object input historical sample images with high similarity to the first recognition result target word are obtained by obtaining a historical sample image database;

[0082] Obtain a complete font image to be detected. There may be a variety of written characters in the complete font image to be detected, including cursive cursive characters and clear characters (including various written text forms such as Songti, regular script, cursive script, etc.); match multiple target object input history sample images with various written characters that may exist in the complete font image to be detected;

[0083] A similarity match is performed again with the complete font image to be detected based on multiple target object input history sample images, and the text in the target object input history sample image with higher similarity matching is used as the target final text in the complete font image to be detected, and a second verification text result is obtained;

[0084] Then, based on the two verification results of the text (i.e., the first recognition result target word and the target final text are verified), it is determined whether they are the same text. If they are the same text, the judgment result is the correct output and sending result. Through the two verification results, the efficiency of each verification can be accelerated in each verification without too much complexity; and the verification of the last two results improves the accuracy of the text.

[0085] Specifically, Figure 2 As shown, in step S5, similarity feature parameters are calculated based on the pixel information of the target object input history sample image and the pixel information of the complete font image to be detected. The specific operation steps are as follows:

[0086] S51: extracting text features through pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected, wherein the text features include font features, stroke features, and corner features;

[0087] S52: confirming the font features in the text features of the pixel information of the complete font image to be detected; confirming the calligraphy form and the text identification attribute result of the complete font image to be detected through the font features (that is, there are only two types of text identification attribute results, one is to determine that the target in the complete font image is a text, and the other may be to determine that the target in the complete font image is not a text, that is, it may be a symbol);

[0088] S53: Determine the stroke features based on the calligraphy form of the font features and the results of the character identification attributes. In the initial state, first use the initial detection model (i.e., a conventional image recognition model) to initially identify the stroke features to obtain the initial recognition result of the current stroke. Based on the initial recognition result of the current stroke and the results of the character identification attributes, further determine whether there may be connected stroke features in the stroke features corresponding to the font of the complete font picture to be detected;

[0089] It should be noted that since the complete font picture to be detected contains various forms of characters, it is necessary to judge the font features of the characters in the complete font picture to be detected, and determine whether the characters are clear characters written stroke by stroke or in the form of cursive script. After determining the writing form of the characters, then detect the strokes according to the character features of the writing form to determine the characters;

[0090] First, confirm the font features in the pixel point information of the complete font picture to be detected. Determine the calligraphy form of the font in the complete font picture to be detected through the font features, whether it is written in the calligraphy form of official script, regular script, Song typeface, or cursive script, and determine whether the handwriting in the complete font picture to be detected is a character (that is, it may also be a punctuation mark, so it is necessary to determine the calligraphy form and character identification attribute results of the complete font picture); and at the same time, determine the stroke features of the font of the complete font picture to be detected according to the calligraphy form of the font features and the characters (that is, each character will have specific strokes. For example, the "white" and "告" in "皓"; the "氵" and "告" in "浩", the upper and lower "口" in "吕", etc. These characters have specific strokes; the stroke features can be determined based on these characters); at the same time, determine whether there is a connected stroke situation in the writing process of each stroke of each character according to the results of the character identification attributes and the stroke features of each stroke (that is, first, if the result of the character identification attribute is a character, then continue to judge the stroke features of each stroke, and then further judge, for example, the "氵" in "浩". Of course, the above "氵" can also be commonly known as the three-point water radical, which is very likely to be written as a connected stroke, so it is considered that there may be a connected stroke feature. However, when the character "一" is written in a connected way, it is still "一", so it is considered that there is no connected stroke feature), that is, if the initial recognition result of the current stroke of the complete font picture to be detected determines that the stroke is suspected to be "氵", then it is considered that there may be a connected stroke feature; if the initial recognition result of the current stroke of the complete font picture to be detected determines that the stroke is suspected to be "一", then it is considered that there is no connected stroke feature, and then further judgment and processing are carried out;

[0091] S54: Further, determine the intersection points where the stroke trajectories are connected according to the current suspected connected stroke features, count the number of intersection points where the stroke trajectories are connected, and determine it as the actual number of corner points;

[0092] Obtain the initial recognition result of the current stroke, and call the preset corner point quantity threshold d corresponding to the initial recognition result of the current stroke (that is, if the initial recognition result of the current stroke of the complete font image to be detected is "氵", then the corresponding preset corner point quantity threshold is 0; usually the number of angles after its connected strokes may be 2-3; as Figure 3 shown; if the initial recognition result of the current stroke is the left "纟" in "红", also known as "screw silk side", then the corresponding preset corner point quantity threshold is 3 (that is, the number of corner points corresponding to the standard writing of "纟" is 3), usually the number of angles after its connected strokes may be 4; as Figure 4 shown), and determine whether the actual number of corner points is equal to the (standard) preset corner point quantity threshold d; in Figure 3 and Figure 4 's schematic diagrams, normal strokes are represented by T in "Ture", connected strokes are represented by L, and the positions of corner points can be represented by J; for example, Figure 3 shows the comparison effect diagram of the corner points of the normal stroke and the connected stroke of the same "纟", Figure 3 the left side in Figure 3 is the corner point diagram of the normal stroke,

[0093]

[0094]

[0095]

[0096] S55: Judge the connected stroke feature directly for the pixel point information of the multiple target object input historical sample images according to the text feature extracted from the pixel point information of the target object input historical sample image, and judge the number of corner points of the stroke trajectory according to the connected stroke feature of the target object input historical sample image;

[0096] It should be noted that the target object input historical sample image is a comparison historical sample image, the text in the image is clearly visible, clear text stroke by stroke, and it is clearly known what the text is; therefore, for the font in the target object input historical sample image, determine the final "stroke pause, hook,捺" and other arcs according to the font feature, stroke feature, and corner point feature to determine the angle of the font, and thus determine the corner points according to the angle;

[0097] S56: calculating the similarity of connected stroke features through the text features of the target object input history sample image and the complete font image to be detected, and calculating the similarity of corner point features through the number of corner points;

[0098] It should be noted that multiple target objects are input into the historical sample images and the text features of the complete font image to be detected are mapped into the vector space. The vector space will contain complete and clear text and unclear text with connected strokes. The font of the complete font image to be detected is determined by calculating the similarity of the connected stroke features and the similarity of the number of corner points.

[0099] Specifically, Figure 5 As shown, in step S56, the similarity of the connected stroke features and the similarity of the number of corner points are calculated through the text features of the target object input history sample image and the complete font image to be detected. The specific operation steps are as follows:

[0100] S561: Mapping the text features of the multiple target object input historical sample images and the complete font image to be detected into a vector space to form a target text vector space and a text vector space to be detected; performing a cross division on the text vector space to obtain a target text vector block and a text vector block to be detected;

[0101] It should be noted that when the text features of multiple target object input historical sample images and the complete font image to be detected are mapped in the vector space, a text vector space is formed; the text vector space includes the font features, stroke features and corner point features of the two (that is, it is equivalent to mapping the text in the vector space to form a vector space of the text), and by cross-segmenting the text vector space, 4 target text vector blocks of the target text vector space and 4 to-be-detected text vector blocks of the to-be-detected text vector space are obtained; each text vector block contains part of the connected stroke features and the number of corner points, and the similarity is calculated by separately performing the connected stroke features and the number of corner points on the segmented text vector blocks to reduce the difficulty of the overall similarity calculation on the target object input historical sample image and the complete font image to be detected. The segmented text vector blocks can reduce the amount of calculation and speed up the calculation of similarity;

[0102] S562: using the Harris corner detection algorithm to traverse each to-be-detected text vector block (i.e., the to-be-detected text vector space is formed after the complete font image to be detected is mapped into the vector space, and is divided into 4 to-be-detected text vector blocks o1, o2, o3, and o4; the 4 to-be-detected text vector blocks divided in each target text vector space must be smoothed separately) to obtain the (x, y) coordinate pixel points in the to-be-detected text vector block, calculate the gradients of the (x, y) coordinate pixel points of the to-be-detected text vector block in the x-axis direction and the y-axis direction, and construct a covariance matrix for each pixel point in the x-axis direction and the y-axis direction;

[0103] It should be noted that by smoothing the text vector block to be detected, the edge position of the text vector block to be detected can be removed for noise. When the font is segmented at the edge of the text vector block to be detected, the corner point calculation error will occur, and the corner point judgment will be wrong, so the noise is removed by smoothing; and the covariance matrix is ​​constructed by calculating the gradients in the x-axis direction and the y-axis direction. The covariance matrix can be used to calculate the corner points better and faster;

[0104] S563: Calculate the key value of the text vector block to be detected by using the covariance matrix, weight the covariance matrix by a Gaussian function, and obtain the key value of the covariance matrix by weighted calculation;

[0105] It should be noted that the covariance matrix is ​​weighted by a Gaussian function. The weighting of the covariance matrix by the Gaussian function can improve the smoothing reaction speed when calculating the gradient; and the key value of each pixel point in the x-axis direction and the y-axis direction can also be calculated. By judging the size of the key values ​​in the two directions, it is determined whether a corner point appears;

[0106] At the same time, the pixel texture of the font is very strong, which leads to large gradient changes in the font area. The key value can be used to reflect the degree of pixel change in the font area and effectively identify the corner points;

[0107] S564: Preset a key value threshold e, and determine whether the key value of the covariance matrix is ​​greater than the key value threshold e; if the key value of the covariance matrix is ​​less than the key value threshold e, determine that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​equal to the key value threshold e, determine that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​greater than the key value threshold e, determine that there are corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected;

[0108] It should be noted that the determination of corner points is related to the gradient distribution and variation degree of the pixel points of the key points on the text vector block to be detected; therefore, the key value size of the font area in the x-axis direction and the y-axis direction is determined by presetting the key value threshold e;

[0109] If the key value is less than the key value threshold e, it means that the key values ​​in the x-axis direction and the y-axis direction are particularly small, indicating that there is no corner point in the font area (that is, because the gray value of the pixel point changes slightly, the gradient change of all font areas is not obvious; at the same time, when calculating the eigenvalue of the font area, the gradient change of the pixel point in both the x-axis direction and the y-axis direction is relatively small, resulting in the calculated two eigenvalues ​​are also small, so there is no corner point in the self-extracted area);

[0110] If the key value is equal to the key value threshold e, it means that the key values ​​in the x-axis direction and the y-axis direction are one large and one small, and there is no corner point; when the corner point is at the edge of the font area, the gradient amplitude of the pixel point in a specific direction will change very obviously, while the change in the other direction is relatively weak (that is, the gradient change in the x-axis direction is obvious, and the gradient change in the y-axis direction is not obvious), indicating that the uneven distribution of gradients causes one key value to be relatively large and the other to be small when calculating the key value;

[0111] If the key value is greater than the key value threshold e, it means that when both key values ​​are large, the gradient of the pixels in the x-axis and y-axis directions of the font area changes rapidly, proving that there is a corner point;

[0112] S565: Calculate all corner points according to steps S562 to S564, count the number of the corner points, and obtain the number of corner points of each text vector block to be detected;

[0113] S566: directly counting the number of corner points of the target text vector block to obtain the number of corner points of each target text vector block (i.e., after each target object is input into the historical sample image mapping vector space, the target text vector space is obtained and divided into 4 target text vector blocks; if multiple target objects are input into the historical sample images, N target text vector blocks are obtained, and the number of corner points of each target text vector block is obtained by counting);

[0114] It should be noted that the target object input historical sample image is a historical sample font in the database, the text is clearly visible, and each corner point and stroke trajectory of the text can be observed, so there is no need to perform specific calculation of the corner points of the target text vector block using the corner detection algorithm.

[0115] S567: traverse each of the to-be-detected text vector blocks and perform similarity matching on the number of corner points with each of the target text vector blocks, preset a similarity threshold f for the number of corner points, and determine whether the similarity of the number of corner points is less than the similarity threshold f for the number of corner points; if so, the similarity matching of the number of corner points is successful; if not, the target text vector block is eliminated, and the target object input historical sample image of the target text vector block is correspondingly eliminated;

[0116] When the similarity of the number of corner points of each to-be-detected character vector block and each target character vector block in the target character vector space and the to-be-detected character vector space is successfully matched, the target character vector space and the to-be-detected character vector space are matched for similarity of connected strokes, a connected stroke similarity threshold g is preset, and it is determined whether the connected stroke similarity is less than the connected stroke similarity threshold g; if so, the target character vector space is retained; if not, the target character vector space that fails to match is eliminated;

[0117] The target final text in the target object input history sample image of the target text vector space with the largest similarity is the target final text of the complete font image to be detected;

[0118] It should be noted that if the similarity matching of the number of corner points is unsuccessful, the target text vector block that fails to match is eliminated, and the entire target object input history sample image is eliminated at the same time. In addition, due to the connected strokes, the connected strokes of the fonts will be different. At the same time, due to the cross division of the target text vector space and the text vector space to be detected, the number of corner points in the text vector block corresponding to each text vector block to be detected and each target text vector block will be different, so the matching similarity method is adopted for matching;

[0119] At the same time, all successfully matched vector blocks of each character to be detected are re-merged with each target character vector block, and the connected strokes are determined by connecting the corner points. The similarity is then determined by the connected strokes, so that the target final text in the target object input historical sample image with the highest matching degree is selected as the target final text of the complete font image to be detected.

[0120] Specifically, Figure 6 As shown, in step S567, the target text vector space and the to-be-detected text vector space are matched for similarity of connected strokes, and the specific operation steps are as follows:

[0121] S5671: The corners are connected by stroke trajectories, and the stroke trajectories between all adjacent pairs of corners are traversed and disassembled; the target stroke trajectories are obtained by disassembling between the corners of the target text vector block, and the to-be-detected stroke trajectories are obtained by disassembling between the corners of the to-be-detected text vector block;

[0122] Explanation: The stroke trajectory has stroke trajectory direction and stroke trajectory quantity characteristics, forming a connected stroke;

[0123] S5672: When the similarity of the number of corners is successfully matched, the similarity of the trajectory features between the target stroke trajectories of the target text vector block and the to-be-detected stroke trajectories of the to-be-detected text vector block is traversed and matched (that is, there may be multiple corners in the font of the text, and there is a stroke trajectory between adjacent corners. When the stroke trajectories are connected to each other, a complete text is formed;

[0124] For example, for the character "口", there are 4 corners, and the stroke trajectories between the 4 corners are connected to each other to form three strokes) as Figure 7 shown; the similarity calculation formula for the corresponding trajectory features (that is, the formula for calculating the similarity between the target stroke trajectory and the to-be-detected stroke trajectory) is:

[0125] ;

[0126] In the formula, represents the similarity of the trajectory features between the target stroke trajectory of the th target text vector block in the th target text vector space and the to-be-detected stroke trajectory of the to-be-detected text vector block, represents the relative position feature of the four-grid where the trajectory feature of the target stroke trajectory of the th target text vector block in the th target text vector space belongs and the relative position feature of the four-grid where the trajectory feature of the to-be-detected stroke trajectory of the to-be-detected text vector block belongs;

[0127] represents the similarity of the total number of start and end points features where the trajectory feature of the target stroke trajectory of the th target text vector block in the th target text vector space belongs and the total number of start and end points features where the trajectory feature of the to-be-detected stroke trajectory of the to-be-detected text vector block belongs;

[0128] ; is the sum of the target text vector block and the text vector block to be detected; in the above formula, because step S561 has been explained in the execution process that "the text vector space is cross-divided to obtain the target text vector block and the text vector block to be detected", it is said that after a text vector space is cross-divided, a field-like area will be obtained, thereby forming 4 target text vector blocks; therefore, natural number between; at the same time, the following factors are taken into account when calculating the target stroke trajectory and the stroke trajectory to be detected: the similarity of the trajectory features and the similarity of the relative position features of the four-square grid to which the trajectory features belong and the total number of starting and ending points (ie, geometric features); the first The first target word vector space The target stroke trajectory of the target text vector block refers to: there are multiple historical sample images of the target object input, and the target text vector space of each historical sample image of the target object input has four target text vector blocks t1, t2, t3, and t4; and the vector space of the text to be detected only corresponds to one complete font image to be detected, so there are four text vector blocks o1, o2, o3, and o4 to be detected;

[0129] It should be noted that the total number of starting and ending points feature refers to extracting the geometric features of the handwriting, such as the starting point and the ending point of the stroke, and then evaluating the handwriting similarity by calculating the similarity between these geometric features (the total number of starting and ending points features). It is generally believed that the total number of 5 starting and ending points is similar to the total number of 6 starting and ending points, but the total number of 5 starting and ending points and the total number of 8 starting and ending points may finally be determined to be dissimilar in features, that is, the difference is large.

[0130] Preset a trajectory feature similarity threshold j, and determine whether the trajectory feature similarity between the stroke trajectory to be detected and the target stroke trajectory is less than the total similarity threshold j;

[0131] If so, the target text vector space of the target text vector block is retained (that is, because the target stroke trajectory of the target text vector block is traversed, the similarity matching of the stroke trajectories is performed on the four target text vector blocks in the target text vector space. When the similarity matching of the target stroke trajectories of the four target text vector blocks and the stroke trajectories to be detected of the four corresponding text vector blocks to be detected in the text vector space to be detected is successful, the target object input history sample image of the corresponding target text vector space is retained);

[0132] If not, the target text vector block of the target stroke trajectory that does not match the similarity is eliminated, and the target text vector space corresponding to the target text vector block (that is, the target object input history sample image corresponding to the target text vector space) is eliminated;

[0133] The trajectory features include trajectory quantity features (generally speaking, trajectory features may include trajectory direction features and trajectory quantity features, but the embodiment of the present application mainly further extracts trajectory quantity features);

[0134] It should be noted that when the font is connected with strokes, many corner points may be formed, and the stroke trajectories are connected between the corner points, and the connected strokes are separated due to the segmented text vector blocks. Therefore, when the number of corner points of the target text vector block is close to the number of corner points of the text vector block to be detected, the length feature of the stroke trajectory is matched first, which can improve the detection speed, and the detection accuracy is greatly improved through the similarity matching of the number of corner points and the similarity matching of the stroke trajectory.

[0135] At the same time, since the number of corner points of the target text vector block is close to that of the text vector block to be detected, but not necessarily the same, the number of target stroke trajectories of the target text vector block and the text vector block to be detected is not necessarily the same as the number of stroke trajectories to be detected. Therefore, it is necessary to perform similarity matching not only on the length features, but also on the number.

[0136] S5673: When the similarity between the stroke trajectory to be detected and the target stroke trajectory is successfully matched, each vector block of the character to be detected is re-merged with each vector block of the target character;

[0137] Determine the direction of the stroke trajectory to be detected and the direction of the target stroke trajectory; determine the direction of the stroke trajectory to be detected and the direction of the target stroke trajectory; connect all corner points in the vector space of the character to be detected with the stroke trajectory to obtain the connected strokes to be detected; connect all corner points in the vector space of the target character with the target stroke trajectory to obtain the target connected strokes;

[0138] It should be noted that the to-be-detected character vector block and each target character vector block are formed by cross-dividing the to-be-detected character vector space and the target character vector space. When the target character vector block is screened twice by the number of corner points and the stroke trajectory, it is merged again into the target character vector space, and the target character vector space that meets the higher similarity is retained for similarity matching of connected strokes, which can reduce the large workload of directly performing similarity matching calculation of connected strokes and improve the detection speed.

[0139] The direction of the stroke trajectory is determined by the method of direction vector and gradient, and the stroke trajectory to be detected and the target stroke trajectory are connected through corner points to obtain the connected strokes to be detected and the target connected strokes;

[0140] In summary, the above technical solution is executed in a progressive relationship. First, the "verify the stroke trajectory first" in step S5672 should be executed, and the merger between the vector blocks of the characters to be detected and the characters between the vector blocks of the target characters in the subsequent progressive step S5673 are performed through the similarity of the higher stroke trajectories to form complete connected strokes to be detected and target connected strokes, and the similarity of the connected strokes of the two is calculated through the subsequent step S5674, so as to determine the target final characters of the complete font image to be detected;

[0141] In step S562, the gradient of each pixel is calculated by the coordinate x-axis direction and the y-axis direction; two adjacent corner points are connected by the direction vector, and the direction derivative is obtained by multiplying the gradient by the direction vector, and the angle between the stroke trajectories is solved by the direction derivative, and the direction of the stroke trajectory is determined by the angle (determining the direction of the stroke trajectory by the direction vector and the gradient is a prior art and will not be described in detail);

[0142] S5674: performing similarity matching between the connected strokes to be detected and the target connected strokes, and the similarity calculation formula between the connected strokes to be detected and the target connected strokes is:

[0143] ; In the formula, Expressed as The similarity between the target connected strokes in the target text vector space and the connected strokes to be detected in the text vector space to be detected (i.e., the similarity between the connected strokes to be detected and the target connected strokes), Indicates The target stroke trajectory in the target text vector space, represents the stroke trajectory to be detected in the vector space of the text to be detected, Represents the comparison coefficient between the target stroke trajectory and the stroke trajectory to be detected; Indicates The first The target stroke trajectories are connected to each other through corner points to form the target connected strokes. Represents the first The stroke trajectories to be detected are connected to each other through corner points to form connected strokes to be detected; is a constant.

[0144] A connected stroke similarity threshold d is preset, and it is determined whether the similarity between the connected stroke to be detected and the target connected stroke is less than the connected stroke similarity threshold d; if not, the similarity matching between the connected stroke to be detected and the target connected stroke fails, and the target object input history sample image of the target text vector space is eliminated; if so, the target object input history sample image corresponding to the target text vector space with successful matching is retained, and the target final text in the target object input history sample image with the highest similarity is determined as the target final text of the complete font image to be detected;

[0145] It should be noted that the similarity between the connected strokes to be detected and the target connected strokes is obtained by a calculation formula, and the connected strokes similarity threshold d is used to once again screen out multiple target object input history sample images with successful connected stroke similarity matching, and the target object input history sample image with the highest similarity is selected from the multiple target object input history sample images to be determined as the target final text of the complete font image to be detected. Embodiment 2

[0146] like Figure 8 As shown, accordingly, the present invention also proposes a system for extracting and identifying characters in a picture, comprising: a database acquisition module 10, a first recognition target module 20, a text information detection module 30, a similarity matching module 40, a final target font module 50, and an output result font module 60;

[0147] The database acquisition module 10 is used to first compare and match multiple input complete font images with a preset multi-font database, obtain the font database with the highest matching degree with the current target object as the target font database; and call the matching target font database;

[0148] The first target recognition module 20 is used to recognize the complete font image to be detected and the target font database to obtain a first recognition result target word when detecting the complete font image to be detected input by the target object;

[0149] The text information detection module 30 is used to obtain a historical sample image database, collect multiple target object input historical sample images corresponding to the first recognition result target word; use the complete font image to be detected as the current input image, and use the multiple target object input historical sample images corresponding to the first recognition result target word as the target prediction image; perform pixel point recognition processing on the complete font image to be detected and the multiple target object input historical sample images to obtain pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected;

[0150] The similarity matching module 40 is used to calculate similarity feature parameters according to the pixel information of the target object input history sample image and the pixel information of the complete font image to be detected;

[0151] The final target font module 50 is used to determine the target object input history sample image with the highest matching degree among multiple target object input history sample images according to the similarity feature parameters, and then determine the target final text in the target object input history sample image with the highest matching degree;

[0152] The output result font module 60 is used to judge the target final text and the first recognition result target text. If it is determined that the target final text and the first recognition result target text are the same text, the secondary judgment result is correct; the judgment result of the first recognition result target text is regarded as the final judgment result and output and sent. Embodiment 3

[0153] like Fig. 9 As shown, on the other hand, this embodiment three is based on a method for extracting and recognizing characters from an image provided in the embodiment one of the invention, and further provides a computer storage medium 1140 (storage medium for short).

[0154] A schematic diagram of a computer storage medium structure framework provided in Embodiment 3 of the present invention includes:

[0155] A memory 1130, used for storing computer programs;

[0156] The communication interface 1120 is used to connect the memory 1130 to the processor 1110;

[0157] Processor 1110 is used to execute a computer program to implement a method for extracting and recognizing text in an image involved in Example 1 disclosed in combination with any of the above-mentioned implementation methods.

[0158] It will be understood that the embodiments described herein may be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof.

[0159] For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits, digital signal processors, digital signal processing devices, programmable logic devices, field programmable gate arrays, general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.

[0160] For software implementation, the techniques described herein may be implemented by units that perform the functions described herein.

[0161] The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.

[0162] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware.

[0163] Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution.

[0164] Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0165] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0166] In summary, the present invention proposes a method for extracting and identifying characters from images. The method first obtains a target font database with the highest completeness, and matches the target font database with the complete font image to be detected to obtain a first recognition result target character (i.e., the first recognized character). The first recognition result target character obtained first can be used to determine what the character of the complete font image to be detected may be. Subsequently, multiple target object input history sample images with high similarity to the complete font image to be detected are obtained from the historical sample image database, and then a second determination is made as to what the specific character of the complete font image to be detected is. Based on the similarity between the complete font image to be detected and multiple target object input history sample images, the target object input history sample image with the highest similarity is selected as the target final character of the complete font image to be detected, and the character of the complete font image to be detected is confirmed for a second time. The final result is outputted by determining that the first recognition result target character and the target final character are the same character. The accuracy of the detected characters is improved by judging the characters twice.

[0167] Further, the pixel point information of the historical sample image input by the target object and the pixel point information of the complete font image to be detected are used to extract text features, and the calligraphy form and text identification attribute results of the complete font image to be detected are confirmed through the font features in the text features to determine whether it is real text, and then the calligraphy form is determined to be Songti; Kaishu, etc. through the real text; and the stroke features are further initially recognized to determine whether the stroke features may have connected stroke features, and the number of corner points at the connection of the stroke trajectory is determined through the possible existence of connected stroke features; and the similarity is calculated through the connected stroke features and the number of corner points obtained with the complete font image to be detected to obtain the result of recognizing the text;

[0168] Furthermore, the text features of multiple target object input historical sample images and the complete font image to be detected are mapped into vector space, and the target text vector block and the text vector block to be detected are obtained by cross segmentation, and the corresponding text vector blocks are calculated separately to improve the speed of text detection; Harris corner point detection algorithm is used to traverse each text vector block to be detected for smoothing, and the gradients in the x-axis direction and the y-axis direction are calculated to construct a covariance matrix, and the corner points can be calculated better and faster through the covariance matrix; and the key value is weighted to calculate the covariance matrix; the corner points on the pixel points are effectively identified through the key value; the number of corner points is counted to perform similarity matching of the number of corner points of the target text vector block, and when all the text vector blocks to be detected are successfully matched with each corresponding target text vector block, the similarity of the connected strokes of the target text vector space and the text vector space to be detected is determined, and the target final text in the target object input historical sample image of the target text vector space with the largest similarity is determined to be the target final text of the complete font image to be detected;

[0169] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. A person skilled in the art may modify the technical solutions described in the above embodiments, or replace part or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for extracting and recognizing text in images. It is characterized in that The steps are as follows: Firstly, multiple input complete font images are compared and matched with a preset multi-font database, and the font database with the highest matching degree with the current target object is obtained as the target font database; Calling the matching target font database; Obtain a complete font image to be detected, and identify the complete font image to be detected with a target font database to obtain a first recognition result target character; Acquire a historical sample image database, and collect a plurality of historical sample images of target object input corresponding to the first recognition result target word; The complete font image to be detected is used as the current input image, and multiple target object input history sample images corresponding to the first recognition result target word are used as the target prediction image; pixel point recognition processing is performed on the complete font image to be detected and the multiple target object input history sample images to obtain pixel point information of the target object input history sample image and pixel point information of the complete font image to be detected; Calculate similarity feature parameters based on pixel information of the target object input history sample image and pixel information of the complete font image to be detected; Determine, according to the similarity feature parameter, a target object input history sample image with the highest matching degree among the multiple target object input history sample images, and then determine the target final text in the target object input history sample image with the highest matching degree; The target final character is judged against the target character of the first recognition result. If it is determined that the target final character and the target character of the first recognition result are the same character, the secondary judgment result is correct. The determination result of the first recognition result target word is regarded as the final determination result and outputted and sent; Based on the pixel information of the target object input historical sample image and the pixel information of the complete font image to be detected, the similarity feature parameters are calculated. The specific operation steps are as follows: Extracting text features through pixel point information of the target object input historical sample image and pixel point information of the complete font image to be detected, wherein the text features include font features, stroke features, and corner features; Confirming the font features in the text features of the pixel point information of the complete font image to be detected; confirming the calligraphy form and text identification attribute results of the complete font image to be detected through the font features; The stroke features are determined by the calligraphy form of the font features and the text identification attribute results. In the initial state, the stroke features are firstly initially identified using the initial detection model to obtain the initial recognition results of the current strokes. According to the initial recognition results of the current strokes and the text identification attribute results, it is further determined whether there may be connected stroke features in the stroke features corresponding to the font of the complete font image to be detected; Further, according to the current suspected connected stroke features, the intersection points where the stroke trajectories are connected are determined, and the number of the intersection points where the stroke trajectories are connected is counted to determine the number of actual corner points; Obtaining an initial recognition result of the current stroke, calling a preset corner point number threshold d corresponding to the initial recognition result of the current stroke, and determining whether the actual number of corner points is equal to the preset corner point number threshold d; If yes, the number of corner points of the complete font image to be detected is retained, that is, the number of corner points is determined to be normal; If not, the stroke feature used to determine the current character feature is finally identified as a connected stroke feature, and the number of corner points of the stroke trajectory of the connected stroke feature is extracted; Directly judging the connected stroke features of the pixel point information of the plurality of target object input history sample images according to the text features extracted from the pixel point information of the target object input history sample images, and judging the number of corner points of the stroke trajectory according to the connected stroke features of the target object input history sample images; The similarity of connected stroke features is calculated by using the text features of the target object input history sample image and the complete font image to be detected, and the similarity of corner point features is calculated by using the number of corner points.

2. According to the method for extracting and recognizing text in an image according to claim 1, It is characterized in that The similarity of the connected stroke features and the similarity of the number of corner points are calculated by using the text features of the target object input historical sample image and the complete font image to be detected. The specific operation steps are as follows: Mapping the text features of the multiple target objects input into the historical sample images and the complete font images to be detected into a vector space to form a target text vector space and a text vector space to be detected; cross-segmenting the text vector space to obtain a target text vector block and a text vector block to be detected; Use the Harris corner detection algorithm to traverse each text vector block to be detected for smoothing, obtain the (x, y) coordinate pixel point in the text vector block to be detected, calculate the gradient of the (x, y) coordinate pixel point of the text vector block to be detected in the x-axis direction and the y-axis direction, and construct a covariance matrix for each pixel point in the x-axis direction and the y-axis direction; Calculating the key value of the text vector block to be detected by using the covariance matrix, weighting the covariance matrix by a Gaussian function, and obtaining the key value of the covariance matrix by weighted calculation; A key value threshold e is preset to determine whether the key value of the covariance matrix is ​​greater than the key value threshold e; if the key value of the covariance matrix is ​​less than the key value threshold e, it is determined that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​equal to the key value threshold e, it is determined that there are no corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; if the key value of the covariance matrix is ​​greater than the key value threshold e, it is determined that there are corner points on the pixel points in the x-axis direction and the y-axis direction of the coordinate pixel points of the text vector block to be detected; According to the above steps, all corner points are calculated, and the number of the corner points is counted to obtain the number of corner points of each text vector block to be detected; Directly counting the number of corner points of the target text vector block to obtain the number of corner points of each target text vector block; Traverse each of the to-be-detected text vector blocks and each of the target text vector blocks to perform similarity matching on the number of corner points, preset a similarity threshold f for the number of corner points, and determine whether the similarity of the number of corner points is less than the similarity threshold f for the number of corner points; if so, the similarity matching of the number of corner points is successful; if not, the target text vector block is eliminated, and the target object input historical sample image of the target text vector block is correspondingly eliminated; When the similarity of the number of corner points of each to-be-detected character vector block and each target character vector block in the target character vector space and the to-be-detected character vector space are successfully matched, the target character vector space and the to-be-detected character vector space are matched for similarity of connected strokes, a connected stroke similarity threshold g is preset, and it is determined whether the connected stroke similarity is less than the connected stroke similarity threshold g; If yes, the target text vector space is retained; if no, the target text vector space that fails to match is discarded; The target final text in the target object input history sample image of the target text vector space with the largest retained similarity is the target final text of the complete font image to be detected.

3. According to the method for extracting and recognizing text in an image as claimed in claim 2, It is characterized in that The target text vector space and the to-be-detected text vector space are matched for similarity of connected strokes. The specific operation steps are as follows: The corner points are connected by stroke trajectories, and the stroke trajectories between all two adjacent corner points are traversed for disassembly; the corner points of the target text vector block are disassembled to obtain the target stroke trajectory, and the corner points of the to-be-detected text vector block are disassembled to obtain the to-be-detected stroke trajectory; When the similarity of the number of corner points is successfully matched, the target stroke trajectory of the target text vector block is traversed to match the similarity of the trajectory features with the stroke trajectory to be detected of the text vector block to be detected; the similarity between the target stroke trajectory and the stroke trajectory to be detected is calculated; Preset a trajectory feature similarity threshold j, and determine whether the trajectory feature similarity between the stroke trajectory to be detected and the target stroke trajectory is less than the total similarity threshold j; If so, retain the target text vector space of the target text vector block; If not, the target text vector block of the target stroke trajectory that does not match the similarity is eliminated, and the target text vector space corresponding to the target text vector block is eliminated; When the similarity between the stroke trajectory to be detected and the target stroke trajectory is successfully matched, each vector block of the character to be detected is re-merged with each vector block of the target character; Determine the direction of the trajectory of the stroke to be detected and the direction of the target stroke trajectory; connect all corner points in the vector space of the character to be detected with the trajectory of the stroke to be detected to obtain the connected strokes to be detected; connect all corner points in the vector space of the target character with the trajectory of the target stroke to obtain the target connected strokes; perform similarity matching on the connected strokes to be detected and the target connected strokes, and calculate the similarity between the connected strokes to be detected and the target connected strokes; Preset a connected stroke similarity threshold d, and determine whether the similarity between the connected stroke to be detected and the target connected stroke is less than the connected stroke similarity threshold d; If not, the similarity match between the connected strokes to be detected and the target connected strokes fails, and the target object input history sample image of the target text vector space is eliminated; if so, the target object input history sample image corresponding to the successfully matched target text vector space is retained, and the target final text in the target object input history sample image with the highest similarity is determined to be the target final text of the complete font image to be detected.

4. According to claim 3, a method for extracting and recognizing text in an image, It is characterized in that The trajectory features include trajectory quantity features.

5. According to the method for extracting and recognizing text in an image as claimed in claim 4, It is characterized in that The formula for calculating the similarity between the target stroke trajectory and the stroke trajectory to be detected is: ; In the formula, Indicates The first target word vector space The similarity between the target stroke trajectory of the target text vector block and the trajectory feature of the stroke trajectory to be detected of the text vector block to be detected, Indicates The first target word vector space The four-square relative position feature to which the trajectory feature of the target stroke trajectory of the target character vector block belongs and the four-square relative position feature to which the trajectory feature of the stroke trajectory to be detected of the character vector block to be detected belongs; Indicates the current The first target word vector space similarity between the total number of starting and ending points of the trajectory feature of the target stroke trajectory of the target character vector block and the total number of starting and ending points of the trajectory feature of the stroke trajectory to be detected of the character vector block to be detected; ; It is the total number of the target text vector block and the text vector block to be detected.

6. According to claim 5, a method for extracting and recognizing text in an image, It is characterized in that The formula for calculating the similarity between the connected strokes to be detected and the target connected strokes is: ; In the formula, It is represented by the similarity between the connected strokes to be detected and the target connected strokes, and is also specifically represented by the first The similarity between the target connected strokes in the target text vector space and the connected strokes to be detected in the text vector space to be detected, Indicates The target stroke trajectory in the target text vector space, represents the stroke trajectory to be detected in the vector space of the text to be detected, Indicates the comparison coefficient between the target stroke trajectory and the stroke trajectory to be detected; Indicates The first The target stroke trajectories are connected to each other through corner points to form the target connected strokes. Represents the first The stroke trajectories to be detected are connected to each other through corner points to form connected strokes to be detected; is a constant.

7. A storage medium, It is characterized in that The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for extracting and recognizing text in an image as described in any one of claims 1 to 6 are implemented.