Character segmentation method, device and computer readable storage medium

By binarizing multi-character images and determining the boundaries, the character segmentation method solves the problem of redundant black background affecting character segmentation and improves the recognition accuracy.

CN111814795BActive Publication Date: 2024-08-27CANAAN BRIGHT SIGHT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010503803.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-05
Publication Date
2024-08-27
Estimated Expiration
2040-06-05

AI Technical Summary

Technical Problem

When processing character samples of mechanical water meters with white characters on a black background, excess black background appears in the reading area, affecting the character segmentation effect and recognition accuracy.

Method used

By binary processing and character segmentation of multi-character images, the horizontal and vertical projection sizes are used to determine the boundaries of the character images, and then the second character segmentation is performed to remove redundant color blocks and improve the character segmentation effect.

Benefits of technology

The accuracy of character segmentation and recognition accuracy are improved, making the distribution of the test set and the training set more similar.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111814795B
    Figure CN111814795B
Patent Text Reader

Abstract

The present invention provides a character segmentation method, device and computer-readable storage medium thereof, the method comprising: obtaining a multi-character image, performing binarization processing and first character segmentation on the multi-character image to obtain multiple single-character images; determining the upper and lower boundaries of the single-character image according to the horizontal projection size of each row of pixels of the single-character image and a first preset coefficient; determining the left and right boundaries of the single-character image according to the vertical projection size of each column of pixels of the single-character image and a second preset coefficient; performing second character segmentation on the multi-character image according to the upper, lower, left and right boundaries of the single-character image to obtain multiple target single-character images. Using the above method, a better character segmentation effect can be obtained, thereby making the character recognition accuracy higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image recognition, and in particular relates to a character segmentation method, device and computer-readable storage medium thereof. Background Art

[0002] This section is intended to provide a background or context to embodiments of the invention that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.

[0003] With the increasing development and improvement of intelligent systems, the rise of remote meter reading technology has solved the difficulties of manual meter reading statistics and has become an important part of the modern management system. Meters with wireless meter reading functions, such as water meters, electricity meters, and gas meters, have begun to be gradually used in residential areas and high-end parks.

[0004] Although deep learning has been well applied in many scenarios, in some scenarios, due to the quantity and quality of the data set, the solution is not robust enough. For example, when processing the character sample collection of a black-background white-text mechanical water meter, you can use Figure 1 The characters in the water meter style shown in the figure have a complete black background without any redundancy, and the characters are centered in the segmentation box. However, in actual situations, there are many cases where water meter styles that are different from the training set will appear, for example, Figure 2 As shown, there is extra black background in the reading area, which directly affects the character segmentation effect and further affects the character recognition accuracy. Summary of the invention

[0005] In view of the above problems in the prior art, a character segmentation method, device and computer-readable storage medium are proposed. The above problems can be solved by using this method, device and computer-readable storage medium.

[0006] The present invention provides the following solutions.

[0007] In a first aspect, a character segmentation method is provided, comprising: acquiring a multi-character image, performing binarization processing and a first character segmentation on the multi-character image to obtain a plurality of single-character images; determining an upper boundary and a lower boundary of the single-character image according to a horizontal projection size of each row of pixels of the single-character image and a first preset coefficient; determining a left boundary and a right boundary of the single-character image according to a vertical projection size of each column of pixels of the single-character image and a second preset coefficient; performing a second character segmentation on the multi-character image according to the upper boundary, lower boundary, left boundary and right boundary of the single-character image to obtain a plurality of target single-character images.

[0008] In a possible implementation, the upper and lower boundaries of a single character image are determined based on the horizontal projection size of each row of pixels in the single character image and a first preset coefficient, and also include: determining the center position of the single character image, and determining a first threshold based on the width of the single character image and the first preset coefficient; traversing the first projection size of each row of pixels from the center position upward, and traversing the second projection size of each row of pixels from the center position downward in the single character image; and determining the upper and lower boundaries of the single character image by comparing the traversed first projection size, the second projection size, and the first threshold.

[0009] In a possible implementation, the upper and lower boundaries of a single character image are determined by comparing the traversed first projection size, the second projection size and the first threshold, and also include: wherein, if the first projection size of the Nth row of pixels traversed upward from the center position exceeds the first threshold, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold, then the upper boundary of the single character image is determined based on the Nth row of pixels; and / or, wherein, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold, then the lower boundary of the single character image is determined based on the Mth row of pixels.

