Single word detection method and apparatus

By acquiring individual character heatmaps and character-related heatmaps, and combining projection segmentation and connected component segmentation methods, the problem of low accuracy in existing individual character detection methods is solved, achieving more efficient automatic individual character detection.

CN117275000BActive Publication Date: 2025-11-28ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210672876.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-14
Publication Date
2025-11-28
Estimated Expiration
2042-06-14

AI Technical Summary

Technical Problem

Existing single-character detection methods have low accuracy and cannot effectively detect single characters in images, often requiring users to manually select or stitch them together.

Method used

By acquiring heatmaps of individual characters and related characters, and using projection segmentation and connected component segmentation methods, combined with background and text colors, the position and cutting boundaries of individual characters can be accurately located, thus achieving automatic detection of individual characters.

Benefits of technology

It improves the accuracy and efficiency of single-character detection, reduces user interaction, and can more accurately detect single characters in images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117275000B_ABST
    Figure CN117275000B_ABST
Patent Text Reader

Abstract

The application provides a single word detection method and device, wherein the method comprises the following steps: obtaining a single word heat map and a word correlation heat map based on a first picture; performing screenshot processing on the first picture based on the single word heat map and the word correlation heat map to obtain at least one second picture; and performing single word cutting on each second picture based on the word correlation heat map to obtain single words in each second picture; wherein the single word heat map is used to indicate position information of each single word in the first picture; and the word correlation heat map is used to indicate connection relationship information between adjacent single words in the first picture. The single word detection method and device provided by the application can more accurately detect single words in a picture by obtaining a single word heat map and a word correlation heat map corresponding to the picture, extracting pictures of each text line based on the single word heat map and the word correlation heat map, and performing single word cutting on the pictures of each text line based on the word correlation heat map to detect single words in the picture.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular to a single character detection method and device. BACKGROUND

[0002] Single character detection refers to detecting each single character (i.e. single word) in a picture, that is, cutting and outputting the words in the picture in units of single characters. The application scenarios of the single character detection method can include but are not limited to: detecting and replacing errors in a picture or a poster; obtaining the font type of a character in a picture.

[0003] At present, the existing single character detection method generally performs text line detection on the picture to be detected first, and then performs segmentation on the region picture corresponding to each text line, so as to obtain each single character detection frame. However, the existing single character detection method has low accuracy and cannot well detect single characters, so manual framing or splicing is often required in actual application to select single characters. SUMMARY

[0004] The present application provides a single character detection method and device to solve the problem of low accuracy of the prior art in single character detection, and to achieve more accurate and better detection of single characters.

[0005] The present application provides a single character detection method, comprising:

[0006] Based on the first picture, a single character heat map and a character related heat map are obtained;

[0007] Based on the single character heat map and the character related heat map, the first picture is processed by taking a screenshot to obtain at least one second picture;

[0008] Based on the character related heat map, each second picture is cut into single characters to obtain single characters in each second picture;

[0009] The single character heat map is used to indicate the position information of each single character in the first picture, and the character related heat map is used to indicate the connection relationship information between adjacent single characters in the first picture.

[0010] According to the single character detection method provided by the present application, based on the character related heat map, each second picture is cut into single characters to obtain single characters in each second picture, comprising:

[0011] The following processing is performed for each second picture:

[0012] The second picture is binarized to obtain a third picture;

[0013] determine a first target point in the third picture based on the word-related heat map, and determine a second target point in the third picture based on a projection segmentation method;

[0014] perform single-word segmentation on the third picture based on a background color of the third picture, a color of the word in the third picture, the first target point and the second target point, and obtain the single word.

[0015] According to the single-word detection method provided by the application, the single-word segmentation on the third picture based on the background color of the third picture, the color of the word in the third picture, the first target point and the second target point comprises:

[0016] determine a segmentation boundary based on the first target point and the second target point;

[0017] perform single-word segmentation on the third picture based on the segmentation boundary, and obtain the single word based on the background color of the third picture and the color of the word in the third picture.

[0018] According to the single-word detection method provided by the application, the determination of the segmentation boundary based on the first target point and the second target point comprises:

[0019] perform the following processing for each first target point:

[0020] if the second target point exists in a first circle with the first target point as the center and a first distance as the radius, determine the second target point in the first circle as the segmentation boundary;

[0021] if the second target point does not exist in the first circle, determine the first target point as the segmentation boundary.

[0022] According to the single-word detection method provided by the application, the determination of the first target point in the third picture based on the word-related heat map and the determination of the second target point in the third picture based on the projection segmentation method comprise:

[0023] obtain a point corresponding to the center of the circle in the word-related heat map in the third picture as the first target point;

[0024] obtain a point in the third picture for indicating the segmentation boundary between adjacent single words as the second target point based on the projection segmentation method.

[0025] According to the single-word detection method provided by the application, after the binaryzation processing on the second picture to obtain the third picture, the method further comprises:

[0026] acquire a first black-and-white proportion of the third picture and a second black-and-white proportion of an edge part of the third picture;

[0027] determine a background color of the third picture and a color of a character in the third picture based on the first black-and-white proportion and the second black-and-white proportion.

[0028] According to the single character detection method provided by the application, the single character heat map and the character-related heat map are acquired based on the first picture, and the method comprises the following steps:

[0029] acquire a probability of each pixel point in the first picture being at a character center and a probability of the each pixel point being at a character gap;

[0030] acquire the single character heat map based on the probability of the each pixel point being at the character center and acquire the character-related heat map based on the probability of the each pixel point being at the character gap.

[0031] According to the single character detection method provided by the application, the single character heat map and the character-related heat map are acquired based on the first picture, and the method comprises the following steps:

[0032] perform a logical operation on the single character heat map after binaryzation and the character-related heat map after binaryzation to acquire a fourth picture;

[0033] acquire first position information based on the fourth picture;

[0034] perform a screenshot processing on the first picture based on the first position information to acquire at least one second picture.

[0035] According to the single character detection method provided by the application, the single character heat map and the character-related heat map are acquired based on the first picture, and the method comprises the following steps:

[0036] perform contour searching on the fourth picture to acquire an outer rectangle frame with the smallest contour searched;

[0037] acquire position information of the outer rectangle frame as the first position information.

[0038] The application further provides a single character detection device, comprising:

[0039] an acquisition module configured to acquire a single character heat map and a character-related heat map based on a first picture;

