Character cutting method, device, electronic device and storage medium

By determining the connection string, intercept, chunking and column projection in the character cutting method, the problem of incomplete cutting caused by unequal width in the prior art is solved, and more accurate and efficient character cutting is achieved.

CN114155373BActive Publication Date: 2024-11-29SHENZHEN YIHUA COMP +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111478598.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-06
Publication Date
2024-11-29
Estimated Expiration
2041-12-06

AI Technical Summary

Technical Problem

Existing character cutting methods are difficult to achieve accurate cutting when dealing with concatenated strings, especially due to the inequality of character inequality caused by printing equipment, resulting in incomplete cutting or incorrect cutting.

Method used

By determining the connection string in the image to be identified, the area with a set width is intercepted, the area with a set width is divided and column projected, the cutting line is determined based on the projection results, the characters that do not need to be cut are filtered, and the optimal cutting position is determined.

Benefits of technology

Improves the accuracy and rate of character cutting, ensuring complete cutting of the concatenated string.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114155373B_ABST
    Figure CN114155373B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a method, device, electronic device and storage medium for character cutting. The method comprises: determining a connection string in an image to be identified; intercepting an area of ​​a set width from an image area corresponding to the connection string to obtain an image of the character string to be cut; dividing the image of the character string to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to each block image; determining a cutting line of the image of the character string to be cut according to each projection result, so as to cut the image of the character string to be cut according to the cutting line. By using the above method, by determining the connection string, single characters that do not need to be cut can be screened out, thereby improving the character cutting rate; and by intercepting, dividing, and column projecting the connection string, the optimal cutting position and the corresponding cutting line can be further determined, thereby improving the accuracy of the connection string cutting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of image recognition technology, and in particular to a character cutting method, device, electronic device and storage medium. Background Art

[0002] Character cutting refers to cutting each character in a concatenated string to obtain the corresponding single character. Character cutting is used in various aspects of life and production, such as the recognition of printed bill content in bill business or the identification of ID number in ID photo printout. In this process, the printed characters may be connected due to the performance of the printing device and other issues. To identify these connected strings, corresponding character cutting is required.

[0003] At present, character cutting usually adopts the equal-width cutting method to cut the entire connection string into equal parts. For example, if the connection string has 10 characters and the width of the connection string size is known, the string can be cut into 10 parts on average, and each part can be considered as one character. However, the equal-width cutting method will cause many problems in practice. For example, the character sizes in the existing connection strings are not necessarily equal-width. Even if the average width or other widths obtained based on statistics are used for equal-width cutting, it is difficult to accurately cut the connection string, and some characters may be incompletely cut. For example, the character cutting method in patent document CN105069456A only processes the connection string through the projection method, which may cause the problem of incorrect character cutting. For example, the patent document CN108491845A proposes a method for determining a character segmentation position and a character segmentation method, which first determines multiple target segmentation positions in a contiguous substring, and then determines the final segmentation position of the contiguous substring from the multiple target segmentation positions based on the attribute information of the contiguous area between characters; however, in this method, if the determined target segmentation position is inaccurate, it may affect the subsequent final segmentation position, which may lead to inaccurate segmentation of the contiguous substring.

[0004] Therefore, how to accurately cut the connection string is a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present invention provide a character cutting method, device, electronic device and storage medium to improve the accuracy of cutting a connection string.

[0006] In a first aspect, an embodiment of the present invention provides a character cutting method, comprising:

[0007] Determine the connection string in the image to be recognized;

[0008] Cutting out an area of ​​a set width from the image area corresponding to the connected character string to obtain an image of the character string to be cut;

[0009] Divide the character string image to be cut into blocks, and perform column projection on the obtained block images to obtain projection results corresponding to each of the block images;

[0010] A cutting line of the character string image to be cut is determined according to each of the projection results, so as to cut the character string image to be cut according to the cutting line.

[0011] In a second aspect, an embodiment of the present invention further provides a character cutting device, comprising:

[0012] A determination module, used for determining a connection string in an image to be identified;

[0013] A cutting module, used for cutting an area of ​​a set width from the image area corresponding to the connection string to obtain an image of the string to be cut;

[0014] A projection module, used for dividing the character string image to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to each of the block images;

[0015] A cutting module is used to determine a cutting line of the character string image to be cut according to each of the projection results, so as to cut the character string image to be cut according to the cutting line.

[0016] In a third aspect, an embodiment of the present invention further provides an electronic device, including:

[0017] one or more processors;

[0018] A storage device for storing one or more programs;

[0019] When the one or more programs are executed by the one or more processors, the one or more processors implement the character cutting method provided by the embodiment of the present invention.

[0020] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the character cutting method provided by the embodiment of the present invention is implemented.