[0010] In a possible implementation, the left and right boundaries of a single character image are determined based on the vertical projection size of each column of pixels in the single character image and a second preset coefficient, including: determining the center position of the single character image, and determining a second threshold based on the height of the single character image and the second preset coefficient; traversing the third projection size of each column of pixels from the center position to the left in the single character image, and traversing the fourth projection size of each column of pixels from the center position to the right; and determining the left and right boundaries of the single character image by comparing the traversed third projection size, fourth projection size and the second threshold.

[0011] In a possible implementation, the left and right boundaries of a single character image are determined by comparing the traversed third projection size, the fourth projection size and the second threshold, including: if the third projection size of the P-th column pixels traversed from the center position to the left exceeds the second threshold, and the third projection size of the P+1-th column pixels traversed from the center position to the left does not exceed the second threshold, then the left boundary of the single character image is determined based on the P-th column pixels; and / or, if the fourth projection size of the Q-th column pixels traversed from the center position to the right exceeds the second threshold, and the fourth projection size of the Q+1-th column pixels traversed from the center position to the right does not exceed the second threshold, then the right boundary of the single character image is determined based on the Q-th column pixels.

[0012] In a possible implementation, the method further includes: determining the center position of the single-character image, and determining a third threshold value based on the height of the single-character image and a third preset coefficient; traversing the vertical projection size of each column of pixels from the center position to the left, and traversing the vertical projection size of each column of pixels from the center position to the right in the single-character image; wherein, if the vertical projection size of the Xth column of pixels traversed from the center position to the left does not exceed the third threshold value, and the vertical projection size of the X+1th column of pixels traversed from the center position to the left exceeds the third threshold value, then determining the character left boundary of the single-character image based on the Xth column of pixels; and / or, wherein, if the vertical projection size of the Yth column of pixels traversed from the center position to the right does not exceed the third threshold value, and the vertical projection size of the Y+1th column of pixels traversed from the center position to the right exceeds the second threshold value, then determining the character right boundary of the single-character image based on the Yth column of pixels; and, dividing the background area of ​​the target single-character image into left and right halves according to the character left boundary and character right boundary of the single-character image.

[0013] In a second aspect, a character segmentation device is provided, comprising: a first segmentation unit, used to acquire a multi-character image, perform binarization processing and a first character segmentation on the multi-character image, and obtain a plurality of single-character images; an upper and lower boundary unit, used to determine the upper and lower boundaries of the single-character image according to the horizontal projection size of each row of pixels of the single-character image and a first preset coefficient; a left and right boundary unit, used to determine the left and right boundaries of the single-character image according to the vertical projection size of each column of pixels of the single-character image and a second preset coefficient; a second segmentation unit, used to perform a second character segmentation on the multi-character image according to the upper boundary, lower boundary, left boundary and right boundary of the single-character image, and obtain a plurality of target single-character images.

[0014] In a possible implementation, the upper and lower boundary units are also used to: determine the center position of a single character image, and determine a first threshold based on the width of the single character image and a first preset coefficient; traverse the first projection size of each row of pixels upward from the center position in the single character image, and traverse the second projection size of each row of pixels downward from the center position; and determine the upper and lower boundaries of the single character image by comparing the traversed first projection size, the second projection size and the first threshold.

[0015] In one possible embodiment, the upper and lower boundary units are also used for: wherein, if the first projection size of the Nth row of pixels traversed upward from the center position exceeds the first threshold, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold, then the upper boundary of the single character image is determined according to the Nth row of pixels; and / or, wherein, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold, then the lower boundary of the single character image is determined according to the Mth row of pixels.

[0016] In a possible implementation, the left and right boundary units are also used to: determine the center position of the single-character image, and determine the second threshold based on the height of the single-character image and a second preset coefficient; traverse the third projection size of each column of pixels from the center position to the left in the single-character image, and traverse the fourth projection size of each column of pixels from the center position to the right; and determine the left and right boundaries of the single-character image by comparing the traversed third projection size, fourth projection size and the second threshold.

[0017] In one possible embodiment, the left and right boundary units are also used for: wherein, if the third projection size of the P-th column pixels traversed from the center position to the left exceeds the second threshold, and the third projection size of the P+1-th column pixels traversed from the center position to the left does not exceed the second threshold, then the left boundary of the single character image is determined based on the P-th column pixels; and / or, wherein, if the fourth projection size of the Q-th column pixels traversed from the center position to the right exceeds the second threshold, and the fourth projection size of the Q+1-th column pixels traversed from the center position to the right does not exceed the second threshold, then the right boundary of the single character image is determined based on the Q-th column pixels.