[0040] a screenshot module configured to perform a screenshot processing on the first picture based on the single character heat map and the character-related heat map to acquire at least one second picture;

[0041] a cutting module, configured to cut each of the second pictures into single characters based on the character-related heat map, to obtain single characters in each of the second pictures;

[0042] wherein the single character heat map is configured to indicate position information of each single character in the first picture, and the character-related heat map is configured to indicate connection relationship information between adjacent single characters in the first picture.

[0043] According to the single character detection device provided in the application, the cutting module comprises:

[0044] a binarization unit, configured to perform binarization processing on the second picture to obtain a third picture;

[0045] a point determination unit, configured to determine a first target point in the third picture based on the character-related heat map, and determine a second target point in the third picture based on a projection segmentation method;

[0046] a cutting unit, configured to cut the third picture into single characters based on a background color of the third picture, a color of characters in the third picture, the first target point and the second target point, to obtain the single characters.

[0047] According to the single character detection device provided in the application, the cutting unit comprises:

[0048] a limit determination sub-unit, configured to determine a segmentation limit based on the first target point and the second target point;

[0049] a cutting sub-unit, configured to cut the third picture into single characters based on the segmentation limit, and obtain the single characters based on a background color of the third picture and a color of characters in the third picture.

[0050] According to the single character detection device provided in the application, the limit determination unit is specifically configured to perform the following processing for each first target point:

[0051] in a case where the second target point exists in a first circle with the first target point as the center and a first distance as the radius, the second target point in the first circle is determined as the segmentation limit;

[0052] in a case where the second target point does not exist in the first circle, the first target point is determined as the segmentation limit.

[0053] According to the single character detection device provided in the application, the point determination unit comprises:

[0054] a first point determination sub-unit, configured to obtain a point corresponding to a center of the character-related heat map in the third picture as the first target point;

[0055] A second point determination sub-unit is configured to acquire, based on the projection segmentation method, a point in the third picture indicating a segmentation boundary between adjacent single characters as the second target point.

[0056] According to the single character detection device provided in the present application, the single character detection device further comprises:

[0057] A proportion acquisition module is configured to acquire a first black-and-white proportion of the third picture as a whole picture and a second black-and-white proportion of an edge portion of the third picture.

[0058] A color determination module is configured to determine a background color of the third picture and a color of a character in the third picture based on the first black-and-white proportion and the second black-and-white proportion.

[0059] According to the single character detection device provided in the present application, the acquisition module comprises:

[0060] A probability acquisition unit is configured to acquire a probability of each pixel point in the first picture being at a character center and a probability of each pixel point being at a character gap.

[0061] A figure acquisition unit is configured to acquire the single character heat map based on the probability of each pixel point being at the character center and acquire the character-related heat map based on the probability of each pixel point being at the character gap.

[0062] According to the single character detection device provided in the present application, the screenshot module comprises:

[0063] A superposition unit is configured to perform a logical operation on the single character heat map after the binarization processing and the character-related heat map after the binarization processing to acquire a fourth picture.

[0064] A position acquisition unit is configured to acquire first position information based on the fourth picture.

[0065] A screenshot unit is configured to perform a screenshot processing on the first picture based on the first position information to acquire at least one second picture.

[0066] According to the single character detection device provided in the present application, the position acquisition unit is specifically configured to perform a contour search on the fourth picture to acquire a minimum circumscribed rectangle frame searched, and acquire position information of the circumscribed rectangle frame as the first position information.

[0067] The present application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the single character detection method according to any one of the above when executing the program.

[0068] The application further provides a non-transitory computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the single character detection method.

[0069] The application further provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the single character detection method.

[0070] The single character detection method and device provided by the application can obtain a single character heat map and a character correlation heat map corresponding to a first picture, extract a picture of each text line in the first picture based on the single character heat map and the character correlation heat map, perform single character cutting on the picture of each text line based on the character correlation heat map, and detect single characters in the first picture, so that the single characters in the picture can be detected more accurately, and the specific positions of the single characters and the text lines can be detected. Further, the steps of the single character detection method provided by the embodiments of the application are simpler, and the efficiency of single character detection is higher, so that the interactive operation of a user can be reduced. BRIEF DESCRIPTION OF DRAWINGS

[0071] In order to more clearly illustrate the technical solutions of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0072] Figure 1 is a flowchart of the single character detection method provided by the application;

[0073] Figure 2 is a schematic diagram of a first picture in the single character detection method provided by the application;

[0074] Figure 3 is a flowchart of the single character detection process provided by the application;

[0075] Figure 4 is a schematic diagram of a single character heat map in the single character detection method provided by the application;

[0076] Figure 5 is a schematic diagram of a character correlation heat map in the single character detection method provided by the application;

[0077] Figure 6 is a schematic diagram of a first target point and a second target point in the single character detection method provided by the application;

[0078] Figure 7 is Figure 2 is a schematic diagram of a single character cutting result of the first picture shown in FIG. 8;

[0079] Figure 8 is a structural schematic diagram of a single word detection device provided by the present application.

[0080] Figure 9 is a structural schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION

[0081] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described clearly and completely below with reference to the drawings in the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0082] In the description of the embodiments of the present application, the terms "first", "second", "third" are only used for description purpose, and cannot be understood as indicating or implying relative importance, and do not involve sequence.

[0083] The single word detection method and device provided by the present application will be described below. Figures 1 to 9

[0084] Figure 1 is a flowchart of a single word detection method provided by the present application. As shown in Figure 1 the single word detection method provided by the present application can be executed by a single word detection device, and the method comprises steps 101, 102 and 103.

[0085] Specifically, the single word detection device can be implemented in various forms. For example, the single word detection device described in the embodiments of the present application can include mobile terminals such as mobile phones, smart phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), navigation devices, smart bracelets, smart bands, digital cameras, etc., and fixed terminals such as digital TVs, desktop computers (PCs), embedded devices, etc.

[0086] The single word detection method provided by the embodiments of the present application can be flexibly used in various scenes requiring single word detection.

[0087] Step 101, based on the first picture, obtaining a single word heat map and a word related heat map; wherein the single word heat map is used to indicate the position information of each single word in the first picture; the word related heat map is used to indicate the connection relationship information between adjacent single words in the first picture.

