A text recognition method, storage medium and device

By splicing and filling the text line images in the text image, the problem of low recognition efficiency caused by the small text line width and small content is solved, and the recognition efficiency is improved.

CN115082938BActive Publication Date: 2024-09-27GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110267493.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-12
Publication Date
2024-09-27
Estimated Expiration
2041-03-12

AI Technical Summary

Technical Problem

In the text image recognition process, due to the small line width and less content of the text lines, a large number of blank pixels need to be identified, which reduces the recognition efficiency.

Method used

By extracting at least two text line images from the text image, processing them in a splicing manner, filling the blank pixels to reach the specified width value, reducing the generation of redundant blank pixels, thereby improving the recognition efficiency.

Benefits of technology

It minimizes the redundancy of blank pixels, reduces the consumption of recognition resources and time, and improves the recognition efficiency of text images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082938B
    Figure CN115082938B
Patent Text Reader

Abstract

The present application discloses a text recognition method, storage medium and device, wherein the method comprises: extracting at least two text line images from a text image; splicing the at least two text line images based on a specified width value and using a splicing method to obtain a first splicing image set; filling each first splicing image in the first splicing image set based on blank pixels to obtain a second splicing image set, wherein the width value of each second splicing image in the second splicing image set meets the specified width value; performing parallel text recognition on each second splicing image to obtain an initial text recognition result; wherein the splicing method is used to minimize the number of blank pixels in the filling process. By using the present application, the redundancy generated by the filled blank pixels can be reduced, thereby reducing the resources and time consumed in identifying the blank pixels, and improving the efficiency of text recognition for text images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a text recognition method, storage medium and device. Background Art

[0002] With the continuous development and popularization of computer technology, it is very common to use terminal applications installed in mobile phones, computers and other terminals to recognize text content in text images in daily life. In the process of text recognition of text images, since many text lines in text images have small line width values ​​and contain less text content, it is often necessary to recognize more blank pixels for unsaturated text line content during the text recognition process, which greatly reduces the efficiency of text recognition of text images. Summary of the invention

[0003] The present application provides a text recognition method, storage medium and device, which can reduce the redundancy generated by filled blank pixels, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition on text images.

[0004] In a first aspect, an embodiment of the present application provides a text recognition method, the method comprising:

[0005] Extracting at least two text line images from the text image;

[0006] Based on the specified width value, the at least two text line images are spliced ​​in a splicing manner to obtain a first spliced ​​image set;

[0007] Filling each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0008] Performing text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0009] The splicing method is used to minimize the number of blank pixels in the filling process.

[0010] In a second aspect, an embodiment of the present application provides a text recognition device, including:

[0011] An extraction unit, used for extracting at least two text line images from the text image;

[0012] A splicing unit, configured to splice the at least two text line images based on a specified width value and in a splicing manner to obtain a first spliced ​​image set;

[0013] a filling unit, performing filling processing on each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0014] A recognition unit, configured to perform parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0015] The splicing method is used to minimize the number of blank pixels in the filling process.

[0016] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the steps of the above-mentioned method.

[0017] In a fourth aspect, an embodiment of the present application provides a computer device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.

[0018] In the embodiment of the present application, the text line images extracted from the text image are spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1 A flowchart of a text recognition method provided in an embodiment of the present application;

[0021] Figure 2 A schematic diagram of a text extraction method provided in an embodiment of the present application;

[0022] Figure 3 An exemplary schematic diagram of a text line image stitching method provided in an embodiment of the present application;

[0023] Figure 4A flowchart of a text recognition method provided in an embodiment of the present application;

[0024] Figure 5 An example schematic diagram of inserting a separation image during text line image splicing provided in an embodiment of the present application;

[0025] Figure 6 A structural diagram of a text recognition device provided in an embodiment of the present application;

[0026] Figure 7 A structural diagram of a text recognition device provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of the structure of a splicing unit provided in an embodiment of the present application;

[0028] Fig. 9 A schematic diagram of the structure of a filling unit provided in an embodiment of the present application;

[0029] Fig.10 A schematic diagram of the structure of a position restoration unit provided in an embodiment of the present application;

[0030] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to make the features and advantages of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0032] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in this application can be understood according to specific circumstances. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.