[0018] In a possible embodiment, the device also includes a left-right bisection unit, which is used to: determine the center position of the single-character image, and determine a third threshold value based on the height of the single-character image and a third preset coefficient; traverse the vertical projection size of each column of pixels from the center position to the left, and traverse the vertical projection size of each column of pixels from the center position to the right in the single-character image; wherein, if the vertical projection size of the Xth column of pixels traversed from the center position to the left does not exceed the third threshold value, and the vertical projection size of the X+1th column of pixels traversed from the center position to the left exceeds the third threshold value, then determine the character left boundary of the single-character image based on the Xth column of pixels; and / or, wherein, if the vertical projection size of the Yth column of pixels traversed from the center position to the right does not exceed the third threshold value, and the vertical projection size of the Y+1th column of pixels traversed from the center position to the right exceeds the second threshold value, then determine the character right boundary of the single-character image based on the Yth column of pixels; and, divide the background area of ​​the target single-character image into left-right bisections according to the character left boundary and character right boundary of the single-character image.

[0019] According to a third aspect, a character segmentation device is provided, characterized in that it includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute: obtaining a multi-character image, performing binarization processing and a first character segmentation on the multi-character image to obtain a plurality of single-character images; determining an upper boundary and a lower boundary of the single-character image according to a horizontal projection size of each row of pixels of the single-character image and a first preset coefficient; determining a left boundary and a right boundary of the single-character image according to a vertical projection size of each column of pixels of the single-character image and a second preset coefficient; performing a second character segmentation on the multi-character image according to the upper boundary, the lower boundary, the left boundary and the right boundary of the single-character image to obtain a plurality of target single-character images.

[0020] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a program, and when the program is executed by a multi-core processor, the multi-core processor executes any method as in the first aspect.

[0021] At least one of the above-mentioned technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the present invention performs character segmentation preprocessing on the test set data, removes redundant color blocks in the character image to be recognized, improves the character segmentation effect, makes the test set and the training set have similar distribution, and thereby improves the recognition accuracy of the characters.

[0022] It should be understood that the above description is only an overview of the technical solution of the present invention, so that the technical means of the present invention can be more clearly understood and implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described below. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The advantages and benefits of the present invention and other advantages and benefits will be apparent to those skilled in the art by reading the detailed description of the exemplary embodiments below. The accompanying drawings are only used for the purpose of illustrating exemplary embodiments and are not to be considered as limiting the present invention. Moreover, the same reference numerals are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0024] Figure 1 A schematic diagram showing a character sample of a black-background white-character mechanical water meter of the prior art;

[0025] Figure 2 A schematic diagram of a multi-character image according to an embodiment of the present invention is shown;

[0026] Figure 3 A schematic flow chart of a character segmentation method according to an embodiment of the present invention is shown;

[0027] Figure 4a Shows the Figure 2 The binary image obtained after binarization processing is Figure 4b The single character image obtained after performing the first character segmentation on FIG. 4a is shown; Figure 4c Shows the Figure 4a A target single character image obtained after performing the second character segmentation;

[0028] Figure 5a The single character image before being divided into two halves is shown. Figure 5b A single character image after being divided into two halves is shown;

[0029] Figure 6 A schematic diagram showing the structure of a character segmentation device according to an embodiment of the present invention is shown;

[0030] Figure 7 A schematic diagram showing the structure of another character segmentation device according to an embodiment of the present invention is shown;

[0031] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0032] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0033] In the present invention, it should be understood that terms such as “including” or “having” are intended to indicate the existence of features, numbers, steps, behaviors, components, parts or a combination thereof disclosed in the specification, and are not intended to exclude the possibility of the existence of one or more other features, numbers, steps, behaviors, components, parts or a combination thereof.

[0034] It should also be noted that, in the absence of conflict, the embodiments and features of the embodiments of the present invention can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0035] Figure 3 The figure is a flow chart of a character segmentation method 300 according to an embodiment of the present application, and the character segmentation method 300 is used to segment a multi-character image. In the process, from the perspective of the device, the execution subject can be one or more electronic devices, and more specifically, can be a functional module associated with the camera in these devices; from the perspective of the program, the execution subject can be a program installed on these electronic devices.

[0036] Figure 3 The process in may include the following steps 301 to 304.

[0037] Step 301: acquiring a multi-character image, performing binarization processing and first character segmentation on the multi-character image, and obtaining a plurality of single-character images;