[0088] ​Specifically, the first picture can be calculated, the position information of each character in the first picture can be extracted, a character heat map can be obtained, and the connection relationship information between adjacent characters in the first picture can be extracted, a character correlation heat map can be obtained.

[0089] Optionally, the position information of the character can be represented by the probability of a pixel point being at the center of the character (i.e., position score), and the connection relationship information between adjacent characters can be represented by the probability of each pixel point being in the gap between characters (i.e., neighborhood score).

[0090] Optionally, the first picture can be input into a pre-trained neural network model to obtain the character heat map and the character correlation heat map output by the neural network model.

[0091] Optionally, the neural network model can adopt a full convolutional network structure based on VGG-16; in order to aggregate low-level features, a skip connection (similar to U-Net) can be used in the decoding part, and finally two score maps, i.e., the character heat map and the character correlation heat map, are output.

[0092] Optionally, before training the neural network model, the sample picture can be labeled. Labeling the sample picture can be labeling the position score and the neighborhood score with a Gaussian distribution.

[0093] The labeling of image segmentation is a continuous two-dimensional Gaussian distribution, and the pixel points at the center of the character box have a higher position score, while the pixel points at the edge of the character box have a lower position score, thereby fully utilizing the position information of the pixel points. Since the character box is usually an irregular quadrilateral, in specific operations, the two-dimensional standard Gaussian distribution can be transformed into the quadrilateral of the character box.

[0094] When obtaining the neighborhood score labeling, the diagonal lines of the quadrilateral of the character box can be connected first; the centers of gravity of the upper and lower two triangles are found respectively, and the four triangle centers of gravity shared by two adjacent characters are set as a neighborhood box; using the same method as the position score, a Gaussian distribution in the neighborhood box is generated, thereby obtaining the neighborhood score.

[0095] Step 102, based on the character heat map and the character correlation heat map, the first picture is subjected to screenshot processing to obtain at least one second picture.

[0096] Specifically, based on the position information of each character in the first picture indicated by the character heat map and the connection relationship information between adjacent characters in the first picture indicated by the character correlation heat map, the text of the first picture can be divided into text lines to obtain the information of each text line. Each text line can include at least one character.

[0097] After obtaining the information of each text line, the first picture can be screenshot processed in the unit of text line to obtain a second picture. Each second picture, which is a part of the first picture, can include one text line in the first picture.

[0098] In step 103, based on the word-related heat map, each second picture is individually subjected to single-word segmentation to obtain single words in each second picture.

[0099] Specifically, for each second picture, the following processing can be performed:

[0100] Based on the part corresponding to the second picture in the word-related heat map, connection relationship information between adjacent single words in the second picture is obtained. Based on the connection relationship information between adjacent single words in the second picture, the segmentation boundary of adjacent single words in the second picture can be determined according to any character segmentation method such as projection segmentation method or connected component segmentation method. Based on the segmentation boundary of adjacent single words in the second picture, the second picture is subjected to single-word segmentation to obtain single words in the second picture.

[0101] It can be understood that after obtaining the single words in each second picture, the single words in the first picture are obtained.

[0102] The principle of the connected component segmentation method is that each single word is assumed to be composed of a single connected component, in other words, there is no adhesion. A pixel point with the same color as the color of the text (for example, black) is found and judgment is started. After all connected pixel points with the same color as the color of the text are marked, the segmentation position of the single word is judged.

[0103] The embodiment of the present application can obtain the single word heat map and the word-related heat map corresponding to the first picture, extract the picture of each text line in the first picture based on the single word heat map and the word-related heat map, and perform single-word segmentation on the picture of each text line based on the word-related heat map to detect the single words in the first picture. The single words in the picture can be more accurately detected, and the specific positions of the single words and the text lines can be detected. Further, the steps of the single word detection method provided by the embodiment of the present application are simpler and the efficiency of single word detection is higher, and the interactive operation of the user can be reduced.

[0104] Optionally, in some possible implementation manners of the embodiment of the present application, based on the word-related heat map, the second picture is subjected to single-word segmentation to obtain the single words in the second picture, including: for each second picture, the following processing is performed: the second picture is subjected to binarization processing to obtain a third picture.

[0105] Specifically, for each second picture, it can be determined whether the second picture is a binary picture. In the case that the second picture is not a binary picture, the second picture can be binarized to obtain a third picture in black and white.

[0106] Based on the word-related heat map, a first target point in the third picture is determined, and based on a projection segmentation method, a second target point in the third picture is determined.

[0107] Specifically, based on the probability that each pixel point in the word-related heat map is in a character gap, each first pixel point that can be used to segment a single character can be obtained; the pixel point in the third picture corresponding to each first pixel point is determined as a first target point. The position of the first pixel point in the word-related heat map is the same as the position of the pixel point in the third picture corresponding to the first pixel point in the third picture.

[0108] Optionally, based on the projection segmentation method (generally a vertical projection segmentation method), each pixel point (i.e., a segmentation point) in the third picture that is used to segment a single character is determined as a second target point.

[0109] The principle of the projection segmentation method is to analyze the distribution histogram of the pixels of the binary picture to find the demarcation point of adjacent characters for segmentation.

[0110] In the vertical projection segmentation method, the projection reflects the number of pixels in the vertical direction that are in two different colors, black and white. By judging the number of pixels in each column of the projection that are in two different colors, black and white, the segmentation point can be found.

[0111] Based on the background color of the third picture, the color of the text in the third picture, the first target point, and the second target point, the third picture is segmented into single characters to obtain the single characters.

[0112] It should be noted that, before determining the second target point in the third picture based on the projection segmentation method, the background color of the third picture and the color of the text in the third picture can be determined first, i.e., it is determined whether the third picture is black background and white text (the background color is black and the color of the text is white) or white background and black text (the background color is white and the color of the text is black).

[0113] Optionally, based on the color of each pixel point in the third picture, the background color of the third picture and the color of the text in the third picture can be determined. The color of a pixel point in the third picture can be represented by the pixel value of the pixel point. For example, if the pixel value is 1, the color of the pixel point is black; if the pixel value is 0, the color of the pixel point is white.

[0114] Exemplarily, assume that the color of the text in the third picture is white and the background color is black. The third picture can be regarded as a matrix composed of column vectors [x1, x2, x3, x4.......]; the number of white pixels in each column vector can be counted, and based on this, it can be determined whether the column vector is located in the text area or the background area.