[0033] The text recognition method provided in the embodiments of the present application can be applied to text recognition devices, wherein the text recognition devices may include but are not limited to mobile phones, personal computers, laptops, smart furniture, vehicle-mounted devices, wearable devices and other terminal devices with application installation and operation functions.

[0034] The following will be combined Figure 1-Figure 3 , the text recognition method provided in the embodiment of the present application is introduced in detail.

[0035] See also Figure 1 , which provides a flow chart of a text method for an embodiment of the present application. Figure 1 As shown, the method may include the following steps S101-S104.

[0036] It should be noted that part or all of the execution body of steps S101-S104 may be an application located in the local terminal, or may also be a functional unit such as a plug-in or software development kit (SDK) set in the application located in the local terminal, or may also be a processing engine located in a network-side server, or may also be a distributed system located on the network side, for example, a processing engine or distributed system in a text recognition server on the network side, etc. The embodiments of the present application do not specifically limit this.

[0037] It is understandable that the application may be a local program (NativeApp) installed on the local terminal, or may be a web page program (WebApp) of a browser on the local terminal, which is not limited in the embodiments of the present application.

[0038] S101, extracting at least two text line images from a text image.

[0039] Specifically, the optical character recognition technology (OCR) is currently used to identify text in images. Generally speaking, the process of identifying text in an image can be divided into three steps: image preprocessing, text detection, and text recognition. Among them, the image preprocessing step includes graying, binarization, smoothing, and other processing of the image or scanned document to be identified, so that the input image is corrected and standardized. After the image is preprocessed, text detection can be performed, such as Figure 2 As shown, text detection is to locate the text area in the image, and then usually mark the words or text lines in the form of bounding boxes, so that multiple text line images can be extracted from the text image.

[0040] Before deep learning became widely popular, most traditional methods of text detection were based on manually extracted features, including stroke width transform (SWT), maximum stable extremal regions (MSER), and histogram of oriented gradients (HOG). After deep learning was widely used in computer vision tasks, text detection gradually turned to methods based on deep learning. Text detection methods based on manually extracted features are mainly bottom-up methods. This method first performs stroke or character detection, which can be based on connected components or sliding windows, and then performs a series of subsequent steps, including non-text component filtering, text line construction, and text line verification. This type of method is often based on manually designed features, such as SWT, MSER, HOG, etc., to distinguish text content from background.

[0041] After deep learning swept the field of computer vision, traditional text detection methods were gradually replaced by deep learning-based methods. From the source, deep learning-based methods can be divided into two categories: one is developed from object detection, based on candidate boxes, and the other is developed from semantic segmentation, based on image segmentation. In addition, there are text detection based on a mixture of the two methods and a few other methods.

[0042] The embodiment of the present application can extract the text line image from the text image in the above manner. The specific content of text recognition will be described in detail in the subsequent relevant parts.

[0043] S102, based on the specified width value, the at least two text line images are spliced ​​in a splicing manner to obtain a first spliced ​​image set;

[0044] Specifically, in the prior art, when recognizing text images, blank pixels are first used to fill the text lines in the text images that are not saturated with text content, and then parallel text recognition is performed on the filled images. This is a widely used method. However, this recognition method has obvious problems. That is, in the above recognition process, the content of many text lines is only half a line or even less, especially for Figure 2In the situation shown, the content corresponding to each text line image does not fill up a line. In this case, during the text recognition process, the number of blank pixels that need to be recognized may even exceed the amount of text content. The resources consumed in the text recognition process do not contribute to the final required text content. Therefore, the redundancy caused by blank pixels in the existing parallel text recognition method will make the text recognition efficiency relatively low.

[0045] In order to solve the above problem, for example, 7 text line images are extracted from the text image, and the widths are 100, 60, 50, 40, 30, 30, and 30 respectively. Figure 3 As shown, the 7 text line images extracted by the text recognition device can be reordered to 100, 60, 30, 50, 40, 30, 30 and then stitched together. The purpose of the reordering is to make the image set formed after the stitching, that is, the first image set, have the least number of blank pixel fillings, thereby minimizing the redundancy caused by the filled blank pixels and reducing the resources and time consumed in identifying blank pixels, thereby maximizing the efficiency of text recognition for text images.