[0038] Step 302: determining the upper boundary and the lower boundary of the single character image according to the horizontal projection size of each row of pixels of the single character image and a first preset coefficient;

[0039] Step 303: determining the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and a second preset coefficient;

[0040] Step 304: performing a second character segmentation on the multi-character image according to the upper boundary, the lower boundary, the left boundary and the right boundary of the single-character image to obtain a plurality of target single-character images.

[0041] For example, in Figure 2 An example of a multi-character image is shown in FIG. 1 , which can be a grayscale image used to indicate the readings of a wheel-type meter such as a water meter or a gas meter commonly seen in daily life. It can be understood that since the amount of computation required for overall recognition of a multi-character image is large, the efficiency is low, and it is time-consuming and laborious, character segmentation processing is required to decompose the multi-character recognition task into a single-character recognition task to improve the recognition efficiency. In this embodiment, the double-half-character image is also regarded as a single-character image.

[0042] like Figure 4a and Figure 4b As shown, in step 301, further Figure 2 The multi-character image in is subjected to binarization processing and first character segmentation to obtain multiple single-character images. It can be understood that in this embodiment, the double-half-character image is also regarded as a single-character image. Figure 4a The Figure 2 The binary image obtained after the binarization process, the binarization process refers to obtaining a binary image (Binary Image) that can still reflect the overall and local features of the image by selecting a grayscale image with 256 brightness levels through an appropriate threshold. A binary image refers to an image state in which each pixel on the image has only two possible values. Binary images can usually be represented by black and white, B&W, or monochrome images. In this embodiment, the preset binary threshold used in the binarization process can be pre-set based on experience. Among them, the first character segmentation process refers to separating the image areas corresponding to different characters in the above binary image from each other. Figure 4b The Figure 4aThe single-character images (each box corresponds to a single-character image) are obtained by performing the first character segmentation on the binary image. For example, the horizontal and vertical ranges of each single character are obtained through vertical projection and horizontal projection methods, and then the first character segmentation is performed on the multi-character image according to the range to obtain multiple single-character images.

[0043] Next, traverse each single character, and in step 302, determine the upper and lower boundaries of the single character image according to the horizontal projection size of each row of pixels of the single character image and the first preset coefficient. Among them, the horizontal projection size can be understood as the number of black pixels in each row (binarized image), and the upper and lower boundaries of each single character are determined by comparing the horizontal projection size of each row of pixels. Further, in step 303, determine the left and right boundaries of the single character image according to the vertical projection size of each column of pixels of the single character image and the second preset coefficient; among them, the vertical projection size can be understood as the number of black pixels in each column, and the left and right boundaries are determined by comparing the vertical projection size of each column of pixels.

[0044] like Figure 4c After traversing and obtaining the upper and lower, left and right boundaries of each single character, in step 304, the multi-character image is subjected to a second character segmentation according to the upper boundary, lower boundary, left boundary and right boundary of the single character image to obtain multiple target single character images (each box corresponds to a target single character image). It can be seen that the segmentation effect of the target single character image is better and more robust.

[0045] based on Figure 3 The character segmentation method of this application also provides some specific implementation plans and extension plans of the character segmentation method, which are described below.

[0046] In some possible implementations, step 302 may also include: determining the center position of the single character image, and determining a first threshold based on the width of the single character image and a first preset coefficient; traversing the first projection size of each row of pixels upward from the center position in the single character image, and traversing the second projection size of each row of pixels downward from the center position; determining the upper and lower boundaries of the single character image by comparing the traversed first projection size, the second projection size and the first threshold.

[0047] In this embodiment, the first projection size and the second projection size are both horizontal projection sizes. The first threshold is determined according to the width of the single character image and the first preset coefficient, and then the upper boundary of the single character image is obtained by comparing the first projection size of each row of pixels above the center position of the single character image with the first threshold, and the lower boundary of the single character image is obtained by comparing the second projection size of each row of pixels below the center position of the single character image with the first threshold. In this way, the first threshold is set according to the width of each single character itself, which can improve the accuracy of the upper and lower boundaries.

[0048] In some possible implementations, step 303 may also include: determining the center position of the single-character image, and determining a second threshold based on the height of the single-character image and a first preset coefficient; traversing the third projection size of each column of pixels from the center position to the left in the single-character image, and traversing the fourth projection size of each column of pixels from the center position to the right; determining the left and right boundaries of the single-character image by comparing the traversed third projection size, fourth projection size and the second threshold.