[0021] The embodiment of the present invention provides a character cutting method, device, electronic device and storage medium, which first determines the connection string in the image to be recognized; then cuts off an area of ​​a set width from the image area corresponding to the connection string to obtain the image of the character string to be cut; then divides the image of the character string to be cut into blocks, and performs column projection on the obtained block images to obtain the projection results corresponding to each block image; finally, determines the cutting line of the image of the character string to be cut according to each projection result, so as to cut the image of the character string to be cut according to the cutting line. Using the above method, by determining the connection string, single characters that do not need to be cut can be screened out, thereby improving the character cutting rate; and by performing processing such as cutting, block division and column projection on the connection string, the optimal cutting position and the corresponding cutting line can be further determined, thereby improving the accuracy of cutting the connection string. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A schematic diagram of implementing a character string cutting method based on character equal width cutting provided by the present invention;

[0023] Figure 2 A flowchart of a character cutting method provided in Embodiment 1 of the present invention;

[0024] Figure 3 A schematic diagram of implementing a preprocessing method provided in the first embodiment of the present invention;

[0025] Figure 4 A schematic diagram of an implementation of obtaining the circumscribed contour of a binary image based on a contour search method provided in the first embodiment of the present invention;

[0026] Figure 5 A schematic diagram of implementing a method of intercepting a connection string provided in the first embodiment of the present invention;

[0027] Figure 6 A schematic diagram of implementing the segmentation of a character string image to be cut provided in the first embodiment of the present invention;

[0028] Figure 7 A flowchart of a character cutting method provided in Embodiment 2 of the present invention;

[0029] Figure 8 A schematic diagram of implementing a method of sequentially intercepting connection character strings according to a starting line provided in the second embodiment of the present invention;

[0030] Fig. 9 A schematic diagram of implementing connection string cutting based on a character cutting method provided in Embodiment 2 of the present invention;

[0031] Fig.10 A structural schematic diagram of a character cutting device provided in Embodiment 3 of the present invention;

[0032] Fig.11 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0033] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0034] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the embodiments in the present invention and the features in the embodiments can be combined with each other without conflict.

[0035] The term “including” and its variations used in the present invention are open inclusions, that is, “including but not limited to.” The term “based on” means “based at least in part on.” The term “one embodiment” means “at least one embodiment.”

[0036] It should be noted that the concepts such as "first" and "second" mentioned in the present invention are only used to distinguish the corresponding contents, and are not used to limit the order or interdependence.

[0037] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0038] The character segmentation of connected strings is the key and difficulty of character string recognition based on single characters. There is a need to recognize strings in various bills or ID photos, and the characters in the printed strings may be connected due to the printing device. Usually, the recognition process of the string needs to be segmented, and the recognition is performed after the segmentation into single characters, and the quality of the segmentation will directly affect the final recognition effect.

[0039] A commonly used method is the character equal-width segmentation method, that is, the entire character string is cut into equal parts under the premise of known character size. However, when using the character equal-width segmentation method to segment a character string, some characters will always be incompletely segmented. In addition, due to the printing equipment, the ink density of the printed font is also different. Some characters will be printed thicker, and some characters will be printed lighter, which may also cause each width to be different. Even if the average width and other widths obtained based on statistical methods are used for character equal-width segmentation, it is difficult to accurately segment the characters. Figure 1 The present invention provides a method for cutting a character string based on the character width. Figure 1 As shown, each vertical line in the figure can represent a cutting line obtained by using the character equal width cutting method, and a single character is cut out according to the cutting line; in the connection string, the first few characters are cut better, and the following characters are not cut accurately, such as the cutting line only cuts part of the single character. Therefore, the present application proposes a character cutting method that can achieve accurate cutting of a single character in a connection string.

[0040] Embodiment 1

[0041] Figure 2 A flow chart of a character cutting method provided in Embodiment 1 of the present invention is applicable to the case of cutting a connection string. The method can be executed by a character cutting device, wherein the device can be implemented by software and / or hardware and is generally integrated on an electronic device. In this embodiment, the electronic device includes but is not limited to: a desktop computer, a laptop computer, and a server.

[0042] like Figure 2 As shown, a character cutting method provided by Embodiment 1 of the present invention comprises the following steps:

[0043] S110: Determine a connection string in the image to be recognized.

[0044] In this embodiment, the image to be recognized may refer to an image containing characters to be recognized, such as a printed image of a bank deposit slip in a bill business, an ID photo image, etc.; the characters to be recognized may be numbers, letters or symbols to be recognized, such as the account number of a bank deposit slip, the ID number of an ID photo, etc., and each character in the account number or ID number may be considered as a single character.

[0045] A concatenated string may refer to a string of characters consisting of multiple mutually contiguous single characters, and a concatenated string may include at least two single characters. For example, in a printed image of a bank deposit slip, due to reasons such as the printing device, multiple numbers in an account number are contiguous, and the multiple contiguous numbers may be considered as a concatenated string.

[0046] In this step, a single character and a concatenated string can be distinguished according to the character width in the image to be recognized. A single character can be considered as a character that is not connected to other characters. For example, if the width of the concatenated string is greater than the width of the single character, the concatenated string can be determined according to the determined character width.

[0047] Optionally, determining the connection string in the image to be recognized includes: preprocessing the image to be recognized to obtain a binary image corresponding to the image to be recognized; and determining the connection string according to the width of the circumscribed contour of the characters in the binary image.