[0115] Optionally, the general projection segmentation method is applicable to pictures with white backgrounds and black text. In the case where the third picture has a white background and black text, the projection segmentation method can be directly applied to determine the second target point; in the case where the third picture has a black background and white text, after performing color inversion on the third picture, the projection segmentation method can be applied to determine the second target point.

[0116] Color inversion processing refers to taking the inverse of the color of each pixel point in the binary image. That is, the pixel value of a pixel point with an original pixel value of 0 is changed to 1, and the pixel value of a pixel point with an original pixel value of 1 is changed to 0. Through color inversion processing, a picture with a white background and black text can be transformed into a picture with a black background and white text; conversely, a picture with a black background and white text can be transformed into a picture with a white background and black text.

[0117] Specifically, both the first target point and the second target point can be used to segment single characters. Therefore, the first target point and the second target point can be combined to perform single-character cutting on the third picture, extract the pixel points with the color of the text in the third picture in each part obtained by cutting, and ignore the pixel points with the color of the background of the third picture in each part obtained by cutting, so as to obtain the single characters in the third picture. Since the third picture is obtained by performing binary processing on the second picture, the single characters in the third picture can be the single characters in the second picture.

[0118] It can be understood that in the case where the second picture is a binary picture, the second picture can be used as the third picture, and then the steps of determining the first target point in the third picture based on the character-related heat map, determining the second target point in the third picture based on the projection segmentation method, and performing single-character cutting on the third picture based on the first target point and the second target point to obtain the single characters in the second picture can be executed.

[0119] It should be noted that the projection segmentation method determines the gap for single-character cutting through projection judgment. If only the vertical projection method is used alone for single-character cutting, for characters with a left-right structure such as the character "的", it is easy to be cut into "白" and "勺", while in the embodiments of the present invention, the character-related heat map and the projection segmentation method are combined, which can more accurately and quickly determine the single-character cutting gap and perform single-character segmentation.

[0120] The embodiment of the present application can determine the first target point in the third picture based on the word-related heat map, determine the second target point in the third picture based on the projection segmentation method, perform single-word cutting on the third picture based on the first target point and the second target point, and obtain the single word in the second picture, thereby providing the accuracy and speed of single-word cutting, and improving the accuracy and efficiency of single-word detection.

[0121] Optionally, in some possible implementation manners of the embodiment of the present application, the single word is obtained by performing single-word cutting on the third picture based on the background color of the third picture, the color of the text in the third picture, the first target point and the second target point, and the single-word cutting comprises: determining the segmentation boundary based on the first target point and the second target point.

[0122] Specifically, the first target point is the center of the word-related heat map, that is, the point with the maximum probability in the character gap, and the second target point is the segmentation point determined based on the projection segmentation method, and therefore, the segmentation boundary of the adjacent single words in the third picture can be determined in combination with the first target point and the second target point.

[0123] The single word in the second picture is obtained by performing single-word cutting on the third picture based on the segmentation boundary and the background color of the third picture and the color of the text in the third picture.

[0124] Specifically, after the segmentation boundary of the adjacent single words in the third picture is determined, the single-word cutting can be performed on the third picture based on the segmentation boundary, the pixel points with the color of the text in the third picture in each part obtained by cutting are extracted, and the pixel points with the background color of the third picture in each part obtained by cutting are ignored, thereby obtaining the single word in the third picture. Since the third picture is obtained by performing binaryzation processing on the second picture, the single word in the third picture can be the single word in the second picture.

[0125] The embodiment of the present application determines the segmentation boundary based on the first target point and the second target point, performs single-word cutting on the third picture based on the segmentation boundary, and obtains the single word in the second picture, thereby providing the accuracy and speed of single-word cutting, and improving the accuracy and efficiency of single-word detection.

[0126] Optionally, in some possible implementation manners of the embodiment of the present application, the segmentation boundary is determined based on the first target point and the second target point, and the determination comprises: for each first target point, performing the following processing: in a case where the second target point exists in a first circle with the first target point as the center and a first distance as the radius, determining the second target point in the first circle as the segmentation boundary; and in a case where the second target point does not exist in the first circle, determining the first target point as the segmentation boundary.

[0127] Specifically, for each first target point, a projection search can be performed starting from the first target point, i.e., a search is performed starting from the first target point and with a first distance as a search radius, to determine whether there is a second target point within a first circle with the first target point as a center and the first distance as a radius.

[0128] If there is, the projection search starting from the first target point can be stopped, the second target point searched within the first circle is determined as a segmentation boundary, and then a projection search can be performed starting from the next first target point; if there is not, the projection search starting from the first target point can be stopped, and the first target point is determined as a segmentation boundary.

[0129] The first distance can be determined according to an actual scene. The specific value of the first distance is not limited in the embodiments of the present application.

[0130] Optionally, the first distance can be one-third to one-half of the height of the third picture. Setting the first distance to one-third to one-half of the height of the third picture can ensure that the obtained segmentation boundary is more accurate, so that a more accurate single-character detection result can be obtained.

[0131] The embodiments of the present application can more accurately and quickly find out a single-character cutting gap based on the word-related heat map and perform single-character cutting (cutting) based on the word-related heat map center as a starting point, can realize text detection of different granularities, can provide the accuracy and speed of single-character cutting, and thus can improve the accuracy and efficiency of single-character detection.

[0132] Optionally, in some possible implementation manners of the embodiments of the present application, based on the word-related heat map, the first target point in the third picture is determined, and based on the projection segmentation method, the second target point in the third picture is determined, including: obtaining a point corresponding to the center in the word-related heat map in the third picture as the first target point.

[0133] Specifically, the center in the part of the word-related heat map corresponding to the third picture can be determined as the first target point.

[0134] The center in the word-related heat map is a pixel point with the largest probability of being in a character gap, so that single-character segmentation at the pixel point can have the largest probability of accurately segmenting a single character, and thus the center in the word-related heat map can be determined as the first target point.

[0135] Based on the projection segmentation method, a point in the third picture for indicating a segmentation boundary between adjacent single characters is obtained as the second target point.

[0136] Specifically, the second pixels in the third picture for indicating the segmentation boundary between adjacent single characters can be determined based on a projection segmentation method (generally a vertical projection segmentation method).

[0137] The second pixels are for indicating the segmentation boundary between adjacent single characters, and thus can be used for segmenting the single characters. Therefore, the above-mentioned second pixels can be taken as second target points.