[0049] In this embodiment, the third projection size and the fourth projection size are both vertical projection sizes. The second threshold is determined according to the height of the single character image and the first preset coefficient, and then the left boundary of the single character image is obtained by comparing the third projection size of each column of pixels to the left of the center position of the single character image with the second threshold, and the right boundary of the single character image is obtained by comparing the fourth projection size of each column of pixels to the right of the center position of the single character image with the second threshold. In this way, the second threshold is set according to the height of each single character itself, which can improve the accuracy of the left and right boundaries.

[0050] In some possible implementations, the above-mentioned determination of the upper boundary and the lower boundary of the single character image by comparing the traversed first projection size, the second projection size and the first threshold may specifically include:

[0051] Wherein, if the first projection size of the Nth row of pixels traversed upward from the center position exceeds the first threshold, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold, then the upper boundary of the single character image is determined according to the Nth row of pixels; and / or,

[0052] Among them, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold, the lower boundary of the single character image is determined based on the Mth row of pixels.

[0053] In this embodiment, for example, the first preset coefficient is T1=0.5, and the width W of a single character is, if the first projection size of the Nth row of pixels traversed upward from the center position is greater than the first threshold T1*W, and the first projection size of the N+1th row of pixels traversed upward is less than or equal to the first threshold T1*W, it is determined that if the Nth row of pixels traversed upward from the center position is the upper boundary of the single character image, a similar method is used to determine the lower boundary of the single character image.

[0054] In some possible implementations, the above-mentioned determining the left boundary and the right boundary of the single character image by comparing the traversed third projection size, the fourth projection size and the second threshold value includes:

[0055] Wherein, if the third projection size of the P-th column pixel traversed to the left from the center position exceeds the second threshold, and the third projection size of the P+1-th column pixel traversed to the left from the center position does not exceed the second threshold, the left boundary of the single character image is determined according to the P-th column pixel; and / or,

[0056] Among them, if the fourth projection size of the Qth column pixels traversed to the right from the center position exceeds the second threshold, and the fourth projection size of the Q+1th column pixels traversed to the right from the center position does not exceed the second threshold, the right boundary of the single character image is determined based on the Qth column pixels.

[0057] In this embodiment, for example, the second preset coefficient is T2=0.5, and the height of a single character is H. If the third projection size of the Pth column pixel traversed from the center position to the left is greater than the second threshold T2*H, and the third projection size of the P+1th column pixel traversed to the left is less than or equal to the first threshold T2*H, the Pth column pixel traversed from the center position to the left is determined as the left boundary of the single character image, and the right boundary of the single character image is determined by a similar method.

[0058] In addition, if Figure 2 , the first character on the far left has a problem of being biased to the right, and the last character on the far right has a problem of being biased to the left, which will also reduce the recognition success rate.

[0059] In some possible implementations, in order to solve the problem of the above-mentioned characters being biased to the left or right, after step 304, the method also includes: determining the center position of the single-character image, and determining a third threshold based on the height of the single-character image and a third preset coefficient; wherein the third threshold is used to determine the boundary of the character rather than the boundary of the single-character image, and the third preset coefficient may be greater than the second preset coefficient. For example, in this embodiment, the third preset coefficient may be T3=0.95, and the third threshold may be 0.95H. In a single character image, the vertical projection size of each column of pixels traversed from the center position to the left, and the vertical projection size of each column of pixels traversed from the center position to the right; wherein, if the vertical projection size of the Xth column of pixels traversed from the center position to the left does not exceed 0.95H, and the vertical projection size of the X+1th column of pixels traversed from the center position to the left exceeds 0.95H, then the character left boundary of the single character image is determined according to the Xth column of pixels; and / or, if the vertical projection size of the Yth column of pixels traversed from the center position to the right does not exceed 0.95H, and the vertical projection size of the Y+1th column of pixels traversed from the center position to the right exceeds 0.95H, then the character right boundary of the single character image is determined according to the Yth column of pixels; and, the background area of ​​the target single character image is divided equally from left to right according to the character left boundary and character right boundary of the single character image. Figure 5a and Figure 5b As shown, wherein, the above steps determine Figure 4a After the left and right boundaries of the character "0" in the single character image, Figure 5a The background area on the left side of the character and the background area on the right side of the character are divided equally, and we get Figure 5b The single character image in the image is thus more likely to be located in the center of the entire background, making the character recognition result more accurate.

[0060] Figure 6 FIG. 3 is a schematic diagram of a character segmentation device according to an embodiment of the present application, which is used to execute the segmentation method shown in FIG. 3 , and the device includes:

[0061] A first segmentation unit 601 is used to obtain a multi-character image, perform binarization processing and first character segmentation on the multi-character image, and obtain multiple single-character images;

[0062] The upper and lower boundary unit 602 is used to determine the upper boundary and the lower boundary of the single character image according to the horizontal projection size of each row of pixels of the single character image and the first preset coefficient;

[0063] The left and right boundary unit 603 is used to determine the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and the second preset coefficient;

[0064] The second segmentation unit 604 is used to perform second character segmentation on the multi-character image according to the upper boundary, lower boundary, left boundary and right boundary of the single character image to obtain multiple target single character images.

[0065] In a possible implementation, the upper and lower boundary units are also used to: determine the center position of a single character image, and determine a first threshold based on the width of the single character image and a first preset coefficient; traverse the first projection size of each row of pixels upward from the center position in the single character image, and traverse the second projection size of each row of pixels downward from the center position; and determine the upper and lower boundaries of the single character image by comparing the traversed first projection size, the second projection size and the first threshold.

[0066] In one possible embodiment, the upper and lower boundary units are also used for: wherein, if the first projection size of the Nth row of pixels traversed upward from the center position exceeds the first threshold, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold, then the upper boundary of the single character image is determined according to the Nth row of pixels; and / or, wherein, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold, then the lower boundary of the single character image is determined according to the Mth row of pixels.

[0067] In a possible implementation, the left and right boundary units are also used to: determine the center position of the single-character image, and determine the second threshold based on the height of the single-character image and a second preset coefficient; traverse the third projection size of each column of pixels from the center position to the left in the single-character image, and traverse the fourth projection size of each column of pixels from the center position to the right; and determine the left and right boundaries of the single-character image by comparing the traversed third projection size, fourth projection size and the second threshold.

[0068] In one possible embodiment, the left and right boundary units are also used for: wherein, if the third projection size of the P-th column pixels traversed from the center position to the left exceeds the second threshold, and the third projection size of the P+1-th column pixels traversed from the center position to the left does not exceed the second threshold, then the left boundary of the single character image is determined based on the P-th column pixels; and / or, wherein, if the fourth projection size of the Q-th column pixels traversed from the center position to the right exceeds the second threshold, and the fourth projection size of the Q+1-th column pixels traversed from the center position to the right does not exceed the second threshold, then the right boundary of the single character image is determined based on the Q-th column pixels.

[0069] In a possible embodiment, the device also includes a left-right bisection unit, which is used to: determine the center position of the single-character image, and determine a third threshold value based on the height of the single-character image and a third preset coefficient; traverse the vertical projection size of each column of pixels from the center position to the left, and traverse the vertical projection size of each column of pixels from the center position to the right in the single-character image; wherein, if the vertical projection size of the Xth column of pixels traversed from the center position to the left does not exceed the third threshold value, and the vertical projection size of the X+1th column of pixels traversed from the center position to the left exceeds the third threshold value, then determine the character left boundary of the single-character image based on the Xth column of pixels; and / or, wherein, if the vertical projection size of the Yth column of pixels traversed from the center position to the right does not exceed the third threshold value, and the vertical projection size of the Y+1th column of pixels traversed from the center position to the right exceeds the second threshold value, then determine the character right boundary of the single-character image based on the Yth column of pixels; and, divide the background area of ​​the target single-character image into left-right bisections according to the character left boundary and character right boundary of the single-character image.

[0070] Figure 7 A schematic diagram of a character segmentation device according to an embodiment of the present application, which is used to execute the segmentation method shown in Figure 3, and the device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute: obtaining a multi-character image, performing binarization processing and a first character segmentation on the multi-character image to obtain a plurality of single-character images; determining the upper and lower boundaries of the single-character image according to the horizontal projection size of each row of pixels of the single-character image and a first preset coefficient; determining the left and right boundaries of the single-character image according to the vertical projection size of each column of pixels of the single-character image and a second preset coefficient; performing a second character segmentation on the multi-character image according to the upper, lower, left and right boundaries of the single-character image to obtain a plurality of target single-character images.

[0071] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a program, and when the program is executed by a multi-core processor, the multi-core processor executes any method as in the first aspect.

[0072] At least one of the above-mentioned technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the present invention performs character segmentation preprocessing on the test set data, removes redundant color blocks in the character image to be recognized, improves the character segmentation effect, makes the test set and the training set have similar distribution, and thereby improves the recognition accuracy of the characters.