[0048] Among them, preprocessing can refer to the image processing performed in advance on the image to be recognized. Specifically, the preprocessing process can be: first, locate and intercept the character area in the image to be recognized to obtain the corresponding target image, wherein the target image can refer to the image of the area where the intercepted characters are located; then, in order to retain and strengthen the edges of the characters, a 3*3 convolution kernel can be used to sharpen the target image to obtain a sharpened image, wherein the convolution kernel parameters can be (0,-1,0,-1,5,-1,0,-1,0); then, grayscale the sharpened image to obtain a grayscale image; finally, binarize the grayscale image to obtain a corresponding binary image.

[0049] Figure 3 This is a schematic diagram of implementing a preprocessing method provided in the first embodiment of the present invention. Figure 3 As shown, Figure 3 (a) can represent the target image; Figure 3 (b) can represent a sharpened image; 3(c) can represent a grayscale image; 3(d) can represent a binary image.

[0050] The circumscribed contour may refer to the circumscribed rectangular contour of a character in a binary image. For example, the circumscribed contour of a character in a binary image may be obtained by a contour finding method. The character may include a single character and a connected string. The contour finding method may refer to a method for finding the contour of an object based on image edge extraction. On this basis, the single character and the connected string may be determined according to the width of the circumscribed contour of the character in the binary image.

[0051] Optionally, the binary image includes the circumscribed contours of a single character and the circumscribed contours of non-single characters; and determining a connection string based on the width of the circumscribed contours of the characters in the binary image, including: determining a minimum width of the circumscribed contours of the characters in the binary image; and determining the non-single characters corresponding to the circumscribed contours whose widths are greater than a set multiple of the minimum width as the connection string.

[0052] Wherein, non-single characters may refer to other characters except single characters. In the case where the binary image contains single characters and non-single characters, the binary image obtained by the contour search method may include the outer contour of the single character and the outer contour of the non-single character.

[0053] The minimum width may refer to the value with the smallest width among all the external contours obtained. It is understandable that the minimum width may be considered as the value with the smallest width among the external contours of all single characters. The set multiple may refer to a pre-set multiple value, for example, the set multiple may be 1.8 times, and the set multiple is not limited here, and may be flexibly set according to the characteristics of the character and the actual situation.

[0054] Exemplarily, in this step, the non-single character corresponding to the circumscribed contour whose width is greater than 1.8 times the minimum width may be determined as a connection string.

[0055] Figure 4 The following is a schematic diagram of obtaining the external contour of a binary image based on a contour search method provided in the first embodiment of the present invention. Figure 4 As shown, the circumscribed contours corresponding to "54" and "8965" in the binary image are obviously larger than the set multiple of the circumscribed contours of a single character, and can be determined as a connected string, which requires further cutting; in the binary image, except for "54" and "8965", the remaining characters can all be single characters and can be recognized without further cutting.

[0056] It should be noted that, if a binary image contains multiple characters, and there is only one circumscribed contour obtained by the contour search method, it can be said that there is no single character in the binary image, and the characters in the entire binary image are a connected string.

[0057] S120 , cutting out an area of ​​a set width from the image area corresponding to the connected character string to obtain an image of the character string to be cut.

[0058] In this embodiment, interception may refer to cutting out a part from a whole. The set width may refer to a preset width value. For example, if the binary image includes the outer contour of a single character and the outer contour of a non-single character, the set width may be 1.8 times the average width of the outer contours of all single characters; wherein the average width of the outer contours of all single characters may be referred to as the first average width. If the binary image containing multiple characters includes an outer contour (the number of characters is known), the set width may be 1.8 times the mean value obtained by dividing the width of the outer contour by the number of characters; wherein the mean value obtained by dividing the width of the outer contour by the number of characters in this case may be referred to as the second average width. Here, 1.8 times may be considered as a variable parameter, which may be flexibly set according to the characteristics of the characters and actual conditions.

[0059] The image of the character string to be cut may refer to the image area occupied by the cut character string to be cut.

[0060] It is understandable that, in order to facilitate character cutting, for a longer connected string (i.e., a connected string with a wider circumscribed contour), which may include multiple single characters stuck together, the longer connected string may be divided into multiple sub-parts for cutting. For example, an area of ​​a set width may be cut from the image area corresponding to the connected string in the binary image, and the cut image area is used as the string image to be cut. Generally, the string image to be cut obtained by cutting with a set width may include two single characters stuck together.

[0061] It should be noted that for a long connection string, multiple interceptions may be required. When intercepting for the first time, the left boundary of the image area corresponding to the connection string can be used as the starting line for interception; in each subsequent interception process, from the image area corresponding to the connection string, the cutting line corresponding to the image of the string to be cut that was intercepted last time can be used as the starting line for interception, until the image area corresponding to the connection string is completely intercepted.

[0062] Optionally, intercepting an area of ​​a set width from the image area corresponding to the connection string to obtain the image of the string to be cut includes: intercepting an area of ​​a set width from the image area corresponding to the connection string, taking the left boundary of the image of the string to be cut as a starting line, or taking the cutting line corresponding to the image of the string to be cut intercepted last time as a starting line, to obtain the image of the string to be cut.