[0046] It can be understood that the stitching method is to use the optimal solution algorithm to stitch the text line images in the text image, which can minimize the number of blank pixels filled in each first stitched image in the obtained first stitched image set. The optimal solution algorithm is preferably a dynamic programming algorithm.

[0047] Among them, the basic idea of ​​the dynamic programming algorithm is that if the optimal solution of the problem can be derived from the optimal solution of the sub-problem, then the optimal solution of the sub-problem can be solved first, and then the optimal solution of the original problem can be constructed; if the sub-problem appears repeatedly, it can be solved from the bottom up from the final sub-problem to the original problem. The design steps of the dynamic programming algorithm include: analyzing the structure of the optimal solution; recursively defining the cost of the optimal solution; calculating the cost of the optimal solution from the bottom up and saving it, and obtaining the information for constructing the optimal solution; constructing the optimal solution based on the information for constructing the optimal solution. The dynamic programming algorithm includes the following features: dividing the original problem into a series of sub-problems; solving each sub-problem only once, and saving its results in a table, which can be directly accessed when used later, without repeated calculations, saving calculation time; bottom-up calculation; the optimal solution of the overall problem depends on the optimal solution of the sub-problem.

[0048] Specifically, after obtaining the first stitched image set with the least filled blank pixels, the text recognition device can fill the non-text part in the first stitched image set with blank pixels. After filling, the widths of each row of the second stitched image set are completely equal, which is equal to the specified width, so as to facilitate further parallel text recognition.

[0049] S103, performing padding processing on each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0050] Specifically, Figure 3 As shown, usually, after the stitching is completed, the width of some rows in each second stitched image is less than the specified width, so blank pixels are used to fill the non-text part of each second stitched image, so that the row width value of each second stitched image reaches the specified width, thereby making the widths of each row of the second stitched image set consistent, which is helpful for the subsequent recognition process to use parallel recognition to perform overall recognition of the stitched image set. Parallel recognition here means that during the recognition process, the contents of each row in the stitched image set are simultaneously recognized within the same time period, thereby greatly improving the text recognition efficiency compared to the traditional text serial recognition method.

[0051] S104: Perform parallel text recognition on the second spliced ​​images to obtain an initial text recognition result.

[0052] Specifically, since the widths of the second stitched images are all equal after the above-mentioned blank pixel filling step, parallel text recognition can be used for recognition, which has higher recognition efficiency than the serial recognition method. The second stitched image set is essentially formed by stitching together the text line images extracted from the text image after the order is changed, so the second stitched image set contains all the text content in the text image. After parallel recognition of each second stitched image in the second stitched image set, all the text content contained in the text image can be obtained.

[0053] In addition, it is understandable that, since the text line images are reordered during the splicing process, the order of the text line images in the second spliced ​​image set is somewhat different from the original order of the text line images in the text image. Therefore, although the initial recognition result includes all the text content in the text image, there is still room for optimization in terms of the text order.

[0054] In the embodiment of the present application, the text line images extracted from the text image are spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image.

[0055] See also Figure 4 , which is a flowchart of a text recognition method provided in an embodiment of the present application. Figure 4 As shown, the method may include the following steps S201-S209.

[0056] S201, extracting at least two text line images from a text image;

[0057] Specifically, Figure 2 As shown, text detection technology is used to locate the text area in the image, and then words or text lines are usually marked in the form of bounding boxes, so that multiple text line images can be extracted from the text image.

[0058] S202, obtaining the height value of each text line image, and adjusting the height value of each text line image based on a set height value;

[0059] Specifically, by adjusting the height values ​​of each text line image in the at least two acquired text line images to the same height, the original aspect ratio of each text image needs to be maintained during the adjustment process, so that in the subsequent recognition process, the aspect ratio information of the text content can be accurately restored, thereby avoiding the distortion of the glyphs in the text recognition process. At the same time, since all the text line images are adjusted to the same height, it is helpful to splice all the text line images into a whole image, further improving the efficiency of text recognition.

[0060] S203, obtaining the maximum width value among the width values ​​of the text line images;

[0061] S204, based on the maximum width value, stitching the at least two text line images in a stitching manner to obtain a first stitching image set;