[0138] The embodiment of the present application can obtain the points corresponding to the circle centers in the word-related heat map in the third picture as first target points, and obtain the points in the third picture for indicating the segmentation boundary between adjacent single characters as second target points based on the projection segmentation method, so as to obtain the points for segmenting the single characters by different methods, thereby combining the word-related heat map and the projection segmentation method to more accurately and quickly determine the single character cutting gap and perform single character segmentation.

[0139] Optionally, in some possible implementation manners of the embodiment of the present application, after the binarization processing is performed on the second picture, the method further includes: obtaining a first black-and-white proportion of the entire third picture and a second black-and-white proportion of an edge part of the third picture.

[0140] Specifically, the ratio of the total number of black pixels to the total number of white pixels in the entire third picture can be counted to obtain the first black-and-white proportion.

[0141] The ratio of the total number of black pixels to the total number of white pixels in the edge part of the third picture can also be counted to obtain the second black-and-white proportion.

[0142] The edge part of the third picture can include A rows of pixels on the upper edge, B rows of pixels on the lower edge, C rows of pixels on the left edge, and D rows of pixels on the right edge of the third picture. For the repeated parts of the A rows of pixels on the upper edge, the B rows of pixels on the lower edge, the C rows of pixels on the left edge, and the D rows of pixels on the right edge of the third picture, the repeated counting is not performed. Wherein, A, B, C and D are positive integers; any two of A, B, C and D can be equal or different.

[0143] The values of A, B, C and D can be determined according to the size of the third picture. The embodiment of the present application does not make specific limitation on the values of A, B, C and D.

[0144] Optionally, the values of A and B can be 1 / 10 to 1 / 3 of the height of the third picture.

[0145] Optionally, the values of C and D can be 1 / 10 to 1 / 3 of the height of the third picture.

[0146] Based on the first black-and-white proportion and the second black-and-white proportion, the background color of the third picture and the color of the character in the third picture are determined.

[0147] Specifically, the background color of the third picture and the color of the text in the third picture can be determined based on the first black-and-white ratio and the second black-and-white ratio together.

[0148] Optionally, in a case where the first black-and-white ratio and the second black-and-white ratio are both greater than 1, it can be determined that the background color of the third picture is black and the color of the text in the third picture is white, that is, the third picture is black-and-white.

[0149] Optionally, in a case where the first black-and-white ratio and the second black-and-white ratio are both less than 1, it can be determined that the background color of the third picture is white and the color of the text in the third picture is black, that is, the third picture is white-and-black.

[0150] The embodiment of the application can more accurately determine the background color of the third picture and the color of the text in the third picture by obtaining the first black-and-white ratio of the third picture as a whole and the second black-and-white ratio of the edge part of the third picture, and determining the background color of the third picture and the color of the text in the third picture based on the first black-and-white ratio and the second black-and-white ratio.

[0151] Optionally, in some possible implementation manners of the embodiment of the application, based on the first picture, the single-character heat map and the character-related heat map are obtained, including: obtaining the probability of each pixel point in the first picture being at a character center and the probability of each pixel point being at a character gap.

[0152] Specifically, for each pixel point in the first picture, the probability of the pixel point being at a character center and the probability of the pixel point being at a character gap can be obtained.

[0153] Optionally, the probability of each pixel point in the first picture being at a character center and the probability of each pixel point being at a character gap can be obtained through a probability obtaining submodel in a pre-trained neural network model. The probability of each pixel point in the first picture being at a character center and the probability of each pixel point being at a character gap output by the submodel can be obtained by inputting the first picture into the probability obtaining submodel in the pre-trained neural network model.

[0154] The single-character heat map is obtained based on the probability of each pixel point being at a character center, and the character-related heat map is obtained based on the probability of each pixel point being at a character gap.

[0155] Specifically, the first data transformation processing can be performed on the probability of each pixel point being in the character center, and the first pixel value of each pixel point can be obtained. In the process of performing the first data transformation processing, for any two pixel points, the size relationship of the probability of the two pixel points being in the character center is the same as the size relationship of the first pixel values of the two pixel points.

[0156] Exemplarily, the first data transformation processing can include, but is not limited to, any one or a combination of at least two of processing modes such as linear amplification, exponential transformation and logarithmic transformation.

[0157] Optionally, the probability of each pixel point being in the character gap can also be directly taken as the second pixel value of the pixel point.

[0158] For each pixel point in the second picture, the original pixel value of the pixel point is updated to the second pixel value of the pixel point. Thus, the word-related heat map is obtained.

[0159] Exemplarily, the second data transformation processing can include, but is not limited to, any one or a combination of at least two of processing modes such as linear amplification, exponential transformation and logarithmic transformation.

[0160] Exemplarily, the first data transformation processing can include, but is not limited to, any one or a combination of at least two of processing modes such as linear amplification, exponential transformation and logarithmic transformation.

[0161] The specific mode of the second data transformation processing can be the same as or different from the specific mode of the first data transformation processing.

[0162] Optionally, the probability of each pixel point being in the character gap can also be directly taken as the second pixel value of the pixel point.

[0163] For each pixel point in the second picture, the original pixel value of the pixel point is updated to the second pixel value of the pixel point. Thus, the word-related heat map is obtained.

[0164] The embodiment of the present application can obtain the probability of each pixel point in the character center and the probability of each pixel point in the character gap in the first picture, obtain the single-word heat map based on the probability of each pixel point being in the character center, and obtain the word-related heat map based on the probability of each pixel point being in the character gap, so as to obtain the single-word heat map which can more accurately indicate the position information of each single word in the first picture and the word-related heat map which can more accurately indicate the connection relationship information between adjacent single words in the first picture, thereby more accurately detecting the single word in the picture based on the single-word heat map and the word-related heat map.

[0165] Optionally, in some possible implementation manners of the embodiment of the present application, the first picture is subjected to screenshot processing based on the single-character heat map and the character correlation heat map to obtain at least one second picture, which includes: performing a logical operation on the single-character heat map after the binarization processing and the character correlation heat map after the binarization processing to obtain a fourth picture.

[0166] Specifically, the single-character heat map and the character correlation heat map can be subjected to binarization processing respectively to obtain binary images.