[0073] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, their descriptions are simplified, and the relevant parts can be referred to the partial description of the method embodiments.

[0074] The apparatus, device and computer-readable storage medium provided in the embodiments of the present application correspond one-to-one to the method. Therefore, the apparatus, device and computer-readable storage medium also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the apparatus, device and computer-readable storage medium will not be repeated here.

[0075] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0076] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0077] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0078] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0079] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0080] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0081] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. In addition, although the operations of the method of the present invention are described in a particular order in the accompanying drawings, this does not require or imply that these operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.

[0082] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.

Claims

1. A character segmentation method, characterized in that: include: Acquire a multi-character image, perform binarization processing and first character segmentation on the multi-character image, and obtain a plurality of single-character images; The upper and lower boundaries of the single character image are determined according to the horizontal projection size of each row of pixels of the single character image and a first preset coefficient; wherein, if the first projection size of the Nth row of pixels traversed upward from the center position of the single character image exceeds a first threshold value, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold value, the upper boundary of the single character image is determined according to the Nth row of pixels; and / or, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold value, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold value, the lower boundary of the single character image is determined according to the Mth row of pixels; the first threshold value is determined according to the width of the single character image and the first preset coefficient; Determining the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and a second preset coefficient; The multi-character image is subjected to a second character segmentation according to the upper boundary, the lower boundary, the left boundary and the right boundary of the single-character image to obtain a plurality of target single-character images.

2. The character segmentation method according to claim 1, characterized in that: The method further comprises: determining the upper boundary and the lower boundary of the single character image according to the horizontal projection size of each row of pixels of the single character image and a first preset coefficient; Determine the center position of the single character image, and determine a first threshold value according to the width of the single character image and the first preset coefficient; A first projection size of each row of pixels traversed upward from the center position in the single character image, and a second projection size of each row of pixels traversed downward from the center position; The upper boundary and the lower boundary of the single-character image are determined by comparing the traversed first projection size, the second projection size and the first threshold.

3. The character segmentation method according to claim 1, characterized in that: Determining the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and a second preset coefficient includes: Determine the center position of the single character image, and determine a second threshold value according to the height of the single character image and the second preset coefficient; A third projection size of each column of pixels traversed from the center position to the left in the single character image, and a fourth projection size of each column of pixels traversed from the center position to the right; The left boundary and the right boundary of the single character image are determined by comparing the traversed third projection size, the fourth projection size and the second threshold.

4. The character segmentation method according to claim 3, characterized in that: By comparing the traversed third projection size, the fourth projection size and the second threshold, the left boundary and the right boundary of the single character image are determined, include: Wherein, if the third projection size of the P-th column pixels traversed to the left from the center position exceeds the second threshold, and the third projection size of the P+1-th column pixels traversed to the left from the center position does not exceed the second threshold, then the left boundary of the single character image is determined according to the P-th column pixels; and / or, Among them, if the fourth projection size of the Qth column pixels traversed to the right from the center position exceeds the second threshold, and the fourth projection size of the Q+1th column pixels traversed to the right from the center position does not exceed the second threshold, the right boundary of the single character image is determined based on the Qth column pixels.

5. The character segmentation method according to claim 1, wherein: The method further comprises: Determine the center position of the single character image, and determine a third threshold value according to the height of the single character image and a third preset coefficient; The vertical projection size of each column of pixels traversed from the center position to the left, and the vertical projection size of each column of pixels traversed from the center position to the right in the single character image; Wherein, if the vertical projection size of the Xth column of pixels traversed to the left from the center position does not exceed the third threshold, and the vertical projection size of the X+1th column of pixels traversed to the left from the center position exceeds the third threshold, the left boundary of the character of the single character image is determined according to the Xth column of pixels; and / or, Wherein, if the vertical projection size of the Yth column of pixels traversed to the right from the center position does not exceed the third threshold, and the vertical projection size of the Y+1th column of pixels traversed to the right from the center position exceeds the third threshold, the right boundary of the character of the single character image is determined according to the Yth column of pixels; and, The background area of ​​the target single-character image is divided equally into left and right parts according to the character left boundary and the character right boundary of the single-character image.