[0062] Specifically, the specified width value based on which the text line images are stitched adopts the maximum width value among the width values ​​of each text line image. Therefore, for the text line image with the largest width value, it is not necessary to stitch it, but only the text line images with width values ​​less than the maximum width value need to be reordered and then stitched. Therefore, this implementation method can not only reduce the number of text line images that need to be stitched, but also determine the width value based on the stitching processing without additional calculation, thereby further improving the efficiency of text recognition.

[0063] Optionally, the text recognition device may adopt a splicing method to determine an image splicing scheme of the at least two text line images, and insert a separation image between text line images belonging to the same splicing line in the image splicing scheme to obtain a first splicing image set;

[0064] It is understandable that in order for the text recognition model in the text recognition device to be able to recognize the separated images, it is necessary to put the separated images and the separators into the training data, and use the training data to pre-train the text recognition model. After using the pre-trained text recognition model to perform text recognition on the separated images, the corresponding separators can be obtained. The separated images and other text glyphs should be clearly distinguishable, and the separators and other text contents should also be clearly distinguishable, so as to avoid possible confusion. The separated images and separators used in the embodiments of the present application can use any images and symbols that meet the above conditions, and are not particularly limited here. For example, in combination Figure 3 and Figure 5 As shown, the separator image can be a pure black block with a width of 10, and the separator can be a custom symbol "\#".

[0065] In order to prevent the contents of the text line images belonging to the same stitching line in the first stitching image set from being confused, it is very necessary to clearly define the boundaries between the text line images. By inserting a separator image between the text line images belonging to the same stitching line, the text line images belonging to the same stitching line can be clearly demarcated by the separator image, so that in the subsequent text recognition process, the text contents corresponding to different text line images can be clearly distinguished, thereby eliminating the possible confusion caused by the text contents corresponding to different text line images, which helps to obtain accurate text recognition results.

[0066] S205, when there is a first stitched image in the first stitched image set whose row width value is less than the specified width value, fill the first stitched image with blank pixels to obtain a second stitched image, wherein the width value of the blank pixels is the difference between the specified width value and the row width value of the first stitched image;

[0067] S206, when there is a first stitched image in the first stitched image set whose width value is equal to the specified width value, determining the first stitched image as a second stitched image;

[0068] S207, adding the second stitched image to a second stitched image set;

[0069] Specifically, Figure 3 As shown, after the stitching is completed, it is first determined whether the line width value of each first stitched image in the first stitched image set is equal to the aforementioned specified width value, that is, the maximum width value among the width values ​​of each text line image. For the first stitched image whose line width value is less than the aforementioned specified width value, Figure 3 In the example, it is the fourth row, so the non-text part of the fourth row is filled with blank pixels (i.e. Figure 4), so that the row width value of the first stitched image in the first stitched image set reaches the specified width, forming a second stitched image. For the first stitched image whose row width value is equal to the specified width value, as shown in Figure 3 The first, second and third lines shown in , contain saturated text content, so there is no need to fill them with blank pixels, and they are directly determined as the second spliced ​​image.

[0070] After completing the above step of determining the second stitched images, the width values ​​of all the second stitched images are equal to the specified width, so each row of the second stitched image set formed has the same width, which facilitates subsequent text recognition using a parallel recognition method.

[0071] It can be understood that the significance of using blank pixels for filling is that in the subsequent recognition process, the recognition result of the blank pixels is a space, which will not interfere with or adversely affect the recognition result of the text content.

[0072] S208, performing parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0073] Specifically, after completing the above-mentioned stitching step and filling step, the width of each row in the second stitched image set is equal to the specified width value, so the second stitched image set can be recognized as a whole by parallel recognition. Parallel recognition here means that during the recognition process, the contents of each row in the second stitched image set are simultaneously recognized within the same time period. However, the current text serial recognition method can only recognize the text content of each row in turn, and cannot realize the simultaneous recognition of multiple lines of text content. Therefore, compared with the traditional text serial recognition method, the use of parallel text recognition can greatly improve the text recognition efficiency.

[0074] Since the second stitched image set is essentially formed by stitching together text line images extracted from the text image after changing their order, the second stitched image set contains all the text content in the text image. Therefore, after parallel recognition of each second stitched image in the second stitched image set, all the text content contained in the text image can be obtained.