[0167] The single-character heat map after the binarization processing and the character correlation heat map after the binarization processing are superimposed, that is, the pixel points at the same positions in the single-character heat map after the binarization processing and the character correlation heat map after the binarization processing are subjected to a logical operation, so that the fourth picture is obtained.

[0168] The logical operation can include any one of a logical AND operation, a logical OR operation and a logical NOT operation or a combination of at least two of them.

[0169] Exemplarily, the single-character heat map after the binarization processing and the character correlation heat map after the binarization processing can be subjected to a logical OR operation to obtain the fourth picture.

[0170] The operation formula of the logical OR operation is as follows: 1|1=1, 1|0=0, 0|1=0, 0|0=0.

[0171] By subjecting the single-character heat map after the binarization processing and the character correlation heat map after the binarization processing to the logical OR operation, the single characters in the first picture can be connected, so that the fourth picture can be used to indicate the positions of the character part in the first picture.

[0172] Based on the fourth picture, the first position information is obtained.

[0173] Specifically, based on the fourth picture, the positions of the character part in the first picture can be determined, so that the position information of the character part in the first picture can be extracted as the first position information.

[0174] The character part in the first picture can include at least one text line, and therefore the first position information can include the position information of each text line.

[0175] Based on the first position information, the first picture is subjected to screenshot processing to obtain at least one second picture.

[0176] Specifically, based on the position information of each text line in the first position information, the position information of the text line can be mapped to the first picture, and the first picture is subjected to screenshot processing, so that a picture including the text line, that is, a second picture, can be obtained.

[0177] The embodiment of the present application can obtain the fourth picture by performing logical OR operation on the single-character heat map after binarization processing and the word-related heat map after binarization processing, obtain the first position information based on the fourth picture, perform screenshot processing on the first picture based on the first position information, and obtain at least one second picture, so that the text line in the first picture can be extracted more quickly and accurately, and thus the single-character cutting of the text line can be performed and the single character in the picture can be detected more accurately.

[0178] Optionally, in some possible implementation manners of the embodiment of the present application, the first position information is obtained based on the fourth picture, and the method comprises: performing contour finding on the fourth picture to obtain the smallest circumscribed rectangle frame of the found contour.

[0179] Specifically, the contour finding can be performed on the fourth picture to find each closed contour in the fourth picture.

[0180] For each contour, the smallest circumscribed rectangle frame of the circumscribed rectangle frame of the contour can be obtained.

[0181] The position information of the circumscribed rectangle frame is obtained as the first position information.

[0182] Specifically, for each smallest circumscribed rectangle frame, the position information of the smallest circumscribed rectangle frame can be obtained, so that the first position information is obtained.

[0183] Optionally, for each smallest circumscribed rectangle frame, the position information of the smallest circumscribed rectangle frame can comprise the coordinates of the four vertices of the smallest circumscribed rectangle frame.

[0184] The embodiment of the present application can obtain the smallest circumscribed rectangle frame of the found contour by performing contour finding on the fourth picture, obtain the position information of the circumscribed rectangle frame as the first position information, and thus the position information of each text line in the first picture can be obtained more quickly and accurately, so that the text line in the first picture can be extracted more quickly and accurately based on the position information of the text line, and thus the single-character cutting of the text line can be performed and the single character in the picture can be detected more accurately.

[0185] In order to facilitate the understanding of the above-mentioned embodiments of the present application, the process of single-character detection is described below through an example.

[0186] Exemplarily, for the first picture as shown in Figure 2 , the process of single-character detection on the first picture can be as shown in Figure 3 .

[0187] As shown in Figure 3 , the process of single-character detection can comprise:

[0188] Step 301, feature extraction.

[0189] The first picture can be subjected to position feature extraction to obtain a single-character heat map and a character-related heat map. Figure 2 As shown in the first picture, the obtained single-character heat map and the character-related heat map can be respectively as shown in Figure 4 and Figure 5 .

[0190] Step 302, position information extraction.

[0191] The binary processed single-character heat map and the binary processed character-related heat map are subjected to a logical OR operation to obtain a fourth picture; based on the fourth picture, first position information is obtained to determine each text line.

[0192] Step 303, line intercepting.

[0193] Based on the first position information, the first picture is subjected to a screenshot processing (which can be specifically line intercepting) to obtain at least one second picture.

[0194] Step 304, binary processing and reverse color judgment.

[0195] Each second picture is subjected to binary processing and reverse color judgment. If the binary processed second picture is white background and black characters, no reverse color processing is performed; if the binary processed second picture is black background and white characters, reverse color processing is performed to change it into white background and black characters.

[0196] Step 305, projection judgment.

[0197] The projection judgment is performed in combination with the character-related heat map and a projection segmentation method to determine a segmentation boundary.

[0198] As shown in the first picture, the single-character cutting result of the first picture can be as shown in Figure 6 , taking the first target point 601 as a starting point, searching a radius of one-half of the height of the outer frame 603; if the second target point 602 is found within the search radius by vertical projection, the search is stopped, and the second target point 602 is set as the segmentation boundary; if not, the starting point (i.e., the first target point 601) is set as the segmentation boundary.

[0199] Step 306, single-character intercepting.

[0200] The single-character intercepting is performed based on the segmentation boundary obtained in step 305. Figure 2 As shown in the first picture, the single-character cutting result of the first picture can be as shown in Figure 7 .

[0201] The single-character detection device provided by the present application is described below, and the single-character detection device described below can be correspondingly referred to the single-character detection method described above.

[0202] Figure 8is a structural schematic diagram of a single character detection device provided by the present application. Based on the content of any of the above embodiments, as shown in the figure, the device can include an acquisition module 801, a screenshot module 802, and a cutting module 803, wherein: Figure 8

[0203] The acquisition module 801 is configured to acquire a single character heat map and a character correlation heat map based on the first picture.

[0204] The screenshot module 802 is configured to perform screenshot processing on the first picture based on the single character heat map and the character correlation heat map to obtain at least one second picture.

[0205] The cutting module 803 is configured to perform single character cutting on each second picture based on the character correlation heat map to obtain single characters in each second picture.

[0206] The single character heat map is configured to indicate position information of each single character in the first picture, and the character correlation heat map is configured to indicate connection relationship information between adjacent single characters in the first picture.

[0207] Specifically, the acquisition module 801, the screenshot module 802, and the cutting module 803 can be sequentially electrically connected.