[0063] In the first interception, the left boundary of the string image to be cut is the left boundary of the image area corresponding to the entire connected string, and the left boundary of the string image to be cut can be used as the starting line. In each subsequent interception process, the cutting line corresponding to the last intercepted string image to be cut can be used as the starting line to intercept the area of ​​the set width to obtain the string image to be cut.

[0064] Figure 5 This is a schematic diagram of implementing a method of intercepting a connection string provided in the first embodiment of the present invention. Figure 5 As shown, the left boundary of the image area corresponding to the connection character string "8965" is used as the starting line, and the "89" in the connection character string "8965" is cut out with a set width.

[0065] S130 , dividing the to-be-cut character string image into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to the block images.

[0066] In this embodiment, the block division may refer to dividing the character string image to be cut into a plurality of small blocks, for example, the block division may be performed from the upper boundary to the lower boundary of the character string image to be cut according to a certain ratio. The block images may refer to the sub-images obtained by dividing the character string image to be cut. The block images obtained by dividing the character string image to be cut may include two or more.

[0067] Optionally, dividing the image of the character string to be cut into blocks includes: dividing the image of the character string to be cut into at least two block images according to a set ratio in a character cutting direction.

[0068] The character cutting direction may refer to the vertical direction from the upper boundary to the lower boundary of the character string image to be cut. The set ratio may refer to the pre-set block ratio, which is not limited here, for example, the set ratio may be 2 / 3, 1 / 2, etc.

[0069] Figure 6 A schematic diagram of implementing the segmentation of a character string image to be cut is provided in the first embodiment of the present invention. Figure 6 As shown, the set ratios are 2 / 3, 1 / 2 and 2 / 3 respectively, and the image is divided into blocks in the character cutting direction (ie, from top to bottom) according to the set ratios to obtain three corresponding block images.

[0070] Column projection may refer to the vertical projection of a block image. Column projection may be used to obtain all pixels of the block image in the vertical direction, including white pixels and black pixels. It is understandable that, in the block image, white pixels may represent pixels corresponding to characters, and black pixels may represent pixels corresponding to a black background. Each column in the vertical direction of the block image corresponds to a column of pixels, and on this basis, according to all pixels, the position corresponding to the column with the least white pixels may be used as the corresponding projection result.

[0071] Optionally, the obtained block images are subjected to column projection to obtain projection results corresponding to each block image, including: for each block image, the block image is subjected to column projection to obtain the column white point distribution of the block image; within a first scanning range of the block image, the column white point distribution is scanned according to a first preset direction to determine the position of the column with the least number of column white points as the first cutting position; within a second scanning range of the block image, the column white point distribution is scanned according to a second preset direction to determine the position of the column with the least number of column white points as the second cutting position; wherein the projection results corresponding to each block image include the first cutting position and the second cutting position corresponding to the block image.

[0072] The column white point distribution may refer to the number distribution of white pixels in each column of the block image in the vertical direction after column projection. The white point may refer to a white pixel. The number of column white points may refer to the number of white pixels in each column.

[0073] In the case where the binary image includes the circumscribed contour of a single character and the circumscribed contour of a non-single character, the first scanning range may refer to the scanning range determined by taking the position corresponding to 0.6 times the first average width and the position corresponding to 1.8 times the first average width as the boundary in the block image. In the case where the binary image containing multiple characters includes an circumscribed contour (the number of characters is known), the first scanning range may refer to the scanning range determined by taking the position corresponding to 0.6 times the second average width and the position corresponding to 1.8 times the second average width as the boundary in the block image.

[0074] The first preset direction may refer to the direction corresponding to the left side to the right side of the block image. On this basis, within the first scanning range of the block image, the column white point distribution is scanned according to the first preset direction, and the position of the column with the least number of column white points is determined as the first cutting position.

[0075] The second scanning range may refer to the entire block image range. The second preset direction may refer to the direction corresponding to the right side to the left side of the block image. On this basis, within the second scanning range of the block image, the column white point distribution is scanned according to the second preset direction, and the position of the column with the least number of column white points is determined as the second cutting position.

[0076] One block image corresponds to a set of first cutting positions and second cutting positions, that is, the projection result corresponding to each block image includes the first cutting position and the second cutting position corresponding to the block image.

[0077] S140 . Determine a cutting line of the character string image to be cut according to each of the projection results, so as to cut the character string image to be cut according to the cutting line.

[0078] In this embodiment, different projection results correspond to different cutting line determination methods.

[0079] Exemplarily, in the projection results corresponding to each block image, if there is a projection result in which the first cutting position and the second cutting position are consistent, then the projection result can be used as a basis for determining the cutting line, that is, the straight line where the first cutting position or the second cutting position of the projection result is located can be used as the cutting line of the character string image to be cut.

[0080] If there are multiple projection results, and the first cutting position and the second cutting position in each of the multiple projection results are consistent, any one of the projection results can be selected as the basis for determining the cutting line; or the first cutting position in each projection result can be averaged, and the second cutting position in each projection result can be averaged, and the two means can be averaged again on this basis, and the straight line corresponding to the position of the mean can be determined as the cutting line.