[0075] It is understandable that, since the text line images are reordered in the aforementioned steps, there is a certain difference between the order of the text line images in the second spliced ​​image set and the original order of the text line images in the text image. Therefore, although the initial recognition result includes all the text content in the text image, there is still room for optimization in terms of the text order.

[0076] Optionally, the text recognition device may perform parallel text recognition on the second stitched images to obtain recognition contents corresponding to the second stitched images and separators corresponding to the separator images.

[0077] Since separator images for demarcating text line images are inserted between text line images belonging to the same stitching line in the second stitching image set before text recognition, after text recognition, the recognition content obtained includes text content and separators. The separators here are used to demarcate and distinguish the recognized text content, avoiding possible confusion between text contents corresponding to different text lines, thereby helping to improve the accuracy of text recognition.

[0078] S209, based on the initial position of each text line image in the text image, performing position restoration processing on the recognition content corresponding to each text line image in the initial text recognition result to obtain a target text recognition result corresponding to the text image.

[0079] Since the initial recognition result includes all the text content in the text image, the text order is not consistent with that in the text image. Therefore, in order to further optimize, the recognition content corresponding to each text line image can be restored according to the initial position of each text line image in the text image to obtain the target text recognition result. Therefore, in the target text recognition result, the order of the text content is completely consistent with that in the text image, achieving the technical effect of optimizing the text order in the initial recognition result.

[0080] Optionally, the text recognition device can determine the text content corresponding to each text line image based on the separator in the initial text recognition result; and perform position restoration processing on the text content corresponding to each text line image based on the initial position of each text line image in the text image to obtain a target text recognition result corresponding to the text image.

[0081] Specifically, before text recognition, since the separation image that demarcates each text line image is located between the text line images of the same spliced ​​line, after text recognition, the separator obtained is located between the text contents corresponding to the text line images belonging to the same spliced ​​line. Therefore, according to the separator obtained by text recognition, the text contents corresponding to the text line images belonging to the same spliced ​​line can be divided, and then the text content corresponding to each text line image can be obtained.

[0082] On this basis, according to the initial position of each text line image in the text image, the text content corresponding to each text line image can be restored to obtain the target text recognition result corresponding to the text image. In the target text recognition result, the order of the text content corresponding to each text line is exactly the same as that in the text image.

[0083] It can be understood that the initial position of each text line image in the text image here can refer to any identifier in the prior art that can indicate the initial position of the text line image in the text image, for example, the index information of each text line image can be used, which is not particularly limited here.

[0084] In an embodiment of the present application, a text line image extracted from a text image is spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image; by inserting a separator image between text line images belonging to the same splicing line in the image splicing scheme, the separator corresponding to the separator image can be obtained in the subsequent recognition process, and then the text content corresponding to the text line images belonging to the same splicing line can be divided according to the separator, and the text content corresponding to each text line image is obtained, thereby avoiding possible confusion of the text content corresponding to each text line image; by performing position restoration processing on the recognition content corresponding to each text line image in the initial recognition result, the text content consistent with the order in the text image can be obtained.

[0085] The following will be combined Figure 6-Figure 10 , the text recognition device provided in the embodiment of the present application is introduced in detail. It should be noted that, Figure 6-Figure 10 The text recognition device in the present application is used to execute Figure 1-Figure 5 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 1-Figure 5 The embodiment shown.

[0086] See also Figure 6 , which is a schematic diagram of the structure of a text recognition device provided in an embodiment of the present application. Figure 6 As shown, the text recognition device 1 of the embodiment of the present application may include: an extraction unit 11, a splicing unit 12, a filling unit 13 and a recognition unit 14.

[0087] An extraction unit 11, used to extract at least two text line images from the text image;

[0088] A splicing unit 12, configured to splice the at least two text line images based on a specified width value and in a splicing manner to obtain a first spliced ​​image set;

[0089] A filling unit 13 is used to fill each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0090] A recognition unit 14, configured to perform parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0091] The splicing method is used to minimize the number of blank pixels in the filling process.

[0092] In the embodiment of the present application, the text line images extracted from the text image are spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image.