[0208] The acquisition module 801 can calculate the first picture, extract position information of each single character in the first picture to obtain the single character heat map, and extract connection relationship information between adjacent single characters in the first picture to obtain the character correlation heat map.

[0209] Based on the position information of each single character in the first picture indicated by the single character heat map and the connection relationship information between adjacent single characters in the first picture indicated by the character correlation heat map, the screenshot module 802 can divide the text of the first picture by text lines to obtain information of each text line, and after obtaining the information of each text line, perform screenshot processing on the first picture by text lines to obtain the second picture.

[0210] For each second picture, the cutting module 803 can acquire connection relationship information between adjacent single characters in the second picture based on a part corresponding to the second picture in the character correlation heat map, determine a cutting boundary of adjacent single characters in the second picture based on any character cutting method such as a projection segmentation method or a connected component segmentation method according to the connection relationship information between adjacent single characters in the second picture, and perform single character cutting on the second picture based on the cutting boundary of adjacent single characters in the second picture to obtain single characters in the second picture.

[0211] Optionally, the cutting module 803 can include:

[0212] A binarization unit configured to perform binarization processing on the second picture to obtain a third picture.​

[0213] a point determination unit, configured to determine a first target point in the third picture based on the word-related heat map, and determine a second target point in the third picture based on a projection segmentation method;

[0214] a cutting unit, configured to cut the third picture based on the first target point and the second target point to obtain a single word.

[0215] Optionally, the cutting unit can include:

[0216] a limit determination sub-unit, configured to determine a segmentation limit based on the first target point and the second target point;

[0217] a cutting sub-unit, configured to cut the third picture based on the segmentation limit to obtain a single word in the second picture based on a background color of the third picture and a color of a character in the third picture.

[0218] Optionally, the limit determination sub-unit can be specifically configured to perform the following processing for each first target point:

[0219] in a case where the second target point exists in a first circle with the first target point as a center and a first distance as a radius, determining the second target point in the first circle as the segmentation limit;

[0220] in a case where the second target point does not exist in the first circle, determining the first target point as the segmentation limit.

[0221] Optionally, the point determination unit can include:

[0222] a first point determination sub-unit, configured to obtain a point in the third picture corresponding to a center of the circle in the word-related heat map as the first target point;

[0223] a second point determination sub-unit, configured to obtain a point in the third picture for indicating a segmentation limit between adjacent single words as the second target point based on the projection segmentation method.

[0224] Optionally, the cutting module 803 can further include:

[0225] a proportion obtaining module, configured to obtain a first black-and-white proportion of the entire third picture and a second black-and-white proportion of an edge part of the third picture;

[0226] a color determination module, configured to determine a background color of the third picture and a color of a character in the third picture based on the first black-and-white proportion and the second black-and-white proportion.

[0227] Optionally, the obtaining module 801 can include:

[0228] The probability acquisition unit is configured to acquire a probability of each pixel point in the first picture being at a character center and a probability of each pixel point being at a character gap.

[0229] The graph acquisition unit is configured to acquire a single-character heat map based on the probability of each pixel point being at the character center and acquire a word-related heat map based on the probability of each pixel point being at the character gap.

[0230] Optionally, the screenshot module 802 can include:

[0231] The superposition unit is configured to perform a logical operation on the single-character heat map after the binarization processing and the word-related heat map after the binarization processing to acquire a fourth picture.

[0232] The position acquisition unit is configured to acquire first position information based on the fourth picture.

[0233] The screenshot unit is configured to perform a screenshot processing on the first picture based on the first position information to acquire at least one second picture.

[0234] Optionally, the position acquisition unit can be specifically configured to:

[0235] Perform contour searching on the fourth picture to acquire a minimum circumscribed rectangle frame of the searched contour.

[0236] Acquire position information of the circumscribed rectangle frame as the first position information.

[0237] The single-character detection device provided by the embodiment of the present application is used to execute the single-character detection method of the present application, and the implementation manner of the single-character detection device is consistent with the implementation manner of the single-character detection method of the present application, and the same beneficial effects can be achieved, and thus the description and definition in the single-character detection method in the foregoing embodiments can be used to understand the execution modules in the embodiment of the present application.

[0238] The single-character detection device is used for the single-character detection method in the foregoing embodiments. Therefore, the description and definition in the single-character detection method in the foregoing embodiments can be used to understand the execution modules in the embodiment of the present application.

[0239] The single-character detection method provided by the embodiment of the present application can acquire a single-character heat map and a word-related heat map corresponding to the first picture, extract a picture of each text line in the first picture based on the single-character heat map and the word-related heat map, perform single-character cutting on the picture of each text line based on the word-related heat map, and detect single characters in the first picture. The single-character detection method can more accurately detect the single characters in the picture, and can detect the specific positions of the single characters and the text lines.

[0240] Figure 9 is a structural schematic diagram of an electronic device provided by the present application, as Figure 9As shown, the electronic device can include a processor 910, a communications interface 920, a memory 930 and a communications bus 940, wherein the processor 910, the communications interface 920 and the memory 930 complete mutual communication through the communications bus 940. The processor 910 can invoke a logic instruction in the memory 930 to execute a single word detection method, which includes: based on a first picture, obtaining a single word heat map and a word correlation heat map; based on the single word heat map and the word correlation heat map, performing screenshot processing on the first picture to obtain at least one second picture; based on the word correlation heat map, performing single word cutting on each second picture respectively to obtain single words in each second picture; wherein the single word heat map is used to indicate position information of each single word in the first picture; and the word correlation heat map is used to indicate connection relationship information between adjacent single words in the first picture.

[0241] In addition, the logic instruction in the memory 930 described above can be realized in the form of a software function unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the embodiments of the method of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk and various program codes that can be stored in the medium.

[0242] The processor 910 in the electronic device provided by the embodiments of the present application can invoke the logic instruction in the memory 930, the implementation manner of which is consistent with the implementation manner of the single word detection method provided by the present application, and the same beneficial effects can be achieved, which will not be described here.

[0243] In another aspect, the present application also provides a computer program product, which comprises a computer program stored on a non-transitory computer-readable storage medium, and the computer program comprises program instructions, and when the program instructions are executed by a computer, the computer can execute the single character detection method provided by the above method, and the method comprises the following steps: obtaining a single character heat map and a character correlation heat map based on a first picture; performing screenshot processing on the first picture based on the single character heat map and the character correlation heat map to obtain at least one second picture; and performing single character cutting on each second picture respectively based on the character correlation heat map to obtain single characters in each second picture; wherein the single character heat map is used to indicate position information of each single character in the first picture; and the character correlation heat map is used to indicate connection relationship information between adjacent single characters in the first picture.