[0081] If the first cutting position and the second cutting position in each projection result are inconsistent in all the projection results, then similarly, the first cutting position in each projection result can be averaged, and the second cutting position in each projection result can be averaged. On this basis, the two means can be averaged again, and the straight line corresponding to the position of the mean can be determined as the cutting line.

[0082] On the basis of the above embodiment, the character string image to be cut is cut according to the determined cutting line to obtain the cut single characters.

[0083] A character cutting method provided in the first embodiment of the present invention first determines a connection string in an image to be recognized; then cuts off an area of ​​a set width from the image area corresponding to the connection string to obtain an image of the character string to be cut; then divides the image of the character string to be cut into blocks, and performs column projection on the obtained block images to obtain projection results corresponding to each block image; finally, determines the cutting line of the image of the character string to be cut according to each projection result, so as to cut the image of the character string to be cut according to the cutting line. By using the above method, by determining the connection string, single characters that do not need to be cut can be screened out, thereby improving the character cutting rate; and by performing processing such as cutting, block division and column projection on the connection string, the optimal cutting position and corresponding cutting line can be further determined, thereby improving the accuracy of cutting the connection string.

[0084] Based on the above embodiments, the specific process of determining the cutting line of the character string image to be cut according to each projection result is described. It should be noted that, in order to make the description concise, only the differences from the above embodiments are described in the following embodiments.

[0085] Optionally, determining a cutting line of the character string image to be cut according to each projection result includes: determining the number of projection results that meet preset conditions among the projection results corresponding to each block image, wherein the preset conditions include that a first cutting position in the projection result is consistent with a second cutting position; and determining a cutting line of the character string image to be cut according to the number.

[0086] The preset condition may refer to the first cutting position and the second cutting position in the projection result being located at the same position. Determining the cutting line of the character string image to be cut according to the number may indicate that different numbers correspond to different cutting line determination methods.

[0087] Optionally, determining the cutting line of the string image to be cut according to the quantity includes: if the quantity is greater than or equal to 1, taking the first cutting position or the second cutting position in any group of projection results that meet the preset conditions as the cutting line of the string image to be cut; if the quantity is 0, taking the mean of the first cutting positions in the projection results corresponding to each block image as the first mean, taking the mean of the second cutting positions in the projection results corresponding to each block image as the second mean, and taking the position corresponding to the mean of the first mean and the second mean as the cutting line of the string image to be cut.

[0088] If the number is greater than or equal to 1, it indicates that there are one or more projection results that meet the preset conditions. At this time, any one projection result can be selected and the first cutting position or the second cutting position in the projection result is used as the cutting line of the character string image to be cut.

[0089] If the number is 0, it can be indicated that there are 0 projection results that meet the preset conditions. At this time, it is assumed that there are three block images, the projection results of the first block image are iReft1 (indicating the first cutting line position) and iRight1 (indicating the second cutting line position), the projection results of the second block image are iReft2 and iRight2, and the projection results of the third block image are iReft3 and iRight3. On this basis, the mean of the first cutting position in the projection results corresponding to each block image can be used as the first mean iMeanReft, and its calculation formula can be expressed as iMeanReft = (iReft1 + iReft2 + iReft3) / 3, and the mean of the second cutting position in the projection results corresponding to each block image can be used as the second mean iMeanRight, and its calculation formula can be expressed as iMeanRight = (iRight1 + iRight2 + iRight3) / 3; and the position corresponding to the mean of the first mean iMeanReft and the second mean iMeanRight is used as the cutting line of the character string image to be cut.

[0090] Embodiment 2

[0091] Figure 7 A flowchart of a character cutting method provided in Embodiment 2 of the present invention is provided. Embodiment 2 is refined on the basis of the above embodiments. In this embodiment, a process of intercepting a connection string multiple times according to a starting line and determining a cutting line is described in detail. It should be noted that the technical details not described in detail in this embodiment can be referred to any of the above embodiments.

[0092] like Figure 7 As shown, a character cutting method provided by Embodiment 2 of the present invention comprises the following steps:

[0093] S210: Determine a connection string in the image to be recognized.

[0094] In this embodiment, the image to be recognized is preprocessed to obtain a binary image corresponding to the image to be recognized; according to the width of the circumscribed contour of the character in the binary image, the non-single character corresponding to the circumscribed contour whose width is greater than a set multiple of the minimum width of the circumscribed contour is determined as a connected character string.

[0095] S220 , from the image area corresponding to the connected character string, according to the starting line, cut out an area of ​​a set width to obtain an image of the character string to be cut.

[0096] In this embodiment, the first intercepted starting line can be considered as the left boundary line of the image area corresponding to the connection string, and the subsequent intercepted starting line can be considered as the cutting line determined last time.

[0097] S230 , dividing the character string image to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to the block images.

[0098] In this embodiment, according to the character cutting direction, the character string image to be cut is divided into at least two block images according to a set ratio.