[0093] See also Figure 7 , which is a schematic diagram of the structure of a text recognition device provided in an embodiment of the present application. Figure 7 As shown, the text recognition device 1 of the embodiment of the present application may include: an extraction unit 11, a splicing unit 12, a filling unit 13, a recognition unit 14, a height adjustment unit 15 and a position restoration unit 16.

[0094] An extraction unit 11, used to extract at least two text line images from the text image;

[0095] A height adjustment unit 15 is configured to obtain a height value of each text line image and adjust the height value of each text line image based on a set height value;

[0096] A splicing unit 12, configured to splice the at least two text line images based on a specified width value and in a splicing manner to obtain a first spliced ​​image set;

[0097] The stitching unit 12 may also be specifically configured to determine an image stitching scheme for the at least two text line images by stitching, and insert a separation image between text line images belonging to the same stitching line in the image stitching scheme to obtain a first stitching image set;

[0098] For details, please refer to Figure 8 , which is a schematic diagram of the structure of a splicing unit provided in the embodiment of the present application. Figure 8 As shown, the splicing unit 12 may include:

[0099] An acquisition subunit 121 is used to acquire a maximum width value among the width values ​​of the text line images;

[0100] The splicing subunit 122 is configured to perform splicing processing on the at least two text line images based on the maximum width value in a splicing manner to obtain a first spliced ​​image set.

[0101] A filling unit 13 is used to fill each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0102] For details, please refer to Fig. 9 , which is a schematic diagram of the structure of a filling unit provided in an embodiment of the present application. Fig. 9 As shown, the filling unit 13 may include:

[0103] The second stitched image determining subunit 131 is configured to fill the first stitched image with blank pixels to obtain a second stitched image when there is a first stitched image in the first stitched image set whose row width value is less than the specified width value, wherein the width value of the blank pixels is the difference between the specified width value and the row width value of the first stitched image; and to determine the first stitched image as a second stitched image when there is a first stitched image in the first stitched image set whose width value is equal to the specified width value;

[0104] The adding subunit 132 is configured to add the second stitched image to a second stitched image set.

[0105] A recognition unit 14, configured to perform parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0106] The recognition unit 14 is specifically configured to perform parallel text recognition on the second stitched images to obtain the recognition contents corresponding to the second stitched images and the separators corresponding to the separated images.

[0107] A position restoration unit 16, configured to perform position restoration processing on the recognition content corresponding to each text line image in the initial text recognition result based on the initial position of each text line image in the text image, so as to obtain a target text recognition result corresponding to the text image;

[0108] For details, see Fig.10 , which is a schematic diagram of the structure of a position restoration unit provided in an embodiment of the present application. Fig.10 As shown, the position restoration unit 16 may include:

[0109] A determination subunit 161, configured to determine, in the initial text recognition result, text contents corresponding to the text line images based on the separators;

[0110] The acquisition subunit 162 is used to perform position restoration processing on the text content corresponding to each text line image based on the initial position of each text line image in the text image, so as to obtain the target text recognition result corresponding to the text image.

[0111] In an embodiment of the present application, a text line image extracted from a text image is spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image; by inserting a separator image between text line images belonging to the same splicing line in the image splicing scheme, the separator corresponding to the separator image can be obtained in the subsequent recognition process, and then the text content corresponding to the text line images belonging to the same splicing line can be divided according to the separator, and the text content corresponding to each text line image is obtained, thereby avoiding possible confusion of the text content corresponding to each text line image; by performing position restoration processing on the recognition content corresponding to each text line image in the initial recognition result, the text content consistent with the order in the text image can be obtained.

[0112] The present application also provides a computer storage medium, which can store multiple program instructions, and the program instructions are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 5 The method steps of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 5 The specific description of the illustrated embodiment will not be repeated here.

[0113] See also Fig.11 , which is a schematic diagram of the structure of a computer device according to an embodiment of the present application. Fig.11As shown, the computer device 1100 may include: at least one processor 1101, such as a CPU, at least one network interface 1104, an input / output interface 1103, a memory 1105, and at least one communication bus 1102. The communication bus 1102 is used to realize the connection and communication between these components. The network interface 1104 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface). The memory 1105 may be a high-speed RAM memory or a non-volatile memory, such as at least one disk storage. The memory 1105 may optionally be at least one storage device located away from the aforementioned processor 1101. As shown in FIG. Fig.11 As shown, the memory 1105 as a computer storage medium may include an operating system, a network communication module, an input and output interface module, and a text recognition application.