[0244] The computer program product provided by the embodiment of the present application is executed to realize the single character detection method, the specific implementation manners are consistent with those described in the foregoing method embodiments, and the same beneficial effects can be achieved, and thus no further description is given here.

[0245] In another aspect, the present application also provides a non-transitory computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the single character detection method provided by the above method is realized, and the method comprises the following steps: obtaining a single character heat map and a character correlation heat map based on a first picture; performing screenshot processing on the first picture based on the single character heat map and the character correlation heat map to obtain at least one second picture; and performing single character cutting on each second picture respectively based on the character correlation heat map to obtain single characters in each second picture; wherein the single character heat map is used to indicate position information of each single character in the first picture; and the character correlation heat map is used to indicate connection relationship information between adjacent single characters in the first picture.

[0246] The computer program stored on the non-transitory computer-readable storage medium provided by the embodiment of the present application is executed to realize the single character detection method, the specific implementation manners are consistent with those described in the foregoing method embodiments, and the same beneficial effects can be achieved, and thus no further description is given here.

[0247] The device embodiments described above are only schematic, and units described as separate components can or can not be physically separate, and components displayed as units can or can not be physical units, that is, can be located in one place, or can be distributed on multiple network units. According to actual needs, part or all of the modules can be selected to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.

[0248] Those skilled in the art can clearly understand the implementation of the various embodiments by means of software and necessary general hardware platforms through the description of the above embodiments, and of course, the implementation can also be through hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, and the computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the method of each embodiment or some parts of the embodiment.

[0249] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A single word detection method, characterized by, The method comprises the following steps: Based on the first picture, a single character heat map and a character correlation heat map are obtained; Based on the single character heat map and the character correlation heat map, the first picture is subjected to screenshot processing to obtain at least one second picture; Based on the character correlation heat map, each second picture is subjected to single character cutting to obtain single characters in each second picture; The single character heat map is used to indicate the position information of each single character in the first picture, and the character correlation heat map is used to indicate the connection relationship information between adjacent single characters in the first picture; The method comprises the following steps: For each second picture, the following processing is performed: In the case that the second picture is not a binary picture, the second picture is subjected to binary processing to obtain a third picture; or in the case that the second picture is a binary picture, the second picture is determined as a third picture; Based on the character correlation heat map, a first target point in the third picture is determined, and based on a projection segmentation method, a second target point in the third picture is determined, the first target point being a center of the character correlation heat map, and the second target point being a segmentation point determined based on the projection segmentation method; Based on the first target point and the second target point, a segmentation boundary is determined, the segmentation boundary being the first target point or the second target point; Based on the segmentation boundary, the third picture is subjected to single character cutting, and based on the background color of the third picture and the color of the text in the third picture, the single characters are obtained.

2. The single word detection method of claim 1, wherein, The method comprises the following steps: For each first target point, the following processing is performed: In the case that the second target point exists within a first circle with the first target point as the center and a first distance as the radius, the second target point within the first circle is determined as the segmentation boundary; In the case that the second target point does not exist within the first circle, the first target point is determined as the segmentation boundary.

3. The single word detection method of claim 1, wherein, The method comprises the following steps: The point in the third picture corresponding to the center of the character correlation heat map is obtained as the first target point; Based on the projection segmentation method, the point in the third picture indicating the segmentation boundary between adjacent single characters is obtained as the second target point.

4. The single word detection method of claim 1, wherein, The method further comprises the following steps after the second picture is subjected to binary processing to obtain a third picture: A first black-and-white ratio of the entire third picture and a second black-and-white ratio of the edge part of the third picture are obtained; Based on the first black-and-white ratio and the second black-and-white ratio, the background color of the third picture and the color of the text in the third picture are determined.

5. The single word detection method of claim 1, wherein, The method comprises the following steps: obtain probabilities of each pixel in the first picture being at a character center and probabilities of the each pixel being at a character gap; obtain the single-character heat map based on the probabilities of the each pixel being at the character center and obtain the word-related heat map based on the probabilities of the each pixel being at the character gap.

6. The single word detection method according to any one of claims 1 to 5, characterized in that, The screenshot processing of the first picture based on the single-character heat map and the word-related heat map to obtain at least one second picture includes: performing a logical operation on the single-character heat map after the binarization processing and the word-related heat map after the binarization processing to obtain a fourth picture; obtain first position information based on the fourth picture; perform the screenshot processing of the first picture based on the first position information to obtain at least one second picture.

7. The single word detection method of claim 6, wherein, The obtaining of the first position information based on the fourth picture includes: perform contour finding on the fourth picture to obtain a minimum-outer-rectangle frame of the found contour; obtain position information of the minimum-outer-rectangle frame as the first position information.

8. A single word detection device, characterized by, includes: an obtaining module configured to obtain a single-character heat map and a word-related heat map based on a first picture; a screenshot module configured to perform screenshot processing of the first picture based on the single-character heat map and the word-related heat map to obtain at least one second picture; a cutting module configured to perform single-character cutting on each of the second pictures based on the word-related heat map to obtain single characters in each of the second pictures; The single-character heat map is used to indicate position information of each single character in the first picture, and the word-related heat map is used to indicate connection relationship information between adjacent single characters in the first picture. The cutting module is specifically configured to perform the following processing for each of the second pictures: in a case where the second picture is not a binarized picture, performing binarization processing on the second picture to obtain a third picture; or in a case where the second picture is a binarized picture, determining the second picture as the third picture; determining a first target point in the third picture based on the word-related heat map, and determining a second target point in the third picture based on a projection segmentation method, the first target point being a center of the word-related heat map, and the second target point being a segmentation point determined based on the projection segmentation method; determining a segmentation boundary based on the first target point and the second target point, the segmentation boundary being the first target point or the second target point; performing single-character cutting on the third picture based on the segmentation boundary, and obtaining the single characters based on a background color of the third picture and a color of text in the third picture.

Citation Information

Patent Citations

  • Character detection method and device, electronic equipment and computer readable storage medium

    CN111680691A

  • Character detection method and device based on single characters and inter-character connection relationship prediction

    CN111798480A