[0099] For each block image, the block image is projected in columns to obtain the column white point distribution of the block image; within a first scanning range of the block image, the column white point distribution is scanned according to a first preset direction to determine the position of the column with the least number of column white points as the first cutting position; within a second scanning range of the block image, the column white point distribution is scanned according to a second preset direction to determine the position of the column with the least number of column white points as the second cutting position; wherein the projection result corresponding to each block image includes the first cutting position and the second cutting position corresponding to the block image.

[0100] S240: Determine a cutting line of the character string image to be cut according to each projection result.

[0101] In this embodiment, the number of projection results that meet the preset conditions among the projection results corresponding to each block image is determined, and on this basis, the cutting line of the character string image to be cut is determined according to the number.

[0102] S250 , cutting the character string image to be cut according to the cutting line.

[0103] S260 , determining whether the width between the cutting line and the right border of the image area corresponding to the connection string is greater than a set width, if so, executing S270 , otherwise executing S280 .

[0104] S270 , taking the cutting line as the starting line, returning to S220 , and continuing to intercept the next character string image to be cut.

[0105] S280, interception ends.

[0106] In this embodiment, it is determined whether the width between the cutting line and the right border of the image area corresponding to the connection string is greater than the set width. If it is greater than the set width, it can be indicated that there is still a string image to be cut that can be intercepted within the range between the current cutting line and the right border of the image area corresponding to the connection string. On this basis, the cutting line can be used as the starting line, and S220 is returned to continue intercepting the next string image to be cut, so as to obtain the cutting line of the string image to be cut. If it is less than the set width, it can be indicated that there is no string image to be cut that can be intercepted within the range between the current cutting line and the right border of the image area corresponding to the connection string. At this time, it is indicated that the connection string has been intercepted, that is, the interception is completed. In this process, the obtained cutting line is the accurate cutting line of the entire connection string. The connection string is cut according to the cutting line to obtain the corresponding single character.

[0107] It should be noted that, in this embodiment, the method for determining whether there is a character string to be cut between the cutting line and the right boundary of the image area corresponding to the connection character string is not limited.

[0108] It should be noted that there is no limitation on the execution order of S250 and S260 , and they may be executed simultaneously or separately.

[0109] Figure 8 The following is a schematic diagram of implementing a method of sequentially intercepting connection strings according to the starting line provided in the second embodiment of the present invention. Figure 8 As shown, the first interception uses the left boundary of the image area corresponding to the connection string as the starting line, and the interception obtains "89"; the second interception uses the cutting line of the previous "89" as the starting line, and the interception obtains "96"; the third interception uses the cutting line of the previous "96" as the starting line, and the interception obtains "65", and the interception is completed at this time.

[0110] A character cutting method is provided in a second embodiment of the present invention. The method sequentially intercepts two adjacent characters from the starting position of a connected character string as a character string image to be cut according to a starting line, and determines a corresponding cutting line according to the intercepted character string image to be cut, thereby determining the cutting line of the entire connected character string, which can reduce the amount of calculation for determining the cutting line each time, thereby further improving the speed and accuracy of character cutting.

[0111] Fig. 9 A schematic diagram of implementing connection string cutting based on a character cutting method provided in the second embodiment of the present invention. Fig. 9 As shown, the character cutting method provided by the embodiment of the present invention is used to cut the connected string in the image to be recognized. The left side is the connected string before cutting, and the right side is the effect diagram after cutting the connected string.

[0112] Embodiment 3

[0113] Fig.10 This is a schematic diagram of the structure of a character cutting device provided in Embodiment 3 of the present invention, which can be implemented by software and / or hardware. Fig.10 As shown, it includes: a determination module 310, a capture module 320, a projection module 330 and a cutting module 340;

[0114] The determination module 310 is used to determine the connection string in the image to be identified;

[0115] A cutting module 320, configured to cut an area of ​​a set width from the image area corresponding to the connected string to obtain an image of the string to be cut;

[0116] The projection module 330 is used to divide the character string image to be cut into blocks, and perform column projection on the obtained block images to obtain projection results corresponding to each of the block images;

[0117] The cutting module 340 is used to determine a cutting line of the character string image to be cut according to each of the projection results, so as to cut the character string image to be cut according to the cutting line.

[0118] In this embodiment, the device first determines the connection string in the image to be recognized through the determination module 310; then, through the interception module 320, an area of ​​a set width is intercepted from the image area corresponding to the connection string to obtain the image of the string to be cut; then, through the projection module 330, the image of the string to be cut is divided into blocks, and the obtained block images are column-projected to obtain the projection results corresponding to each block image; finally, through the cutting module 340, the cutting line of the image of the string to be cut is determined according to each projection result, so as to cut the image of the string to be cut according to the cutting line. By using this device, by determining the connection string, single characters that do not need to be cut can be screened out, thereby improving the character cutting rate; and by intercepting, dividing, and column-projecting the connection string, the optimal cutting position and the corresponding cutting line can be further determined, thereby improving the accuracy of the connection string cutting.

[0119] Optionally, the determination module 310 specifically includes:

[0120] A preprocessing unit, used for preprocessing the image to be identified to obtain a binary image corresponding to the image to be identified;