6. A character segmentation device, characterized in that: include: A first segmentation unit is used to obtain a multi-character image, perform binarization processing and first character segmentation on the multi-character image, and obtain a plurality of single-character images; An upper and lower boundary unit, used to determine the upper boundary and lower boundary of the single character image according to the horizontal projection size of each row of pixels of the single character image and a first preset coefficient; wherein, if the first projection size of the Nth row of pixels traversed upward from the center position of the single character image exceeds a first threshold value, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold value, then the upper boundary of the single character image is determined according to the Nth row of pixels; and / or, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold value, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold value, then the lower boundary of the single character image is determined according to the Mth row of pixels; the first threshold value is determined according to the width of the single character image and the first preset coefficient; A left and right boundary unit, used for determining the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and a second preset coefficient; The second segmentation unit is used to perform second character segmentation on the multi-character image according to the upper boundary, the lower boundary, the left boundary and the right boundary of the single-character image to obtain multiple target single-character images.

7. The character segmentation device according to claim 6, characterized in that: The upper and lower boundary units are also used for: Determine the center position of the single character image, and determine a first threshold value according to the width of the single character image and the first preset coefficient; A first projection size of each row of pixels traversed upward from the center position in the single character image, and a second projection size of each row of pixels traversed downward from the center position; The upper boundary and the lower boundary of the single-character image are determined by comparing the traversed first projection size, the second projection size and the first threshold.

8. The character segmentation device according to claim 6, characterized in that: The left and right boundary units are also used for: Determine the center position of the single character image, and determine a second threshold value according to the height of the single character image and the second preset coefficient; A third projection size of each column of pixels traversed from the center position to the left in the single character image, and a fourth projection size of each column of pixels traversed from the center position to the right; The left boundary and the right boundary of the single character image are determined by comparing the traversed third projection size, the fourth projection size and the second threshold.

9. The character segmentation device according to claim 8, characterized in that: The left and right boundary units are also used for: Wherein, if the third projection size of the P-th column pixels traversed to the left from the center position exceeds the second threshold, and the third projection size of the P+1-th column pixels traversed to the left from the center position does not exceed the second threshold, then the left boundary of the single character image is determined according to the P-th column pixels; and / or, Among them, if the fourth projection size of the Qth column pixels traversed to the right from the center position exceeds the second threshold, and the fourth projection size of the Q+1th column pixels traversed to the right from the center position does not exceed the second threshold, the right boundary of the single character image is determined based on the Qth column pixels.

10. The character segmentation device according to claim 6, characterized in that: The device also includes a left and right bisection unit, which is used for: Determine the center position of the single character image, and determine a third threshold value according to the height of the single character image and a third preset coefficient; The vertical projection size of each column of pixels traversed from the center position to the left, and the vertical projection size of each column of pixels traversed from the center position to the right in the single character image; Wherein, if the vertical projection size of the Xth column of pixels traversed to the left from the center position does not exceed the third threshold, and the vertical projection size of the X+1th column of pixels traversed to the left from the center position exceeds the third threshold, the left boundary of the character of the single character image is determined according to the Xth column of pixels; and / or, Wherein, if the vertical projection size of the Yth column of pixels traversed to the right from the center position does not exceed the third threshold, and the vertical projection size of the Y+1th column of pixels traversed to the right from the center position exceeds the third threshold, the right boundary of the character of the single character image is determined according to the Yth column of pixels; and, The background area of ​​the target single-character image is divided equally into left and right parts according to the character left boundary and the character right boundary of the single-character image.

11. A character segmentation device, characterized in that: include: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform: acquiring a multi-character image, performing binarization processing and first character segmentation on the multi-character image, and obtaining a plurality of single-character images; The upper and lower boundaries of the single character image are determined according to the horizontal projection size of each row of pixels of the single character image and a first preset coefficient; wherein, if the first projection size of the Nth row of pixels traversed upward from the center position of the single character image exceeds a first threshold value, and the first projection size of the N+1th row of pixels traversed upward from the center position does not exceed the first threshold value, the upper boundary of the single character image is determined according to the Nth row of pixels; and / or, if the first projection size of the Mth row of pixels traversed downward from the center position exceeds the first threshold value, and the first projection size of the M+1th row of pixels traversed downward from the center position does not exceed the first threshold value, the lower boundary of the single character image is determined according to the Mth row of pixels; the first threshold value is determined according to the width of the single character image and the first preset coefficient; Determining the left boundary and the right boundary of the single character image according to the vertical projection size of each column of pixels of the single character image and a second preset coefficient; The multi-character image is subjected to a second character segmentation according to the upper boundary, the lower boundary, the left boundary and the right boundary of the single-character image to obtain a plurality of target single-character images.

12. A computer-readable storage medium storing a program, wherein when the program is executed by a multi-core processor, the multi-core processor executes the method according to any one of claims 1 to 5.