Character positioning method and device
Through text line detection and character recognition technology, character position information is generated, which solves the problems of slow character positioning speed and high computing resource consumption in the prior art, and achieves more efficient character positioning.
Patent Information
- Application Number
- CN202010575360.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-22
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2040-10-11
AI Technical Summary
The existing text recognition technology has problems such as slow speed, large calculation volume and high computing resources in character positioning.
By acquiring the target image, text line detection is performed to obtain text line position information, and then character recognition is performed on the image area of the specified position in the target image to obtain a character sequence, and character position information is generated based on the character sequence.
The speed of single-character positioning is improved, the calculation amount of single-character positioning is reduced, and the consumption of computing resources during the positioning process is reduced.
Smart Images

Figure CN113920286B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a character positioning method and device. Background Art
[0002] Character recognition is a technology that uses computers to automatically recognize characters and is an important field of pattern recognition applications.
[0003] In the prior art, the text recognition methods are basically divided into three categories: statistics, logic judgment and syntax. Among them, the commonly used methods are template matching and geometric feature extraction. Template matching is to match the input text with the given standard text (template) of each category, calculate the similarity between the input text and each template, and take the category with the greatest similarity as the recognition result. The feature extraction method can extract some geometric features of the text, such as the endpoints, bifurcation points, concave and convex parts of the text, and line segments in horizontal, vertical, inclined and other directions, closed loops, etc., and perform logical combination judgment based on the position and relationship of these features to obtain the recognition result. Summary of the invention
[0004] The present disclosure provides a character positioning method and device.
[0005] In a first aspect, an embodiment of the present disclosure provides a character positioning method, which includes: acquiring a target image; performing text line detection on the target image to obtain text line position information of the text line in the target image; performing character recognition on an image area in the target image located at a position indicated by the text line position information to obtain a character sequence included in the text line; and generating character position information of the characters in the text line based on the character sequence.
[0006] In some embodiments, the above-mentioned character sequence includes placeholder characters and non-placeholder characters; and the above-mentioned generating character position information of the characters in the above-mentioned text line based on the above-mentioned character sequence includes: generating non-placeholder character position information of each non-placeholder character in the above-mentioned text line based on the placeholder character position information of the placeholder characters in the above-mentioned character sequence.
[0007] In some embodiments, the above-mentioned character sequence includes placeholder characters and non-placeholder characters; and the above-mentioned generating character position information of characters in the above-mentioned text line based on the above-mentioned character sequence includes: generating character position information of the placeholder characters and character position information of each non-placeholder character in the above-mentioned character sequence based on the above-mentioned character sequence; for two adjacent placeholder characters in the above-mentioned character sequence, in response to the non-placeholder characters between the two adjacent placeholder characters in the above-mentioned character sequence being the same, generating character position information of characters in the above-mentioned text line corresponding to the non-placeholder characters between the two adjacent placeholder characters based on the non-placeholder character position information of each non-placeholder character between the two adjacent placeholder characters.
[0008] In some embodiments, the text line position information is represented by a quadrilateral box, and the character sequence includes placeholder characters and non-placeholder characters; and the generating of the character position information of the characters in the text line according to the character sequence includes: generating the character position information of the placeholder characters in the character sequence according to the character sequence; for two adjacent non-placeholder characters in the character sequence, determining the segmentation position information for segmenting the quadrilateral box according to the placeholder character position information of the placeholder characters between the two adjacent non-placeholder characters; segmenting the quadrilateral box according to the positions indicated by the obtained separation position information, and determining the segmentation result as the character position information of the characters in the text line.
[0009] In some embodiments, the above-mentioned generating character position information of the characters in the above-mentioned text line according to the above-mentioned character sequence includes: generating the position information of the characters in the above-mentioned text line in the above-mentioned image area according to the above-mentioned character sequence; determining the character position information of the characters in the above-mentioned target image according to the above-mentioned text line position information and the position information of the above-mentioned characters in the above-mentioned image area.
[0010] In some embodiments, the above-mentioned acquisition of the target image includes: acquiring an image presented on the target display screen as the target image; and the above-mentioned method also includes: in response to detecting a user operation on a character in the above-mentioned target image, according to the operation position of the above-mentioned user operation on the above-mentioned target display screen and the character position information of the character in the above-mentioned text line, determining the character to be operated indicated by the above-mentioned user operation from the text line indicated by the above-mentioned text line position information.
[0011] In some embodiments, the method further includes: outputting output information pre-associated with the character to be operated.
[0012] In some embodiments, the method further comprises: processing the user operation instruction on the character to be operated according to the user operation instruction.
[0013] In a second aspect, an embodiment of the present disclosure provides a character positioning device, which includes: an acquisition unit, configured to acquire a target image; a detection unit, configured to perform text line detection on the target image to obtain text line position information of the text line in the target image; a recognition unit, configured to perform character recognition on an image area in the target image located at a position indicated by the text line position information to obtain a character sequence included in the text line; and a generation unit, configured to generate character position information of the characters in the text line based on the character sequence.
[0014] In some embodiments, the above-mentioned character sequence includes placeholder characters and non-placeholder characters; and the above-mentioned generation unit includes: a first generation sub-unit, configured to generate non-placeholder character position information of each non-placeholder character in the above-mentioned text line based on the placeholder character position information of the placeholder characters in the above-mentioned character sequence.
[0015] In some embodiments, the above-mentioned character sequence includes placeholder characters and non-placeholder characters; and the above-mentioned generation unit includes: a second generation sub-unit, configured to generate character position information of the placeholder characters and character position information of each non-placeholder character in the above-mentioned character sequence according to the above-mentioned character sequence; a third generation sub-unit, configured to, for two adjacent placeholder characters in the above-mentioned character sequence, in response to the non-placeholder characters between the two adjacent placeholder characters in the above-mentioned character sequence being the same, generate character position information of characters in the above-mentioned text line corresponding to the non-placeholder characters between the two adjacent placeholder characters according to the non-placeholder character position information of each non-placeholder character between the two adjacent placeholder characters.
[0016] In some embodiments, the above-mentioned text line position information is represented by a quadrilateral box, and the above-mentioned character sequence includes placeholder characters and non-placeholder characters; and the above-mentioned generation unit includes: a fourth generation subunit, configured to generate character position information of the placeholder characters in the above-mentioned character sequence according to the above-mentioned character sequence; a first determination subunit, configured to determine, for two adjacent non-placeholder characters in the above-mentioned character sequence, segmentation position information for segmenting the above-mentioned quadrilateral box according to the placeholder character position information of the placeholder characters between the two adjacent non-placeholder characters; and a second determination subunit, configured to segment the above-mentioned quadrilateral box according to the positions indicated by the obtained respective separation position information, and determine the segmentation result as the character position information of the characters in the above-mentioned text line.
[0017] In some embodiments, the above-mentioned generation unit includes: a fifth generation sub-unit, configured to generate position information of the characters in the above-mentioned text line in the above-mentioned image area based on the above-mentioned character sequence; a third determination sub-unit, configured to determine the character position information of the characters in the above-mentioned target image based on the above-mentioned text line position information and the position information of the above-mentioned characters in the above-mentioned image area.
[0018] In some embodiments, the acquisition unit includes: an acquisition sub-unit, configured to acquire an image presented on the target display screen as a target image; and the device also includes: a determination unit, configured to respond to detecting a user operation on a character in the target image, and determine the character to be operated indicated by the user operation from the text line indicated by the text line position information according to the operation position of the user operation on the target display screen and the character position information of the character in the text line.
[0019] In some embodiments, the above-mentioned apparatus further comprises: an output unit configured to output output information pre-associated with the above-mentioned character to be operated.
[0020] In some embodiments, the apparatus further comprises: a processing unit configured to process the user operation instruction on the character to be operated according to the user operation instruction.
[0021] In a third aspect, an embodiment of the present disclosure provides a character positioning electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement a method as in any embodiment of the above-mentioned character positioning method.
[0022] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements a method as in any embodiment of the above-mentioned character positioning method.
[0023] The character positioning method and device provided by the embodiments of the present disclosure first acquire a target image, then perform text line detection on the target image to obtain text line position information of the text line in the target image, then perform character recognition on the image area in the target image located at the position indicated by the text line position information to obtain a character sequence included in the text line, and finally generate character position information of the characters in the text line based on the character sequence, so that the position of the characters can be determined through text line detection and character recognition, which can improve the speed of single character positioning, reduce the calculation amount of single character positioning, and reduce the consumption of computing resources in the positioning process. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0025] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0026] Figure 2 is a flow chart of an embodiment of a character positioning method according to the present disclosure;
[0027] Figure 3A-3C is a schematic diagram of an application scenario of the character positioning method according to the present disclosure;
[0028] Figure 4 is a flow chart of another embodiment of the character positioning method according to the present disclosure;
[0029] Figure 5A-Figure 5B is a schematic diagram of another application scenario of the character positioning method according to the present disclosure;
[0030] Figure 6 is a structural schematic diagram of an embodiment of a character positioning device according to the present disclosure;
[0031] Figure 7 It is a structural diagram of a computer system of an electronic device suitable for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0032] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0034] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of a character positioning method or a character positioning device according to an embodiment of the present disclosure can be applied.
[0035] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0036] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send data (such as a target image), etc. Various client applications can be installed on the terminal devices 101, 102, 103, such as image processing applications, video playback software, news information applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0037] Terminal devices 101, 102, 103 may be hardware or software. When terminal devices 101, 102, 103 are hardware, they may be various electronic devices, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, etc. When terminal devices 101, 102, 103 are software, they may be installed in the electronic devices listed above. They may be implemented as multiple software or software modules (for example, software or software modules for providing distributed services), or as a single software or software module. No specific limitation is made here.
[0038] The server 105 may be a server that provides various services, such as a background server that performs character positioning on a target image sent by the terminal devices 101, 102, and 103. The background server may perform text line detection on the target image to obtain text line position information of the target image, and then perform character recognition on the image area in the target image located at the position indicated by the text line position information to obtain a character sequence included in the text line, and generate character position information of the characters in the text line based on the character sequence. Optionally, after generating the character position information, the background server may also feed back the character position information to the terminal device. As an example, the server 105 may be a cloud server.
[0039] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0040] It should also be noted that the character positioning method provided in the embodiments of the present disclosure can be executed by a server, or by a terminal device, or by a server and a terminal device in cooperation with each other. Accordingly, the various parts (such as various units and sub-units) included in the character positioning device can be all set in the server, or all set in the terminal device, or can be set in the server and the terminal device respectively.
[0041] It should be understood that Figure 1 The number of terminal devices, networks and servers in the system is only illustrative. According to the implementation requirements, there may be any number of terminal devices, networks and servers. When the electronic device on which the character positioning method is running does not need to transmit data with other electronic devices, the system architecture may only include the electronic device (such as a server or terminal device) on which the character positioning method is running.
[0042] Continue to refer Figure 2 , shows a process 200 of an embodiment of a character positioning method according to the present disclosure. The character positioning method comprises the following steps:
[0043] Step 201, acquiring a target image.
[0044] In this embodiment, the execution subject of the character positioning method (for example Figure 1 The server or terminal device shown in the figure can obtain the target image from other electronic devices or local devices through a wired connection or a wireless connection. The target image can be an image containing characters.
[0045] In practice, the characters contained in the above target image may be any symbols. As an example, the characters in the target image may include but are not limited to at least one of the following: text, letters, numbers, operation symbols, punctuation marks and other symbols, as well as some functional symbols. As an example, the characters contained in the above target image may be placeholder characters (such as spaces), text (such as Chinese characters). Generally, the characters contained in the target image may be arranged in rows. Here, the characters arranged in rows may be referred to as text rows.
[0046] Step 202: Perform text line detection on the target image to obtain text line position information of the text lines in the target image.
[0047] In this embodiment, the execution subject may perform text line detection on the target image acquired in step 201 to obtain text line position information of the text line in the target image.
[0048] Among them, text line detection can be used to determine the text line position information of the text line in the image. As an example, the above-mentioned execution subject can adopt text line detection based on EAST (Efficient and Accurate Scene Text detection pipeline, efficient and accurate scene text detection), text line detection based on PixelLink or other text line detection to obtain the text line position information of the text line in the above-mentioned target image.
[0049] The text line position information can be used to indicate the position of the text line in the target image. In practice, the representation method of the text line position information can be determined according to actual needs. Exemplarily, the text line position information can be represented by a quadrilateral box. For example, the above-mentioned quadrilateral can be a quadrilateral such as a rectangle or a parallelogram. Here, the sides of the quadrilateral box and the sides of the rectangle indicated by the boundary range of the target image (usually the boundary range of the image is a rectangle) can be parallel or non-parallel. In addition, the text line position information can also be represented by two line segments. Among them, when the font sizes of each character in the text line are equal, the text line position information can be represented by two parallel line segments; when the font sizes of each character in the text line increase or decrease successively, the text line position information can be represented by two non-parallel line segments. Optionally, the text line position information can also be represented by coordinates.
[0050] In some cases, the text line position information may indicate the position of the curved text. In this case, the quadrilateral box may not include sides parallel to the sides of the rectangle indicated by the boundary range of the target image.
[0051] Step 203: Perform character recognition on the image area in the target image located at the position indicated by the text line position information to obtain a character sequence included in the text line.
[0052] In this embodiment, the execution subject may perform character recognition on the image region in the target image located at the position indicated by the text line position information to obtain a character sequence included in the text line.
[0053] Among them, character recognition can be used to determine the character sequence in the text line in the image area. As an example, when the image area contains the text line "The grass grows thick on the plain, withering and flourishing every year", the character sequence included in the text line may be "The grass grows thick on the plain, withering and flourishing every year". It can be understood that through the arrangement of pixels in the image and the change of color, the image can present the text line. However, the above-mentioned execution subject cannot directly obtain the content of the text line in the image. Through character recognition, the above-mentioned execution subject can obtain the character sequence included in the text line, thereby obtaining the content of the text line in the image.
[0054] As an example, the above-mentioned execution entity can adopt CNN (Convolutional Neural Networks)-based character recognition, CRNN (Convolutional Recurrent Neural Network)-based character recognition, or other character recognition methods to obtain the character sequence included in the above-mentioned text line.
[0055] It can be understood that the above character sequence is obtained by the above-mentioned execution entity through character recognition. Therefore, the character sequence may contain overlapping characters. Exemplarily, for the text line "The wild grasses spread far and wide on the plain", the above-mentioned execution entity may obtain the character sequence "Li Li Li Li Yuan Yuan Yuan Shang Shang Cao Cao ". Among them, there are 3 placeholder characters before the first Chinese character "Li", 2 placeholder characters between the second Chinese character "Li" and the third Chinese character "Li", 3 placeholder characters between the fourth Chinese character "Li" and the fifth Chinese character "Yuan", 2 placeholder characters between the seventh Chinese character "Yuan" and the eighth Chinese character "Shang", 3 placeholder characters between the ninth Chinese character "Shang" and the tenth Chinese character "Cao", and 3 placeholder characters after the eleventh Chinese character "Cao".
[0056] Step 204, generate character position information of the characters in the above text line according to the above character sequence.
[0057] In this embodiment, the above-mentioned execution entity can generate character position information of the characters in the above text line according to the above character sequence.
[0058] Here, the above-mentioned execution entity can generate character position information of all or part of the characters in the above text line. Among them, the character position information of the characters in the text line can represent the position of the character in the target image, or can represent the position of the character in the image area where the text line containing the character is located.
[0059] In some optional implementation manners of this embodiment, the above character sequence includes placeholder characters and non-placeholder characters. Among them, the placeholder characters can represent the distance between two adjacent non-placeholder characters in the character sequence. Generally, the greater the distance between two adjacent non-placeholder characters, the more the number of placeholder characters between the two adjacent non-placeholder characters. Exemplarily, the placeholder characters can be spaces, and the non-placeholder characters can be any characters other than the placeholder characters.
[0060] Here, the placeholder characters can be a known character determined in advance. For example, the placeholder characters can be spaces, or can be "□", or can be other predetermined characters.
[0061] Based on this, the above-mentioned execution entity can execute the above step 204 through the following steps:
[0062] Generate non-placeholder character position information of each non-placeholder character in the above text line according to the placeholder character position information of the placeholder characters in the above character sequence.
[0063] Among them, the character position information of the placeholder characters in the character sequence can represent the occurrence position of the placeholder characters in the character sequence. Optionally, the character position information of the placeholder characters in the character sequence can represent the position of the placeholder characters in the target image, or can represent the position of the placeholder characters in the image area where the text line containing the placeholder characters is located.
[0064] Here, the above-mentioned execution entity can first determine the placeholder character position information of all or part of the placeholder characters in the character sequence. Thus, on the basis of obtaining the placeholder character position information of the placeholder characters in the character sequence, the above-mentioned execution entity can calculate the distance between the two target adjacent placeholder characters determined (this distance can be represented by the number of non-placeholder characters between the two target adjacent placeholder characters, or can be represented by the number of pixels between the two target adjacent placeholder characters). If the distance between the two target adjacent placeholder characters is greater than the first preset distance threshold, then the above-mentioned execution entity can determine that there are non-placeholder characters between the two target adjacent placeholder characters. Thus, the above-mentioned execution entity can determine any position (such as the middle position) between the two target adjacent placeholder characters as the segmentation position of the non-placeholder characters. Furthermore, the non-placeholder character position information of each non-placeholder character in the above-mentioned text line can be obtained. Among them, the two target adjacent placeholder characters can be two placeholder characters in the character sequence that do not contain placeholder characters (non-placeholder characters can be included) between them. For example, for the character sequence "□leave□□leave□□□", the two target adjacent placeholder characters can include: the first □ and the second □, the third □ and the fourth □, the fourth □ and the fifth □, the fifth □ and the sixth □.
[0065] Optionally, the above-mentioned execution entity can also first determine the positions of at least two placeholder characters (i.e., placeholder character groups) in the character sequence that do not contain non-placeholder characters between them.
[0066] For example, if the character sequence is "Li Li Li Li Yuan Yuan Yuan Shang Cao Cao". Among them, there are 3 placeholder characters before the first Chinese character "Li" (hereinafter referred to as the first placeholder character group), 2 placeholder characters between the second Chinese character "Li" and the third Chinese character "Li" (hereinafter referred to as the second placeholder character group), 3 placeholder characters between the fourth Chinese character "Li" and the fifth Chinese character "Yuan" (hereinafter referred to as the third placeholder character group), 2 placeholder characters between the seventh Chinese character "Yuan" and the eighth Chinese character "Shang" (hereinafter referred to as the fourth placeholder character group), 3 placeholder characters between the ninth Chinese character "Shang" and the tenth Chinese character "Cao" (hereinafter referred to as the fifth placeholder character group), and 3 placeholder characters after the eleventh Chinese character "Cao" (hereinafter referred to as the sixth placeholder character group). It can be understood that the position of the placeholder character group can be determined according to the position of the placeholder characters in the placeholder character group. The placeholder character group can be a character subsequence in the character sequence that does not contain non-placeholder characters and whose previous character and subsequent character are both non-placeholder characters.
[0067] Then, the above-mentioned execution entity can generate the non-placeholder character position information of each non-placeholder character in the above text line according to the position of the obtained placeholder character group.
[0068] It can be understood that the above optional implementation manner can generate the non-placeholder character position information of each non-placeholder character in the text line according to the placeholder character position information of the placeholder characters in the character sequence, thereby improving the accuracy of character positioning.
[0069] In some optional implementation manners of this embodiment, the above character sequence includes placeholder characters and non-placeholder characters. Among them, the placeholder character can represent the distance between two adjacent non-placeholder characters in the character sequence. Generally, the greater the distance between two adjacent non-placeholder characters, the more the number of placeholder characters between the two adjacent non-placeholder characters. Exemplarily, the placeholder character can be a space, and the non-placeholder character can include any character other than the placeholder character.
[0070] Based on this, the above-mentioned execution entity can also execute the above step 204 through the following steps:
[0071] First, according to the above character sequence, generate the character position information of the placeholder characters in the character sequence and the character position information of each non-placeholder character.
[0072] Then, for two adjacent placeholder characters in the above character sequence, in response to all non-placeholder characters between the two adjacent placeholder characters in the above character sequence being the same, according to the non-placeholder character position information of all non-placeholder characters between the two adjacent placeholder characters, generate the character position information of the characters in the above text line corresponding to the non-placeholder characters between the two adjacent placeholder characters. Among them, two adjacent placeholder characters in the character sequence can be two adjacent placeholder characters in the character sequence, and there may or may not be non-placeholder characters between the two adjacent placeholder characters in the character sequence.
[0073] It can be understood that, usually, for a single character in a text line in a target image, the character sequence obtained by performing character recognition in step 203 may include two or more characters corresponding to the single character. For example, if the text line in the target image is "The grass on the plain grows and grows", for the single character "离" in this text line, the character sequence obtained by the above execution entity after performing character recognition may include two characters "离离" corresponding to the single character. Exemplarily, for the text line "The grass on the plain grows and grows", the above execution entity may obtain the character sequence " 离离 离离原原原 上上 草草 ".
[0074] In this application scenario, the above execution entity can determine the position of the first Chinese character (i.e., the first "离" in the text line) in the text line "The grass on the plain grows and grows" according to the first Chinese character (i.e., the first "离" in the character sequence) and the second Chinese character (i.e., the second "离" in the character sequence) in the character sequence " 离离 离离 原原原上上 草草 ", so as to obtain the character position information of the non-placeholder character "离".
[0075] It can be understood that for the case where all non-placeholder characters between two adjacent placeholder characters in the character sequence are the same, the above optional implementation manner can further improve the accuracy of character positioning.
[0076] In some optional implementation manners of this embodiment, the above execution entity can execute the above step 204 through the following steps:
[0077] First, generate the position information of the characters in the above text line in the above image area according to the above character sequence.
[0078] Then, determine the character position information of the characters in the above target image according to the above text line position information and the position information of the characters in the above image area.
[0079] It can be understood that since the image area is part of the target image, there is a positional relationship between the image area and the target image. Based on the positional relationship, the character position information of the character in the above target image can be determined according to the position information of the above character in the above image area.
[0080] In some optional implementations of this embodiment, the above step 201 may be: acquiring an image presented by a target display screen as a target image, wherein the target display screen may be a display screen of the above execution subject, or a display screen of an electronic device that is communicatively connected to the above execution subject.
[0081] Based on this, when a user operation on a character in the target image is detected, the execution subject may also determine the character to be operated indicated by the user operation from the text line indicated by the text line position information according to the operation position of the user operation on the target display screen and the character position information of the character in the text line. The user operation may include but is not limited to at least one of the following: word retrieval operation, point reading operation, etc.
[0082] It can be understood that the above optional implementation method can more accurately determine the characters to be operated indicated by the user operation, so as to more accurately perform corresponding processing according to the user operation instructions, such as word retrieval operation, point reading operation, etc.
[0083] In some optional implementations of this embodiment, the execution subject may further output output information pre-associated with the character to be operated.
[0084] As an example, the output information pre-associated with the character to be operated may be the translation information, introduction information, audio information, etc. of the character to be operated. For example, if the character to be operated is "apple", then when the output information is the translation information of the character to be operated, the output information may be "apple"; when the output information is the introduction information of the character to be operated, the output information may be "nutritional value of apple: rich in minerals and vitamins..."; when the output information is the audio information of the character to be operated, the output information may be the audio of apple.
[0085] It can be understood that the above optional implementation manner can more quickly determine the output information pre-associated with the character to be operated, thereby increasing the speed of outputting information.
[0086] In some optional implementations of this embodiment, the execution subject may also process the user operation instruction on the character to be operated according to the user operation instruction.
[0087] As an example, when the user operation indicates a word-picking operation, the above-mentioned execution subject can perform a word-picking operation on the above-mentioned characters to be operated, and execute corresponding processing of the characters to be operated selected by the word-picking operation, such as translation, interpretation and other operations; when the user operation indicates a point-reading operation, the above-mentioned execution subject can perform a point-reading operation on the above-mentioned characters to be operated, and execute corresponding processing of the characters to be operated selected by the point-reading operation, such as playing voice corresponding to the characters to be operated selected by the point-reading operation and other operations.
[0088] It can be understood that the above optional implementation manner can improve the speed of processing the user operation instruction for the character to be operated.
[0089] Continue to see Figure 3A-3C , Figure 3A-3C FIG. 1 is a schematic diagram of an application scenario of the character positioning method according to this embodiment. Figure 3A In the example, the terminal device 31 first obtains the target image 301. Then, please refer to Figure 3B , the terminal device 31 performs text line detection on the target image 301 to obtain text line position information 3011-3016 of the text line in the target image. Afterwards, the terminal device 31 performs character recognition on the image area in the target image 301 located at the position indicated by the text line position information 3011-3016, to obtain the character sequence included in the text line. Finally, Figure 3C As shown, the terminal device 31 generates character position information ( Figure 3C The character position information of “Chu”, “zhou”, “west”, “jian”, “Tang”, “chao”, “poetry”, “person”, “:”, “Wei”, “ying”, “thing”, “alone”, “pity”, “secluded”, “grass”, “stream”, “edge”, “life”, “,”, “up”, “have”, “yellow”, “oriole”, “deep”, “tree”, “ming”, “.”, “spring”, “tide”, “belt”, “rain”, “late”, “come”, “urgent”, “,”, “wild”, “cross”, “no”, “person”, “boat”, “self”, “horizontal”, “.” is generated respectively, and the character position information of each character is represented by a quadrilateral box).
[0090] Generally, character recognition based on single-character detection and single-character recognition (e.g., single-character detection based on connected domain analysis and single-character recognition based on CNN (Convolutional Neural Networks)) is prone to problems such as false recall. However, character recognition based on text line detection and character sequence recognition (e.g., text line detection based on EAST (Efficient and Accurate Scene Text detection pipeline) and text line recognition based on CRNN (Convolutional Recurrent Neural Network)) cannot obtain the position of a single character.
[0091] The method provided by the above-mentioned embodiments of the present disclosure first acquires a target image, then performs text line detection on the above-mentioned target image to obtain text line position information of the text line in the above-mentioned target image, and then performs character recognition on the image area in the above-mentioned target image located at the position indicated by the above-mentioned text line position information to obtain a character sequence included in the above-mentioned text line, and finally, generates character position information of the characters in the above-mentioned text line based on the above-mentioned character sequence, so that the position of the characters can be determined through text line detection and character recognition, which can improve the speed of single-character positioning, reduce the calculation amount of single-character positioning, and reduce the consumption of computing resources in the positioning process.
[0092] Further references Figure 4 , which shows a process 400 of another embodiment of a character positioning method. The process 400 of the character positioning method includes the following steps:
[0093] Step 401, acquiring a target image.
[0094] In this embodiment, the execution subject of the character positioning method (for example Figure 1 The server or terminal device shown in the figure) can obtain the target image from other electronic devices or locally through a wired connection or a wireless connection.
[0095] In this embodiment, step 401 and Figure 2 Step 201 in the corresponding embodiment is basically the same and will not be described again here.
[0096] Step 402: Perform text line detection on the target image to obtain text line position information of the text lines in the target image.
[0097] In this embodiment, the execution subject may perform text line detection on the target image acquired in step 201 to obtain text line position information of the text line in the target image. The text line position information is represented by a quadrilateral box. The quadrilateral box may be a quadrilateral box containing a text line. In some cases, in the quadrilateral box, two sides along the arrangement direction of each character in the text line are parallel.
[0098] In this embodiment, step 402 and Figure 2 Step 202 in the corresponding embodiment is basically the same and will not be described again here.
[0099] Step 403: Perform character recognition on the image area in the target image located at the position indicated by the text line position information to obtain a character sequence included in the text line.
[0100] In this embodiment, the execution entity may perform character recognition on the image area in the target image at the position indicated by the text line position information to obtain a character sequence included in the text line. The character sequence includes placeholder characters and non-placeholder characters. The placeholder character may represent the distance between two adjacent non-placeholder characters in the character sequence. Generally, the greater the distance between two adjacent non-placeholder characters, the greater the number of placeholder characters between the two adjacent non-placeholder characters. Exemplarily, the placeholder character may be a space, and the non-placeholder character may include any character except the placeholder character.
[0101] In this embodiment, step 403 and Figure 2 Step 203 in the corresponding embodiment is basically the same and will not be described again here.
[0102] Step 404: Generate character position information of the placeholder characters in the character sequence according to the character sequence.
[0103] In this embodiment, the execution entity may generate character position information of the placeholder characters in the character sequence according to the character sequence.
[0104] Here, for each placeholder character in the character sequence, the execution subject can determine the position of the placeholder character, thereby generating character position information of the placeholder character in the character sequence. The character position information of the placeholder character in the character sequence can represent the position where the placeholder character appears in the character sequence.
[0105] Step 405 , for two adjacent non-placeholder characters in the character sequence, determine segmentation position information for segmenting the quadrilateral frame according to the placeholder character position information of the placeholder character between the two adjacent non-placeholder characters.
[0106] In this embodiment, for two adjacent non-placeholder characters in the above character sequence, the execution entity can also determine the segmentation position information for dividing the above quadrilateral frame according to the placeholder character position information of the placeholder characters between the two adjacent non-placeholder characters. Here, the two adjacent non-placeholder characters in the character sequence can be two adjacent non-placeholder characters in the character sequence, and the two adjacent non-placeholder characters in the character sequence may include placeholder characters. For example, for the character sequence "□leave□□leave□□□original□□above□□grass□", the two target adjacent non-placeholder characters may include: the first Chinese character "leave" and the second Chinese character "leave", the second Chinese character "leave" and the third Chinese character "original", the third Chinese character "original" and the fourth Chinese character "above", the fourth Chinese character "above" and the fifth Chinese character "grass".
[0107] The above segmentation position information can be represented by a line segment. When the text line position information of the text line is represented by a quadrilateral frame including two parallel sides, the line segment can be perpendicular to the two parallel sides of the quadrilateral frame.
[0108] Exemplarily, assume the size of the image region is C H W. Wherein, C represents the number of channels of the image region, H represents the height of the image region, and W represents the length of the image region. After the image region is encoded by CNN, reshaped (reshape), and transposed (transpose), a feature map with the shape of w c is obtained, where w is the length of the feature map and c is the number of kernels of the last convolution of CNN. The feature map with the shape of w c is passed through an identification model (Connectionist Temporal Classification, CTC) to obtain the position and confidence of each non-placeholder character on the feature map, thereby obtaining the text line recognition result. Thus, according to the positions of each non-placeholder character on the feature map, the position idx of the placeholder character on the feature map can be obtained. Furthermore, according to the position idx of the placeholder character on the feature map, the length w of the feature map, and the length W of the image region, the position idx / w W of the placeholder character on the image region can be obtained.
[0109] As an example, the position indicated by the segmentation position information can be any position where a placeholder character is located between two adjacent non-placeholder characters. For example, the line segment representing the segmentation position information can be a line segment parallel to the upper left vertex and the lower left vertex of the rectangular box including the target placeholder character between two adjacent non-placeholder characters, or can be a line segment parallel to the upper right vertex and the lower right vertex of the rectangular box including the target placeholder character between two adjacent non-placeholder characters. Among them, the target placeholder character can be any placeholder character between two adjacent non-placeholder characters, for example, it can be the first placeholder character or the last placeholder character. Optionally, the line segment representing the segmentation position information can also be the center position where the placeholder character between two adjacent non-placeholder characters is located.
[0110] In addition, the line segments representing the segmentation position information may also include the following line segments: a line segment parallel to the upper left vertex and the lower left vertex of the rectangular box containing the first placeholder character between two adjacent non-placeholder characters, and a line segment parallel to the upper right vertex and the lower right vertex of the rectangular box containing the last placeholder character between two adjacent non-placeholder characters.
[0111] Among them, before the first placeholder character between two adjacent non-placeholder characters, there can be a non-placeholder character. After the last placeholder character between two adjacent non-placeholder characters, there can be a non-placeholder character.
[0112] Step 406 , segment the quadrilateral frame according to the positions indicated by the obtained separation position information, and determine the segmentation result as the character position information of the characters in the text line.
[0113] In this embodiment, the execution entity may segment the quadrilateral frame according to the positions indicated by the obtained separation position information, and determine the segmentation results as the character position information of the characters in the text line.
[0114] As an example, see Figure 5A and Figure 5B . Figure 5A-Figure 5B FIG. 1 is a schematic diagram of another application scenario of the character positioning method according to the present disclosure. Figure 5A In the example, the terminal device 51 performs text line detection on the target image to obtain text line position information of the text line in the target image. The text line position information is represented by a quadrilateral frame. In the quadrilateral frame, two sides along the arrangement direction of each character in the text line are parallel. Figure 5AAs shown, the side 501 and the side 502 of the quadrilateral frame are parallel. Afterwards, the terminal device 51 generates the character position information of the placeholder characters in the character sequence according to the character sequence. Subsequently, for two adjacent non-placeholder characters in the character sequence, the terminal device 51 determines the segmentation position information for segmenting the quadrilateral frame according to the placeholder character position information of the placeholder characters between the two adjacent non-placeholder characters. Figure 5B As shown, the segmentation position information determined by the terminal device 51 indicates positions 503, 504, and 505. Finally, the terminal device 51 segments the quadrilateral frame according to the positions indicated by the obtained segmentation position information, and determines the segmentation result as the character position information of the characters in the text line.
[0115] Return below Figure 4 .
[0116] It should be noted that, in addition to the above contents, the embodiments of the present disclosure may also include Figure 2 The same or similar features and effects as those in the corresponding embodiments will not be described in detail here.
[0117] from Figure 4 It can be seen that the process 400 of the character positioning method in this embodiment uses a quadrilateral frame to represent the text line position information, and obtains the position of the characters in the text line by determining the segmentation position information, thereby further improving the accuracy of character positioning.
[0118] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a character positioning device, which is similar to Figure 2 Corresponding to the method embodiment shown in FIG. 1 , in addition to the features described below, the device embodiment may also include Figure 2 The same or corresponding features of the method embodiment shown, and the generation of Figure 2 The method embodiment shown has the same or corresponding effects. The device can be specifically applied to various electronic devices.
[0119] like Figure 6 As shown, the character positioning device 600 of this embodiment includes: an acquisition unit 601, configured to acquire a target image; a detection unit 602, configured to perform text line detection on the above target image, and obtain text line position information of the text line in the above target image; a recognition unit 603, configured to perform character recognition on the image area in the above target image located at the position indicated by the above text line position information, and obtain a character sequence included in the above text line; a generation unit 604, configured to generate character position information of the characters in the above text line according to the above character sequence.
[0120] In this embodiment, the acquisition unit 601 of the character positioning device 600 can acquire a target image.
[0121] In this embodiment, the detection unit 602 may perform text line detection on the target image acquired by the acquisition unit 601 to obtain text line position information of the text lines in the target image.
[0122] In this embodiment, the recognition unit 603 may perform character recognition on the image region located at the position indicated by the text line position information obtained by the detection unit 602 in the target image obtained by the acquisition unit 601, and obtain the character sequence included in the text line.
[0123] In this embodiment, according to the character sequence obtained by the recognition unit 603 and obtained by the detection unit 602, the generation unit 604 can generate the character position information of the characters in the text line.
[0124] In some optional implementations of this embodiment, the character sequence includes placeholder characters and non-placeholder characters. Based on this, the generation unit 604 may include: a first generation subunit (not shown in the figure), configured to generate non-placeholder character position information of each non-placeholder character in the text line according to the placeholder character position information of the placeholder characters in the character sequence.
[0125] In some optional implementations of the present embodiment, the above-mentioned character sequence includes placeholder characters and non-placeholder characters. Based on this, the above-mentioned generation unit 604 may include: a second generation subunit (not shown in the figure), configured to generate character position information of the placeholder characters and character position information of each non-placeholder character in the above-mentioned character sequence according to the above-mentioned character sequence; a third generation subunit (not shown in the figure), configured to, for two adjacent placeholder characters in the above-mentioned character sequence, in response to the non-placeholder characters between the two adjacent placeholder characters in the above-mentioned character sequence being the same, generate character position information of characters corresponding to the non-placeholder characters between the two adjacent placeholder characters in the above-mentioned text line according to the non-placeholder character position information of each non-placeholder character between the two adjacent placeholder characters.
[0126] In some optional implementations of the present embodiment, the above-mentioned text line position information is represented by a quadrilateral frame, and the above-mentioned character sequence includes placeholder characters and non-placeholder characters. Based on this, the above-mentioned generation unit 604 may include: a fourth generation subunit (not shown in the figure), configured to generate character position information of the placeholder characters in the above-mentioned character sequence according to the above-mentioned character sequence; a first determination subunit (not shown in the figure), configured to determine the segmentation position information for segmenting the above-mentioned quadrilateral frame according to the placeholder character position information of the placeholder characters between the two adjacent non-placeholder characters in the above-mentioned character sequence; a second determination subunit (not shown in the figure), configured to segment the above-mentioned quadrilateral frame according to the positions indicated by the obtained respective separation position information, and determine the segmentation result as the character position information of the characters in the above-mentioned text line.
[0127] In some optional implementations of the present embodiment, the generation unit 604 may include: a fifth generation subunit (not shown in the figure), configured to generate position information of the characters in the text line in the image area according to the character sequence; and a third determination subunit (not shown in the figure), configured to determine the character position information of the characters in the target image according to the text line position information and the position information of the characters in the image area.
[0128] In some optional implementations of this embodiment, the acquisition unit 601 may include: an acquisition subunit (not shown in the figure), configured to acquire an image presented on the target display screen as the target image. Based on this, the device 600 further includes: a determination unit (not shown in the figure), configured to, in response to detecting a user operation on a character in the target image, determine the character to be operated indicated by the user operation from the text line indicated by the text line position information according to the operation position of the user operation on the target display screen and the character position information of the character in the text line.
[0129] In some optional implementations of this embodiment, the apparatus 600 further includes: an output unit (not shown in the figure), configured to output output information pre-associated with the character to be operated.
[0130] In some optional implementations of this embodiment, the apparatus 600 further includes: a processing unit (not shown in the figure), configured to process the user operation instruction on the character to be operated according to the user operation instruction.
[0131] The device provided by the above-mentioned embodiment of the present disclosure firstly acquires the target image by the acquisition unit 601, then the detection unit 602 performs text line detection on the above-mentioned target image to obtain the text line position information of the text line in the above-mentioned target image, and then the recognition unit 603 performs character recognition on the image area in the above-mentioned target image located at the position indicated by the above-mentioned text line position information to obtain the character sequence included in the above-mentioned text line, and finally, the generation unit 604 generates the character position information of the characters in the above-mentioned text line according to the above-mentioned character sequence, so that the position of the character can be determined by text line detection and character recognition, which can improve the speed of single character positioning, reduce the calculation amount of single character positioning, and reduce the consumption of computing resources in the positioning process.
[0132] Reference below Figure 7 , which shows an electronic device (eg, Figure 1 The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The terminal device / server shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0133] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0134] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 7 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0135] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above functions defined in the method of the embodiment of the present disclosure are executed. It should be noted that the computer-readable medium described in the embodiment of the present disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more conductors, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In an embodiment of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, an apparatus, or a device. In an embodiment of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, an apparatus, or a device. The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wire, optical cable, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0136] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: acquires a target image; performs text line detection on the target image to obtain text line position information of the text line in the target image; performs character recognition on the image area in the target image at the position indicated by the text line position information to obtain a character sequence included in the text line; and generates character position information of the characters in the text line according to the character sequence.
[0137] Computer program code for performing the operations of the embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0138] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0139] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes an acquisition unit, a detection unit, a recognition unit, and a generation unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the acquisition unit may also be described as a "unit for acquiring a target image".
[0140] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure to form a technical solution.
Claims
1. A character positioning method, comprising: Get the target image; Performing text line detection on the target image to obtain text line position information of the text lines in the target image; For a single character in a text line in a target image, character recognition is performed on an image region in the target image located at a position indicated by the text line position information to obtain a character sequence included in the text line; wherein the character sequence includes two or more characters corresponding to the single character, and the character sequence includes placeholder characters and non-placeholder characters; According to the character sequence, character position information of placeholder characters and character position information of each non-placeholder character in the character sequence are generated; wherein the character position information of the non-placeholder characters is generated according to the position of a placeholder character group; the placeholder character group is composed of continuous placeholder characters; and the position of the placeholder character group is determined according to the position of the placeholder characters in the placeholder character group; For two adjacent placeholder characters in the character sequence, if the distance between the two adjacent placeholder characters is greater than a first preset distance threshold, there is a non-placeholder character between the two adjacent placeholder characters. In response to the fact that the non-placeholder characters between the two adjacent placeholder characters in the character sequence are the same, any position between the two adjacent placeholder characters is determined as the segmentation position of the non-placeholder character, non-placeholder character position information of each non-placeholder character is determined according to the segmentation position, and character position information of the characters in the text line corresponding to the non-placeholder characters between the two adjacent placeholder characters is generated.
2. The method according to claim 1, wherein: The acquiring of the target image comprises: acquiring an image presented on a target display screen as a target image; and The method further comprises: In response to detecting a user operation on a character in the target image, based on the operation position of the user operation on the target display screen and the character position information of the character in the text line, the character to be operated indicated by the user operation is determined from the text line indicated by the text line position information.
3. The method according to claim 2, wherein: The method further comprises: Output information pre-associated with the character to be operated is output.
4. The method according to claim 2, wherein: The method further comprises: According to the instruction of the user operation, the character to be operated is processed in accordance with the instruction of the user operation.
5. A character positioning device, comprising: an acquisition unit, configured to acquire a target image; a detection unit, configured to perform text line detection on the target image to obtain text line position information of the text line in the target image; a recognition unit configured to perform character recognition on an image region in the target image located at a position indicated by the text line position information for a single character in a text line in a target image, so as to obtain a character sequence included in the text line; wherein the character sequence includes two or more characters corresponding to the single character, and the character sequence includes placeholder characters and non-placeholder characters; A generating unit is configured to generate, according to the character sequence, character position information of placeholder characters and character position information of each non-placeholder character in the character sequence; wherein, the character position information of the non-placeholder character is generated according to the position of a placeholder character group; the placeholder character group is composed of continuous placeholder characters; the position of the placeholder character group is determined according to the position of the placeholder characters in the placeholder character group; for two adjacent placeholder characters in the character sequence, if the distance between the two adjacent placeholder characters is greater than a first preset distance threshold, then there is a non-placeholder character between the two adjacent placeholder characters, in response to the non-placeholder characters between the two adjacent placeholder characters in the character sequence being the same, any position between the two adjacent placeholder characters is determined as a segmentation position of the non-placeholder character, the non-placeholder character position information of each non-placeholder character is determined according to the segmentation position, and the character position information of the characters corresponding to the non-placeholder characters between the two adjacent placeholder characters in the text line is generated.
6. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
8. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Text recognition method, apparatus, storage medium, and computer device
CN109389115A
Multi-language text recognition method and device, computer equipment and storage medium
CN110569830A