[0121] The connection string determination unit is used to determine the connection string according to the width of the circumscribed contour of the characters in the binary image.

[0122] Optionally, in the device, the binary image includes the circumscribed contour of a single character and the circumscribed contour of a non-single character;

[0123] The connection string determination unit specifically includes:

[0124] A minimum value determination subunit, used to determine the minimum value of the width of the circumscribed contour of the character in the binary image;

[0125] The connection string determination subunit is used to determine the non-single character corresponding to the circumscribed contour whose width is greater than a set multiple of the minimum width as the connection string.

[0126] Optionally, the interception module 320 is specifically used for:

[0127] From the image area corresponding to the connected string, an area of ​​a set width is cut with the left boundary of the string image to be cut as a starting line, or with the cutting line corresponding to the last cut string image to be cut as a starting line, to obtain the string image to be cut.

[0128] Optionally, when the projection module 330 performs the operation of “dividing the image of the character string to be cut into blocks”, the following steps are specifically performed:

[0129] The block division unit is used to divide the character string image to be cut into at least two block images according to a set ratio in a character cutting direction.

[0130] Optionally, when the projection module 330 performs the operation of “performing column projection on the obtained block images to obtain projection results corresponding to each of the block images”, it specifically includes:

[0131] A projection unit, configured to perform column projection on each block image to obtain a column white point distribution of the block image;

[0132] A first determining unit is used to scan the column white point distribution in a first preset direction within a first scanning range of the block image to determine a position of a column with the least number of column white points as a first cutting position;

[0133] A second determining unit is used to scan the column white point distribution in a second preset direction within a second scanning range of the block image to determine a position of a column with the least number of column white points as a second cutting position;

[0134] The projection result corresponding to each block image includes a first cutting position and a second cutting position corresponding to the block image.

[0135] Optionally, the cutting module 340 specifically includes:

[0136] a quantity determination unit, configured to determine the number of projection results that meet a preset condition among the projection results corresponding to the block images, wherein the preset condition includes that the first cutting position in the projection result is consistent with the second cutting position;

[0137] A cutting line determining unit is used to determine a cutting line of the character string image to be cut according to the quantity.

[0138] Optionally, the cutting line determination unit specifically includes:

[0139] A first cutting line determining subunit, configured to use, if the number is greater than or equal to 1, a first cutting position or a second cutting position in any group of projection results that meet a preset condition as a cutting line of the character string image to be cut;

[0140] The second cutting line determination subunit is used to, if the number is 0, take the mean of the first cutting positions in the projection results corresponding to each of the block images as the first mean, take the mean of the second cutting positions in the projection results corresponding to each of the block images as the second mean, and take the position corresponding to the mean of the first mean and the second mean as the cutting line of the character string image to be cut.

[0141] The above-mentioned character cutting device can execute the character cutting method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0142] Embodiment 4

[0143] Fig.11 This is a schematic diagram of the structure of an electronic device provided by Embodiment 4 of the present invention. Fig.11 As shown, the electronic device provided by the fourth embodiment of the present invention includes: one or more processors 41 and a storage device 42; the processor 41 in the electronic device can be one or more, Fig.11 A processor 41 is taken as an example; the storage device 42 is used to store one or more programs; the one or more programs are executed by the one or more processors 41, so that the one or more processors 41 implement the character cutting method as described in any one of the embodiments of the present invention.

[0144] The electronic device may further include: a communication device 43 , an input device 44 and an output device 45 .

[0145] The processor 41, storage device 42, communication device 43, input device 44 and output device 45 in the electronic device may be connected via a bus or other means. Fig.11 The example of connecting through bus is taken in the following.

[0146] The storage device 42 in the electronic device is a computer-readable storage medium, which can be used to store one or more programs, and the program can be a software program, a computer executable program, and a module, such as the program instructions / modules corresponding to the character cutting method provided in the first or second embodiment of the present invention (for example, the attached Fig.10 The modules in the character cutting device shown include: a determination module 310, a capture module 320, a projection module 330 and a cutting module 340). The processor 41 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the storage device 42, that is, the character cutting method in the above method embodiment is implemented.

[0147] The storage device 42 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the business server, etc. In addition, the storage device 42 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 42 may further include a memory remotely arranged relative to the processor 41, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0148] The communication device 43 may include a receiver and a transmitter. The communication device 43 is configured to perform information transmission and reception communication according to the control of the processor 41.

[0149] The input device 44 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 45 may include a display device such as a display screen.

[0150] Furthermore, when one or more programs included in the above-mentioned electronic device are executed by the one or more processors 41, the program performs the following operations: determining a connected string in the image to be recognized; cutting an area of ​​a set width from the image area corresponding to the connected string to obtain an image of the string to be cut; dividing the image of the string to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to each of the block images; determining a cutting line of the image of the string to be cut according to each of the projection results, so as to cut the image of the string to be cut according to the cutting line.

[0151] Embodiment 5