[0114] exist Fig.11 In the computer device 1100 shown, the input-output interface 1103 is mainly used to provide an input interface for the user and obtain data input by the user.

[0115] In one embodiment, the processor 1101 may be used to call a text recognition application stored in the memory 1105, and specifically perform the following operations:

[0116] Extracting at least two text line images from the text image;

[0117] Based on the specified width value, the at least two text line images are spliced ​​in a splicing manner to obtain a first spliced ​​image set;

[0118] Filling each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value;

[0119] Performing parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result;

[0120] The splicing method is used to minimize the number of blank pixels in the filling process.

[0121] Optionally, after performing parallel text recognition on the second spliced ​​images to obtain an initial text recognition result, the processor 1101 further performs the following operations:

[0122] Based on the initial positions of the text line images in the text image, position restoration processing is performed on the recognition content corresponding to the text line images in the initial text recognition result to obtain a target text recognition result corresponding to the text image.

[0123] Optionally, before executing the splicing process on the at least two text line images based on the specified width value and in a splicing manner to obtain the first spliced ​​image set, the processor 1101 further performs the following operations:

[0124] The height value of each text line image is obtained, and the height value of each text line image is adjusted based on a set height value.

[0125] Optionally, when the processor 1101 performs stitching processing on the at least two text line images based on the specified width value and in a stitching manner to obtain a first stitched image set, the following operations are specifically performed:

[0126] Obtaining the maximum width value among the width values ​​of the text line images;

[0127] Based on the maximum width value, the at least two text line images are spliced ​​in a splicing manner to obtain a first spliced ​​image set.

[0128] Optionally, when the processor 1101 performs stitching processing on the at least two text line images based on the specified width value and in a stitching manner to obtain a first stitched image set, the following operations are specifically performed:

[0129] An image stitching scheme of the at least two text line images is determined by stitching, and a separation image is inserted between text line images belonging to the same stitching line in the image stitching scheme to obtain a first stitching image set.

[0130] Optionally, when the processor 1101 performs the filling process on each first stitched image in the first stitched image set based on blank pixels to obtain the second stitched image set, the processor 1101 specifically performs the following operations:

[0131] When there is a first stitched image in the first stitched image set whose row width value is less than the specified width value, fill the first stitched image with blank pixels to obtain a second stitched image, and the width value of the blank pixels is the difference between the specified width value and the row width value of the first stitched image;

[0132] When there is a first stitched image in the first stitched image set whose width value is equal to the specified width value, determining the first stitched image as the second stitched image;

[0133] The second stitched image is added to a set of second stitched images.

[0134] Optionally, when performing parallel text recognition on the second spliced ​​images to obtain an initial text recognition result, the processor 1101 specifically performs the following operations:

[0135] Parallel text recognition is performed on the second stitched images to obtain recognition contents corresponding to the second stitched images and separators corresponding to the separator images.

[0136] Optionally, when the processor 1101 performs position restoration processing on the recognition content corresponding to each text line image in the initial text recognition result based on the initial position of each text line image in the text image to obtain a target text recognition result corresponding to the text image, the following operations are specifically performed:

[0137] In the initial text recognition result, determining the text content corresponding to each of the text line images based on the separator;

[0138] Based on the initial positions of the text line images in the text image, position restoration processing is performed on the text contents respectively corresponding to the text line images to obtain the target text recognition results corresponding to the text images.

[0139] In an embodiment of the present application, a text line image extracted from a text image is spliced ​​by using a splicing method to obtain a first spliced ​​image set, and each first spliced ​​image in the first spliced ​​image set is filled based on blank pixels for parallel recognition. Since the text line images in the text image are spliced ​​by using a splicing method with the least blank pixels, the redundancy generated by the filled blank pixels can be minimized, thereby reducing the resources and time consumed in identifying blank pixels, and improving the efficiency of text recognition for the text image; by inserting a separator image between text line images belonging to the same splicing line in the image splicing scheme, the separator corresponding to the separator image can be obtained in the subsequent recognition process, and then the text content corresponding to the text line images belonging to the same splicing line can be divided according to the separator, and the text content corresponding to each text line image is obtained, thereby avoiding possible confusion of the text content corresponding to each text line image; by performing position restoration processing on the recognition content corresponding to each text line image in the initial recognition result, the text content consistent with the order in the text image can be obtained.