[0152] Embodiment 5 of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, it can be used to execute a character cutting method, the method comprising: determining a connected string in an image to be recognized; cutting an area of ​​a set width from an image area corresponding to the connected string to obtain an image of the string to be cut; dividing the image of the string to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to each of the block images; determining a cutting line of the image of the string to be cut according to each of the projection results, so as to cut the image of the string to be cut according to the cutting line.

[0153] Optionally, when the program is executed by a processor, it can also be used to execute the character cutting method provided by any embodiment of the present invention.

[0154] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination of the above. The computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.

[0155] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0156] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, or radio frequency (RF), etc., or any suitable combination of the above.

[0157] Computer program code for performing the operation of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).

[0158] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A character cutting method, characterized in that: The method comprises: Determine the connection string in the image to be recognized; Cutting out an area of ​​a set width from the image area corresponding to the connected character string to obtain an image of the character string to be cut; Divide the character string image to be cut into blocks, and perform column projection on the obtained block images to obtain projection results corresponding to each of the block images; Determining a cutting line of the character string image to be cut according to each of the projection results, so as to cut the character string image to be cut according to the cutting line; The step of performing column projection on the obtained block images to obtain projection results corresponding to the block images includes: For each block image, the block image is column-projected to obtain the column white point distribution of the block image; Scanning the column white point distribution in a first preset direction within a first scanning range of the block image to determine a position of a column with the least number of column white points as a first cutting position; Scanning the column white dots distribution in a second preset direction within a second scanning range of the block image to determine the position of the column with the least number of column white dots as the second cutting position; The projection result corresponding to each block image includes a first cutting position and a second cutting position corresponding to the block image; Wherein, determining the cutting line of the character string image to be cut according to each of the projection results includes: Determine the number of projection results that meet a preset condition among the projection results corresponding to the block images, wherein the preset condition includes that a first cutting position in the projection result is consistent with a second cutting position; A cutting line of the character string image to be cut is determined according to the number.

2. The method according to claim 1, characterized in that: The step of determining the connection string in the image to be identified includes: Preprocessing the image to be identified to obtain a binary image corresponding to the image to be identified; A connection string is determined according to the width of the circumscribed contour of the characters in the binary image.

3. The method according to claim 2, characterized in that The binary image includes the circumscribed contour of a single character and the circumscribed contour of a non-single character; The step of determining the connection string according to the width of the circumscribed contour of the characters in the binary image comprises: Determine the minimum width of the circumscribed contour of the character in the binary image; The non-single character corresponding to the circumscribed contour whose width is greater than a set multiple of the minimum width is determined as the connection character string.

4. The method according to claim 1, characterized in that: The step of cutting out an area of ​​a set width from the image area corresponding to the connected character string to obtain the character string image to be cut includes: From the image area corresponding to the connected string, an area of ​​a set width is cut with the left boundary of the string image to be cut as a starting line, or with the cutting line corresponding to the last cut string image to be cut as a starting line, to obtain the string image to be cut.

5. The method according to claim 1, characterized in that The step of dividing the to-be-cut character string image into blocks comprises: According to the character cutting direction, the character string image to be cut is divided into at least two block images according to a set ratio.

6. The method according to claim 1, characterized in that The step of determining the cutting line of the character string image to be cut according to the number includes: If the number is greater than or equal to 1, the first cutting position or the second cutting position in any group of projection results that meet the preset conditions is used as the cutting line of the character string image to be cut; If the number is 0, the mean of the first cutting positions in the projection results corresponding to the block images is taken as the first mean, the mean of the second cutting positions in the projection results corresponding to the block images is taken as the second mean, and the position corresponding to the mean of the first mean and the second mean is taken as the cutting line of the character string image to be cut.

7. A character cutting device, characterized in that: include: A determination module, used for determining a connection string in an image to be identified; A cutting module, used for cutting an area of ​​a set width from the image area corresponding to the connection string to obtain an image of the string to be cut; A projection module, used for dividing the character string image to be cut into blocks, and performing column projection on the obtained block images to obtain projection results corresponding to each of the block images; A cutting module, used for determining a cutting line of the character string image to be cut according to each of the projection results, so as to cut the character string image to be cut according to the cutting line; Wherein, the projection module comprises: A projection unit, configured to perform column projection on each block image to obtain a column white point distribution of the block image; A first determining unit is used to scan the column white point distribution in a first preset direction within a first scanning range of the block image to determine a position of a column with the least number of column white points as a first cutting position; A second determining unit is used to scan the column white point distribution in a second preset direction within a second scanning range of the block image to determine a position of a column with the least number of column white points as a second cutting position; The projection result corresponding to each block image includes a first cutting position and a second cutting position corresponding to the block image; Wherein, the cutting module comprises: a quantity determination unit, configured to determine the number of projection results that meet a preset condition among the projection results corresponding to the block images, wherein the preset condition includes that the first cutting position in the projection result is consistent with the second cutting position; A cutting line determining unit is used to determine a cutting line of the character string image to be cut according to the quantity.

8. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the character cutting method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the character cutting method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • License plate character segmentation method and apparatus

    CN105069456A

  • Character segmentation position determination and character segmentation methods, apparatuses and devices

    CN108491845A