[0140] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0141] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A text recognition method, characterized in that: include: Extracting at least two text line images from the text image; Acquire a maximum width value among the width values ​​of each text line image in the at least two text line images as a designated width value, and based on the designated width value, stitch the at least two text line images having width values ​​less than the designated width value in a stitching manner to obtain a first stitched image set, wherein a line width value of a first stitched image in the first stitched image set does not exceed the designated width value; Filling each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value; Performing parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result; Wherein, the splicing method is used to minimize the number of blank pixels in the filling process; The step of performing a stitching process on the at least two text line images whose widths are smaller than the specified width to obtain a first stitched image set includes: By adopting a stitching method, an image stitching scheme for the at least two text line images whose width values ​​are smaller than the specified width value is determined, and a separator image is inserted between the text line images belonging to the same stitching line in the image stitching scheme to obtain a first stitching image set.

2. The text recognition method according to claim 1, characterized in that: After performing parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result, the method further includes: Based on the initial positions of the text line images in the text image, position restoration processing is performed on the recognition content corresponding to the text line images in the initial text recognition result to obtain a target text recognition result corresponding to the text image.

3. The text recognition method according to claim 1, characterized in that: Before the step of splicing the at least two text line images whose widths are smaller than the specified width value based on the specified width value in a splicing manner to obtain a first spliced ​​image set, the step further includes: The height value of each text line image is obtained, and the height value of each text line image is adjusted based on a set height value.

4. The text recognition method according to claim 1, characterized in that: The filling process of each first stitched image in the first stitched image set based on blank pixels to obtain a second stitched image set includes: When there is a first stitched image in the first stitched image set whose row width value is less than the specified width value, fill the first stitched image with blank pixels to obtain a second stitched image, and the width value of the blank pixels is the difference between the specified width value and the row width value of the first stitched image; When there is a first stitched image in the first stitched image set whose width value is equal to the specified width value, determining the first stitched image as the second stitched image; The second stitched image is added to a set of second stitched images.

5. The text recognition method according to claim 2, characterized in that: The performing parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result includes: Parallel text recognition is performed on the second stitched images to obtain recognition contents corresponding to the second stitched images and separators corresponding to the separator images.

6. The text recognition method according to claim 5, characterized in that: The performing position restoration processing on the recognition content corresponding to each text line image in the initial text recognition result based on the initial position of each text line image in the text image to obtain the target text recognition result corresponding to the text image includes: In the initial text recognition result, determining the text content corresponding to each of the text line images based on the separator; Based on the initial positions of the text line images in the text image, position restoration processing is performed on the text contents respectively corresponding to the text line images to obtain the target text recognition results corresponding to the text images.

7. A text recognition device, characterized in that: include: An extraction unit, used for extracting at least two text line images from the text image; a splicing unit, configured to obtain a maximum width value among the width values ​​of each of the at least two text line images as a designated width value, and splice the at least two text line images having width values ​​less than the designated width value in a splicing manner based on the designated width value, so as to obtain a first spliced ​​image set, wherein a line width value of a first spliced ​​image in the first spliced ​​image set does not exceed the designated width value; A filling unit is used to fill each first stitched image in the first stitched image set based on blank pixels. Performing padding processing to obtain a second stitched image set, wherein a width value of each second stitched image in the second stitched image set satisfies the specified width value; A recognition unit, configured to perform parallel text recognition on each of the second spliced ​​images to obtain an initial text recognition result; Wherein, the splicing method is used to minimize the number of blank pixels in the filling process; The stitching unit is specifically configured to adopt a stitching method to determine an image stitching scheme for the at least two text line images whose width values ​​are less than the specified width value, and insert a separator image between the text line images belonging to the same stitching line in the image stitching scheme to obtain a first stitching image set.

8. A computer storage medium, characterized in that: The computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the steps of the method as claimed in any one of claims 1 to 6.

9. A computer device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 6.