CN106886777A - A kind of character boundary determines method and device - Google Patents
A kind of character boundary determines method and device Download PDFInfo
- Publication number
- CN106886777A CN106886777A CN201710233264.5A CN201710233264A CN106886777A CN 106886777 A CN106886777 A CN 106886777A CN 201710233264 A CN201710233264 A CN 201710233264A CN 106886777 A CN106886777 A CN 106886777A
- Authority
- CN
- China
- Prior art keywords
- character
- boundary
- column
- gray
- determining
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000004364 calculation method Methods 0.000 claims description 71
- 238000001514 detection method Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 3
- 230000011218 segmentation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V30/00—Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
- G06V30/10—Character recognition
- G06V30/14—Image acquisition
- G06V30/148—Segmentation of character regions
- G06V30/153—Segmentation of character regions using recognition of characters or words
Landscapes
- Engineering & Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Character Input (AREA)
Abstract
Determine method and device the embodiment of the invention discloses a kind of character boundary, wherein the method includes:For character grey figure, adjacent rows gray scale difference value and adjacent column gray scale difference value are calculated;Coboundary and the lower boundary of character are highly determined according to adjacent rows gray scale difference value and preset characters;The left margin and right margin of character are determined according to adjacent column gray scale difference value and preset characters width.The technical scheme of the embodiment of the present invention, four borders of character are determined by adjacent rows gray scale difference value, adjacent column gray scale difference value and preset characters size, character boundary can be accurately positioned, solve influence of the fritter stain to boundary alignment, and method is simple, stain need not be removed using additional means, time complexity is low.
Description
Technical Field
The embodiment of the invention relates to a character recognition technology, in particular to a character boundary determining method and device.
Background
Character recognition technology is widely used in daily life, for example, banknote crown word number recognition, license plate recognition, and the like. Taking paper currency as an example, the paper currency may be stained with stains of different degrees in the circulation process, and when the stains are in a crown word area, the accurate positioning of the character boundary is affected, which may cause recognition errors or even fail to recognize, and bring certain difficulty to the paper currency recognition or counterfeit identification. In order to effectively identify the crown word number of the paper money, in the process of identifying the crown word number, a computer vision technology and an image processing technology are utilized to process a polluted crown word number area, for example, stains are removed through simple methods such as binary operation, median filtering denoising and the like, so that the recognizable crown word number is obtained, and then a character boundary is positioned for segmentation and identification.
However, binarization and stain removal are required in the character recognition process, so that the whole recognition process takes a long time, the stain cannot be effectively removed by the simple method, and the stain still affects accurate positioning of character boundaries, thereby affecting character segmentation and recognition.
Disclosure of Invention
The embodiment of the invention provides a character boundary determining method and device, which can solve the problem of influence of stains on character boundary positioning, can accurately position character boundaries and has low time complexity.
In a first aspect, an embodiment of the present invention provides a method for determining a character boundary, including:
calculating the gray difference of adjacent rows and the gray difference of adjacent columns aiming at the character gray map;
determining an upper boundary and a lower boundary of the character according to the adjacent row gray level difference value and a preset character height;
and determining the left boundary and the right boundary of the character according to the adjacent column gray difference and the preset character width.
In a second aspect, an embodiment of the present invention further provides a character boundary determining apparatus, including:
the gray difference value calculation module is used for calculating the gray difference value of adjacent rows and the gray difference value of adjacent columns aiming at the character gray map;
the upper and lower boundary determining module is used for determining the upper boundary and the lower boundary of the character according to the adjacent row gray level difference value and the preset character height;
and the left and right boundary determining module is used for determining the left boundary and the right boundary of the character according to the adjacent column gray difference value and the preset character width.
According to the character boundary determining method and device provided by the embodiment of the invention, the four boundaries of the character are determined through the adjacent row gray level difference, the adjacent column gray level difference and the preset character size, the character boundary can be accurately positioned, the influence of small stains on the boundary positioning is solved, the method is simple, no extra means is needed for removing the stains, and the time complexity is low.
Drawings
FIG. 1 is a flowchart of a method for determining a character boundary according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a gray scale chart of a character according to an embodiment of the present invention;
fig. 3 is a block diagram of a character boundary determining apparatus according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The character picture in the embodiment of the invention refers to a character picture to be identified, such as a banknote serial number picture, a license plate picture and the like. If the character picture has small stains, and the stains do not cause the character to be unrecognizable due to the fact that the character is shielded by the stains, the character boundary determination can be carried out by applying the embodiment of the invention. If a large amount of stains exist in the character picture, the characters are completely shielded, character recognition cannot be performed, and character boundary determination is not needed, which is out of the discussion range of the embodiment of the invention.
Example one
Fig. 1 is a flowchart of a character boundary determining method according to an embodiment of the present invention, which is applicable to a case where there is a small smear on a character image and the smear does not affect character recognition, and the method may be executed by a character boundary determining apparatus, and the character boundary determining apparatus may be an electronic device having a calculating function and an image processing function. As shown in fig. 1, the character boundary determining method includes steps S110 to S130 as follows.
Step S110, aiming at the character gray level image, calculating the gray level difference value of adjacent rows and the gray level difference value of adjacent columns.
In this step, the character grayscale map may be obtained by converting the color image into a grayscale map, for example, a crown word number grayscale map and a license plate grayscale map of a banknote. The grayscale chart of the characters is shown in fig. 2, which is a part of the serial number of the paper currency. The crown word number gray scale image refers to a gray scale image of a crown word number area on the paper currency, and is not a gray scale image of the whole paper currency; the license plate gray scale image refers to a gray scale image of a license plate area.
The smaller the grayscale value of the grayscale map, the darker the image color, and the grayscale value corresponding to black is 0. In general, in a character gray scale image, a character is black, a gray value corresponding to a pixel is 0, a background of the character is gray, a corresponding gray value is large, and a color of a small smear in the gray scale image is generally darker than a background color.
The width of each column and the height of each row are each one pixel length. The calculation of the adjacent row gray scale difference and the adjacent column gray scale difference can be realized by various methods. By using a behavior example, the difference between the gray value of each pixel point in a certain row and the gray value of each pixel point in an adjacent row can be directly calculated, and then the gray differences of the pixel points are added; or the sum of the gray values of each row may be calculated first (for example, the sum of the gray values of each row is obtained by performing row projection on the gray map, or the sum of the gray values of the row is obtained by directly adding the gray values of the pixel points of the same row), and then the difference between the sum of the gray values of a certain row and the adjacent row is calculated.
And step S120, determining an upper boundary and a lower boundary of the character according to the gray difference value of the adjacent rows and the preset character height.
Step S130, determining the left boundary and the right boundary of the character according to the adjacent column gray difference and the preset character width.
The execution sequence of step S120 and step S130 is not sequential. In steps S120 and S130, the size of the single character (including the height and width of the character, i.e., the number of rows and columns occupied by the single character) is related to the image resolution at the time of RGB image acquisition, and the image resolution is different, and the size of the single character is also different. Since the format sizes of the crown word numbers or the license plates are uniform, the height of the preset characters and the width of the preset characters can be empirical values, taking the crown word numbers as an example, for a banknote gray scale image with the longitudinal resolution of 150 pixels and the transverse resolution of 200 pixels, the width of a single crown word number character is 20 pixels (accounting for 20 columns) and the height is 24 pixels (accounting for 24 rows), and then for the banknote gray scale image with the same resolution, the data can be used as the height of the preset characters and the width of the preset characters. In addition, the preset character height and the preset character width can also be obtained by calculation according to the resolution of the current character gray-scale map and the size of the character format, for example, the size of a single character in the license plate number can be obtained by calculation according to the resolution of the license plate gray-scale map.
In this embodiment, at the character boundary, a jump of gray scale values may occur, for example, the gray scale difference between the lines where the background is located is small, even 0; the gray value at the upper boundary of the character is reduced, and the gray difference value of the line at the lower line and the upper line of the upper boundary is calculated to obtain a negative value; each row of the character has black pixels, the gray difference value of each row of the character can be a positive value or a negative value, but the absolute value of the gray difference value is smaller than that of the boundary jump; the gray value at the lower boundary of the character is increased, and a positive value is obtained by calculating the gray difference value between the next line of the lower boundary and the line of the lower boundary. Thus, it can be determined that the line corresponding to the minimum difference (i.e., the line corresponding to the decrement in the difference calculation) is the upper boundary of the character and the line corresponding to the maximum difference (i.e., the line corresponding to the decrement in the difference calculation) is the lower boundary of the character. Of course, according to the above principle, the gray scale difference obtained by subtracting the next line from the previous line may also be calculated, in which case, the line corresponding to the minimum difference (i.e., the line corresponding to the number of subtractions in the difference calculation) is the lower boundary of the character, and the line corresponding to the maximum difference (i.e., the line corresponding to the number of subtractions in the difference calculation) is the upper boundary of the character. The principle of determining the left and right boundaries of a character is similar to the principle of determining the upper and lower boundaries, and will not be described repeatedly, but it should be noted that the left and right boundaries of each character need to be determined within a preset range.
For small blocks of stains which do not affect character recognition, compared with lines or columns with pure backgrounds, the stains can reduce the sum of gray values of the lines or columns, and considering that the stains may affect the determination of character boundaries by utilizing gray difference values, therefore, whether the boundaries determined according to the gray difference values are reasonable or not can be judged by combining preset character width and preset character height, and adjustment is carried out, so that accurate character boundary positioning is carried out.
According to the character boundary determining method, the four boundaries of the character are determined through the adjacent row gray scale difference value, the adjacent column gray scale difference value and the preset character size, the character boundary can be accurately positioned, the influence of small blocks of stains on boundary positioning is avoided, the method is simple, no extra means is needed for removing the stains, and the time complexity is low.
Example two
On the basis of the first embodiment, this embodiment provides a preferred implementation manner of calculating the gray scale difference value of adjacent lines, and determining the upper boundary and the lower boundary of a character according to the gray scale difference value of adjacent lines and the preset character height.
In this embodiment, the adjacent row gray level difference may be calculated in the following ways:
(1) and calculating the gray difference value of the next line and the current line by line. Wherein the gray scale difference can be calculated line by line from top to bottom. The gray difference value of the next row and the current row refers to the gray value of the next row minus the gray value of the current row.
(2) And calculating the gray difference value of the current line and the next line by line. Wherein the gray scale difference can be calculated line by line from top to bottom. The gray difference value of the current line and the next line is the gray value of the current line minus the gray value of the next line.
(3) Calculation of (R)i+1-Ri)+(Ri+2-Ri) Obtaining a first calculation result, wherein Ri+1-RiRepresenting the gray scale difference between the i +1 th row and the i-th row, Ri+2-RiRepresenting the gray scale difference between the i +2 th row and the i-th row. In this way, three lines of gray scale differences are involved, which ensures that the determined boundary is more accurate.
(4) Calculation of (R)i-Ri+1)+(Ri-Ri+2) Obtaining a second calculation result, wherein Ri-Ri+1Representing the gray scale difference between the ith row and the (i + 1) th row, Ri-Ri+2Representing the gray scale difference between the ith row and the (i + 2) th row. In this way, three lines of gray scale differences are involved, which ensures that the determined boundary is more accurate.
Preferably, the upper and lower boundaries of the character are determined according to the gray difference value of the adjacent rows and the preset character height, and the method can be realized by the following steps: determining the current line corresponding to the maximum value as the upper boundary or the lower boundary of the character according to the gray level difference value of the adjacent lines; detecting whether the distance between the determined upper boundary and the determined lower boundary is equal to the preset character height or not; if yes, the boundary positioning is accurate; if not, adjusting the upper boundary and/or the lower boundary of the character according to the gray difference value of the adjacent lines and the preset character height until the distance between the determined upper boundary and the lower boundary is equal to the preset character height. The gray level difference of adjacent rows is calculated in different manners, and according to the gray level difference, the corresponding relationship between the maximum value and the boundary is also different, and the maximum value may correspond to the upper boundary, or the minimum value corresponds to the upper boundary, which will be described later.
Specifically, the distance between the initially determined upper boundary and the initially determined lower boundary is not equal to the preset character height, and it may be that the upper boundary and/or the lower boundary are determined inaccurately. The boundary may be adjusted by combining a preset character height, a gray difference value, and a position of the determined boundary in the gray map, for example, if the character is located at the middle position of the picture, the boundary is positioned incorrectly if the determined boundary is close to the edge of the picture. There may be multiple equal minima (or multiple equal maxima) due to the effect of the smudge, and one of the minima may be selected for determining the boundary according to a predetermined rule, which may be an optional one, an uppermost minimum (or a lowermost maximum), or a fixed row (e.g., row 2 of the multiple equal minima). And then adjusting the determined upper and lower boundaries by combining the preset character height. The specific adjustment process needs to be performed according to actual conditions, for example, the minimum value corresponds to an upper boundary, a plurality of equal minimum values exist, a line corresponding to one value is determined as the upper boundary according to a preset rule, the lower boundary is uniquely determined, the distance between the upper boundary and the lower boundary is 10 and is smaller than the preset character height 24, obviously, the upper boundary may be positioned wrongly, the lines corresponding to other minimum values need to be replaced as the upper boundary, and after the replacement, the preset character height is used again for detection until the determined upper boundary and the lower boundary meet the condition that the distance is equal to the preset character height; or one can directly find that gray difference value 24 lines away from the lower boundary and if this value is also the minimum value, the corresponding line is determined as the new upper boundary.
In addition, if only the unique minimum value or the unique maximum value exists, but the distance between the upper boundary and the lower boundary is not equal to the preset character height, at this time, the position of the determined boundary in the gray scale map may be combined to determine which boundary is accurately positioned, for example, the lower boundary is accurate, a new upper boundary is determined by combining the preset character height, and if the gray scale difference value corresponding to the upper boundary is the gray scale difference value with the second lowest value, the boundary is accurately positioned.
For the above four calculation methods, there are specific methods for determining the correspondence between the maximum value and the boundary, which will be described below.
Under the condition that the gray difference value of the next line and the current line is calculated line by line in the mode (1), all the obtained gray difference values are compared, the current line corresponding to the minimum difference value is determined to be used as the upper boundary of the character, and the current line corresponding to the maximum difference value is determined to be used as the lower boundary of the character.
In the case of calculating the gray level difference values of the current line and the next line by line in the mode (2), comparing all the obtained gray level difference values, determining the current line corresponding to the maximum difference value as the upper boundary of the character, and determining the current line corresponding to the minimum difference value as the lower boundary of the character.
When the first calculation result is obtained by the calculation in the manner (3), the ith line corresponding to the minimum value in the first calculation result is determined as the upper boundary of the character, and the ith line corresponding to the maximum value in the first calculation result is determined as the lower boundary of the character.
In the case where the second calculation result is obtained by the calculation in the manner (4), the ith line corresponding to the maximum value in the first calculation result is determined as the upper boundary of the character, and the ith line corresponding to the minimum value in the first calculation result is determined as the lower boundary of the character.
The embodiment provides a plurality of specific ways to determine the upper and lower boundaries of the character, the way is flexible, and in practical application, a certain way can be selected for use according to practical situations.
EXAMPLE III
On the basis of the first embodiment and the second embodiment, this embodiment provides a preferred implementation manner of calculating the gray level difference value of the adjacent columns and determining the left boundary and the right boundary of the character according to the gray level difference value of the adjacent columns and the preset character width.
In this embodiment, the adjacent column gray difference may be calculated in the following ways:
(1) the gray difference between the next column and the current column is calculated column by column. Wherein the gray scale difference values may be calculated column by column from front to back. The gray difference between the next column and the current column is the gray value of the next column minus the gray value of the current column.
(2) The gray difference between the current column and the next column is calculated column by column. Wherein the gray scale difference values may be calculated column by column from front to back. The gray difference between the current column and the next column is the gray value of the current column minus the gray value of the next column.
(3) Calculating (C)j+1-Cj)+(Cj+2-Cj) Obtaining a third calculation result, wherein Cj+1-CjRepresenting the difference in gray levels of the j +1 th column and the j column, Cj+2-CjRepresenting the gray scale difference between the current j +2 th column and the j th column. In this way, three rows of gray scale differences are involved, which ensures that the determined boundary is more accurate.
(4) Calculating (C)j-Cj+1)+(Cj-Cj+2) Obtaining a fourth calculation result, wherein Cj-Cj+1Representing the difference in gray levels of the j-th column and the j + 1-th column, Cj-Cj+2Representing the gray scale difference between the current j th column and the j +2 th column. In this way, three rows of gray scale differences are involved, which ensures that the determined boundary is more accurate.
Preferably, the left boundary and the right boundary of the character are determined according to the gray difference value of the adjacent columns and the preset character width, and the method can be realized by the following steps:
step A1, comparing the gray difference of adjacent columns in the first preset column number range, and determining the current column corresponding to the maximum value as the left boundary or the right boundary of the current character; the gray level difference of adjacent columns is calculated in different manners, and according to the gray level difference, the corresponding relationship between the maximum value and the boundary is also different, and the maximum value may correspond to the left boundary, or the minimum value corresponds to the left boundary, which will be described later.
Step a2, it is checked whether the determined left boundary is separated from the right boundary by a distance equal to a predetermined character width.
Step A3, if yes, the boundary is accurately located.
And step A4, if not, adjusting the left boundary and/or the right boundary of the character according to the adjacent column gray difference and the preset character width until the distance between the determined left boundary and the right boundary is equal to the preset character width.
Step A5, for other characters in the character gray-scale map, after the distance between the characters and the adjacent characters with the determined boundaries is within the second preset column number range, comparing the difference value within the third preset column number range, determining the current column corresponding to the maximum value as the left boundary or the right boundary of the corresponding character, and executing the steps A2 to A4 to detect whether the boundaries are accurately positioned until the left boundary and the right boundary of each character are determined.
In this embodiment, the left and right boundaries of any character may be determined first, and after the boundary positioning is detected accurately, the boundaries of other characters may be determined one by one starting from the adjacent character with the character as a reference. For example, the characters with stains can be determined according to the stain information of the characters input by the user, and then the boundary of the selected character is determined at first by selecting one of the characters without stains; the boundary may also be determined starting from the first character.
The values of the first, second, and third preset column number ranges are related to the character position at which the boundary is determined first. For example, if the first character is determined, then the first predetermined number of columns may be 60 columns, which typically includes only the first character, taking into account the existence of a blank on the left side of the grayscale map. The second predetermined column number range is also related to the set reference, for example, the second predetermined column number range may be 25 columns based on the left boundary of the left adjacent character; the second predetermined number of columns may range from 5 columns, based on the right boundary of the left adjacent character. The third preset range of column numbers may be data larger than a single character width.
The boundary adjustment according to the preset character width is similar to the boundary adjustment according to the preset character height, and the number of columns occupied by a single character needs to be considered, which is not described herein again.
For the above four calculation methods, there are specific methods for determining the correspondence between the maximum value and the boundary, which will be described below.
Under the condition that the gray difference value between the next column and the current column is calculated column by column in the mode (1), determining the current column corresponding to the minimum difference value in the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the maximum difference value in the range of the first preset column number as the right boundary of the current character;
under the condition that the gray difference between the current column and the next column is calculated column by column in the mode (2), determining the current column corresponding to the maximum difference in the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the minimum difference in the range of the first preset column number as the right boundary of the current character;
determining the j-th column corresponding to the minimum value in the first preset column number range as the left boundary of the character and determining the j-th column corresponding to the maximum value in the first preset column number range as the right boundary of the character under the condition that the third calculation result is obtained by the calculation in the mode (3);
in the case of obtaining the fourth calculation result by the calculation in the manner (4), the jth column corresponding to the maximum value in the first preset column number range is determined as the left boundary of the character, and the jth column corresponding to the minimum value in the first preset column number range is determined as the right boundary of the character.
In the embodiment, the left and right boundaries of the character can be determined from the character which is not affected by the smudges, so that the influence of the smudges on boundary positioning is reduced, and the accuracy of the boundary positioning is improved. The embodiment provides a plurality of specific modes for determining the left and right boundaries of the character, the modes are flexible, and in practical application, a certain mode can be selected for use according to actual conditions.
In the second and third embodiments, the positioning methods of the upper and lower boundaries and the left and right boundaries may be used in combination, for example, the upper and lower boundaries are determined by the calculation method (1) of the second embodiment and the corresponding method, and the left and right boundaries are determined by the calculation method (2) of the third embodiment and the corresponding method.
Example four
Fig. 3 is a block diagram of a character boundary determining apparatus according to a fourth embodiment of the present invention, which is applicable to a case where there is a small smear on a character image and the smear does not affect character recognition, as shown in fig. 3, the apparatus includes: a gray difference value calculating module 31, an upper and lower boundary determining module 32, and a left and right boundary determining module 33.
The gray difference value calculating module 31 is configured to calculate, for the character gray map, a gray difference value of adjacent rows and a gray difference value of adjacent columns; the upper and lower boundary determining module 32 is configured to determine an upper boundary and a lower boundary of the character according to the adjacent row gray level difference and a preset character height; and a left-right boundary determining module 33, configured to determine a left boundary and a right boundary of the character according to the adjacent column gray difference and a preset character width.
The character boundary determining device of the embodiment determines four boundaries of the character through the adjacent row gray scale difference value, the adjacent column gray scale difference value and the preset character size, can accurately position the character boundaries, solves the problem that small blocks of stains have influence on boundary positioning, is simple in method, does not need to adopt additional means to remove stains, and is low in time complexity.
Preferably, the upper and lower boundary determining module 32 includes: an upper and lower boundary determining unit and a height detecting unit. The upper and lower boundary determining unit is used for determining the current line corresponding to the maximum value as the upper boundary or the lower boundary of the character according to the gray level difference value of the adjacent lines; the height detection unit is used for detecting whether the distance between the determined upper boundary and the determined lower boundary is equal to the preset character height or not; if yes, the boundary positioning is accurate; if not, adjusting the upper boundary and/or the lower boundary of the character according to the gray difference value of the adjacent lines and the preset character height until the distance between the determined upper boundary and the lower boundary is equal to the preset character height.
The gray difference calculation module 31 is specifically configured to: calculating the gray difference value of the next line and the current line by line; or, calculating the gray difference value of the current line and the next line by line; or, calculating (R)i+1-Ri)+(Ri+2-Ri) Obtaining a first calculation result, wherein Ri+1-RiRepresenting the gray scale difference between the i +1 th row and the i-th row, Ri+2-RiRepresenting the gray difference value of the (i + 2) th row and the ith row; or, calculating (R)i-Ri+1)+(Ri-Ri+2) Obtaining a second calculation result, wherein Ri-Ri+1Representing the gray scale difference between the ith row and the (i + 1) th row, Ri-Ri+2Representing the gray scale difference between the ith row and the (i + 2) th row.
The upper and lower boundary determining unit is specifically configured to:
under the condition of calculating the gray difference value of the next line and the current line by line, comparing all the obtained gray difference values, determining the current line corresponding to the minimum difference value as the upper boundary of the character, and determining the current line corresponding to the maximum difference value as the lower boundary of the character;
under the condition of calculating the gray difference value of the current line and the next line by line, comparing all the obtained gray difference values, determining the current line corresponding to the maximum difference value as the upper boundary of the character, and determining the current line corresponding to the minimum difference value as the lower boundary of the character;
under the condition that a first calculation result is obtained through calculation, determining an ith line corresponding to the minimum value in the first calculation result as an upper boundary of the character, and determining an ith line corresponding to the maximum value in the first calculation result as a lower boundary of the character;
and under the condition that the second calculation result is obtained through calculation, determining the ith line corresponding to the maximum value in the first calculation result as the upper boundary of the character, and determining the ith line corresponding to the minimum value in the first calculation result as the lower boundary of the character.
Preferably, the left-right boundary determining module 33 includes: a left-right boundary determining unit, a width detecting unit and a boundary adjusting unit. The left and right boundary determining unit is used for comparing the gray difference values of adjacent columns in a first preset column number range and determining the current column corresponding to the maximum value as the left boundary or the right boundary of the current character; the width detection unit is used for detecting whether the distance between the determined left boundary and the right boundary is equal to the preset character width or not; if yes, the boundary positioning is accurate; if not, adjusting the left boundary and/or the right boundary of the character according to the adjacent column gray difference value and the preset character width until the distance between the determined left boundary and the right boundary is equal to the preset character width; and the boundary adjusting unit is used for comparing the difference value in the third preset column number range after the distance between other characters in the character gray-scale map and the adjacent characters with the determined boundaries is within the second preset column number range, determining the current column corresponding to the maximum value as the left boundary or the right boundary of the corresponding character, and detecting whether the boundaries are accurately positioned by using the width detection unit until the left boundary and the right boundary of each character are determined.
The gray difference calculation module 31 is specifically configured to: calculating the gray difference value of the next column and the current column row by row; or, calculating the gray difference between the current column and the next column line by line; or, calculating (C)j+1-Cj)+(Cj+2-Cj) Obtaining a third calculation result, wherein Cj+1-CjRepresenting the difference in gray levels of the j +1 th column and the j column, Cj+2-CjRepresenting the gray difference value of the current j +2 th column and the j th column; or, calculating (C)j-Cj+1)+(Cj-Cj+2) To obtain the fourthCalculating the result, wherein Cj-Cj+1Representing the difference in gray levels of the j-th column and the j + 1-th column, Cj-Cj+2Representing the gray scale difference between the current j th column and the j +2 th column.
The left and right boundary determining unit is specifically configured to:
under the condition that the gray difference value between the next column and the current column is calculated column by column, determining the current column corresponding to the minimum difference value within the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the maximum difference value within the range of the first preset column number as the right boundary of the current character;
under the condition that the gray difference between the current column and the next column is calculated column by column, determining the current column corresponding to the maximum difference within the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the minimum difference within the range of the first preset column number as the right boundary of the current character;
under the condition that a third calculation result is obtained through calculation, determining a j-th column corresponding to the minimum value in the first preset column number range as a left boundary of the character, and determining a j-th column corresponding to the maximum value in the first preset column number range as a right boundary of the character;
and under the condition that a fourth calculation result is obtained through calculation, determining a j-th column corresponding to the maximum value in the first preset column number range as a left boundary of the character, and determining a j-th column corresponding to the minimum value in the first preset column number range as a right boundary of the character.
The character boundary determining device can execute the character boundary determining method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects for executing the method.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A method for character boundary determination, comprising:
calculating the gray difference of adjacent rows and the gray difference of adjacent columns aiming at the character gray map;
determining an upper boundary and a lower boundary of the character according to the adjacent row gray level difference value and a preset character height;
and determining the left boundary and the right boundary of the character according to the adjacent column gray difference and the preset character width.
2. The method of claim 1, wherein determining the upper and lower boundaries of the character according to the gray difference of the adjacent lines and a preset character height comprises:
determining the current line corresponding to the maximum value as the upper boundary or the lower boundary of the character according to the gray level difference value of the adjacent lines;
detecting whether the distance between the determined upper boundary and the determined lower boundary is equal to the preset character height or not;
if yes, the boundary positioning is accurate;
if not, adjusting the upper boundary and/or the lower boundary of the character according to the adjacent row gray level difference and the preset character height until the distance between the determined upper boundary and the lower boundary is equal to the preset character height.
3. The method of claim 2, wherein calculating the adjacent row gray scale difference comprises:
calculating the gray difference value of the next line and the current line by line; or,
calculating the gray difference value of the current line and the next line by line; or,
calculation of (R)i+1-Ri)+(Ri+2-Ri) Obtaining a first calculation result, wherein Ri+1-RiRepresenting the gray scale difference between the i +1 th row and the i-th row, Ri+2-RiRepresenting the gray difference value of the (i + 2) th row and the ith row; or,
calculation of (R)i-Ri+1)+(Ri-Ri+2) Obtaining a second calculation result, wherein Ri-Ri+1Representing the gray scale difference between the ith row and the (i + 1) th row, Ri-Ri+2Representing the gray scale difference between the ith row and the (i + 2) th row.
4. The method of claim 3, wherein determining the current line corresponding to the maximum value as the upper boundary or the lower boundary of the character according to the gray level difference of the adjacent lines comprises:
under the condition of calculating the gray difference value of the next line and the current line by line, comparing all the obtained gray difference values, determining the current line corresponding to the minimum difference value as the upper boundary of the character, and determining the current line corresponding to the maximum difference value as the lower boundary of the character;
under the condition of calculating the gray difference value of the current line and the next line by line, comparing all the obtained gray difference values, determining the current line corresponding to the maximum difference value as the upper boundary of the character, and determining the current line corresponding to the minimum difference value as the lower boundary of the character;
under the condition that a first calculation result is obtained through calculation, determining an ith line corresponding to the minimum value in the first calculation result as an upper boundary of a character, and determining an ith line corresponding to the maximum value in the first calculation result as a lower boundary of the character;
and under the condition that a second calculation result is obtained through calculation, determining the ith row corresponding to the maximum value in the first calculation result as the upper boundary of the character, and determining the ith row corresponding to the minimum value in the first calculation result as the lower boundary of the character.
5. The method of claim 1, wherein determining left and right boundaries of a character according to the gray difference of adjacent columns and a preset character width comprises:
step A1, comparing the gray difference of adjacent columns in the first preset column number range, and determining the current column corresponding to the maximum value as the left boundary or the right boundary of the current character;
step A2, detecting whether the distance between the left boundary and the right boundary is equal to the preset character width;
step A3, if yes, the boundary positioning is accurate;
step A4, if not, adjusting the left boundary and/or the right boundary of the character according to the adjacent column gray difference and the preset character width until the distance between the determined left boundary and the right boundary is equal to the preset character width;
step A5, for other characters in the character gray-scale map, after the distance between the characters and the adjacent characters with the determined boundaries is within a second preset column number range, comparing the difference value within the third preset column number range, determining the current column corresponding to the maximum value as the left boundary or the right boundary of the corresponding character, and executing the steps A2 to A4 to detect whether the boundaries are accurately positioned until the left boundary and the right boundary of each character are determined.
6. The method of claim 5, wherein calculating the adjacent column gray scale difference comprises:
calculating the gray difference value of the next column and the current column row by row; or,
calculating the gray difference value of the current column and the next column by column; or,
calculating (C)j+1-Cj)+(Cj+2-Cj) Obtaining a third calculation result, wherein Cj+1-CjRepresenting the difference in gray levels of the j +1 th column and the j column, Cj+2-CjRepresenting the gray difference value of the current j +2 th column and the j th column; or,
calculating (C)j-Cj+1)+(Cj-Cj+2) Obtaining a fourth calculation result, wherein Cj-Cj+1Representing the difference in gray levels of the j-th column and the j + 1-th column, Cj-Cj+2Representing the gray scale difference between the current j th column and the j +2 th column.
7. The method of claim 6, wherein determining the current column corresponding to the most significant value as the left or right boundary of the current character comprises:
under the condition that the gray difference value between the next column and the current column is calculated column by column, determining the current column corresponding to the minimum difference value within the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the maximum difference value within the range of the first preset column number as the right boundary of the current character;
under the condition that the gray difference between the current column and the next column is calculated column by column, determining the current column corresponding to the maximum difference within the range of the first preset column number as the left boundary of the current character, and determining the current column corresponding to the minimum difference within the range of the first preset column number as the right boundary of the current character;
under the condition that a third calculation result is obtained through calculation, determining a j-th column corresponding to a minimum value in the first preset column number range as a left boundary of the character, and determining a j-th column corresponding to a maximum value in the first preset column number range as a right boundary of the character;
and under the condition that a fourth calculation result is obtained through calculation, determining a j-th column corresponding to the maximum value in the first preset column number range as a left boundary of the character, and determining a j-th column corresponding to the minimum value in the first preset column number range as a right boundary of the character.
8. A character boundary determining apparatus, comprising:
the gray difference value calculation module is used for calculating the gray difference value of adjacent rows and the gray difference value of adjacent columns aiming at the character gray map;
the upper and lower boundary determining module is used for determining the upper boundary and the lower boundary of the character according to the adjacent row gray level difference value and the preset character height;
and the left and right boundary determining module is used for determining the left boundary and the right boundary of the character according to the adjacent column gray difference value and the preset character width.
9. The apparatus of claim 8, wherein the upper and lower boundary determining module comprises:
the upper and lower boundary determining unit is used for determining the current line corresponding to the maximum value as the upper boundary or the lower boundary of the character according to the adjacent line gray difference value;
the height detection unit is used for detecting whether the distance between the determined upper boundary and the determined lower boundary is equal to the preset character height or not; if yes, the boundary positioning is accurate; if not, adjusting the upper boundary and/or the lower boundary of the character according to the adjacent row gray level difference and the preset character height until the distance between the determined upper boundary and the lower boundary is equal to the preset character height.
10. The apparatus of claim 9, wherein the gray scale difference calculation module is specifically configured to:
calculating the gray difference value of the next line and the current line by line; or,
calculating the gray difference value of the current line and the next line by line; or,
calculation of (R)i+1-Ri)+(Ri+2-Ri) Obtaining a first calculation result, wherein Ri+1-RiRepresenting the gray scale difference between the i +1 th row and the i-th row, Ri+2-RiRepresenting the gray difference value of the (i + 2) th row and the ith row; or,
calculation of (R)i-Ri+1)+(Ri-Ri+2) Obtaining a second calculation result, wherein Ri-Ri+1Representing the gray scale difference between the ith row and the (i + 1) th row, Ri-Ri+2Representing the gray scale difference between the ith row and the (i + 2) th row.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710233264.5A CN106886777B (en) | 2017-04-11 | 2017-04-11 | Character boundary determining method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710233264.5A CN106886777B (en) | 2017-04-11 | 2017-04-11 | Character boundary determining method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106886777A true CN106886777A (en) | 2017-06-23 |
CN106886777B CN106886777B (en) | 2020-06-09 |
Family
ID=59182810
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710233264.5A Active CN106886777B (en) | 2017-04-11 | 2017-04-11 | Character boundary determining method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106886777B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110321895A (en) * | 2019-04-30 | 2019-10-11 | 北京市商汤科技开发有限公司 | Certificate recognition methods and device, electronic equipment, computer readable storage medium |
CN110533019A (en) * | 2018-05-23 | 2019-12-03 | 杭州海康威视数字技术股份有限公司 | License plate locating method, device and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1920849A (en) * | 2005-08-26 | 2007-02-28 | 电子科技大学 | Vehicle license plate extraction method based on high-hat switch and wavelet switch |
CN101711398A (en) * | 2007-02-22 | 2010-05-19 | 三星电子株式会社 | Extraction method of an interest region for multimedia mobile users |
CN101751785A (en) * | 2010-01-12 | 2010-06-23 | 杭州电子科技大学 | Automatic license plate recognition method based on image processing |
CN102054169A (en) * | 2010-12-28 | 2011-05-11 | 青岛海信网络科技股份有限公司 | License plate positioning method |
CN102722711A (en) * | 2012-05-31 | 2012-10-10 | 信帧电子技术(北京)有限公司 | License plate character sequence identification method and device in license plate type identification |
CN104463209A (en) * | 2014-12-08 | 2015-03-25 | 厦门理工学院 | Method for recognizing digital code on PCB based on BP neural network |
CN105243730A (en) * | 2015-10-28 | 2016-01-13 | 深圳怡化电脑股份有限公司 | Banknote identification method and system |
-
2017
- 2017-04-11 CN CN201710233264.5A patent/CN106886777B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1920849A (en) * | 2005-08-26 | 2007-02-28 | 电子科技大学 | Vehicle license plate extraction method based on high-hat switch and wavelet switch |
CN101711398A (en) * | 2007-02-22 | 2010-05-19 | 三星电子株式会社 | Extraction method of an interest region for multimedia mobile users |
CN101751785A (en) * | 2010-01-12 | 2010-06-23 | 杭州电子科技大学 | Automatic license plate recognition method based on image processing |
CN102054169A (en) * | 2010-12-28 | 2011-05-11 | 青岛海信网络科技股份有限公司 | License plate positioning method |
CN102722711A (en) * | 2012-05-31 | 2012-10-10 | 信帧电子技术(北京)有限公司 | License plate character sequence identification method and device in license plate type identification |
CN104463209A (en) * | 2014-12-08 | 2015-03-25 | 厦门理工学院 | Method for recognizing digital code on PCB based on BP neural network |
CN105243730A (en) * | 2015-10-28 | 2016-01-13 | 深圳怡化电脑股份有限公司 | Banknote identification method and system |
Non-Patent Citations (4)
Title |
---|
孙强: "低质量印刷体字符分割与识别研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
江海燕: "液晶显示仪表示值机器视觉检测系统研制", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
王静娇 等: "基于TMS320DM642的人民币图像特征识别系统", 《数据采集与处理》 * |
苑玮琦, 江海燕: "基于 ACSS 角点定位的液晶显示仪表示值识别算法", 《计算机系统应用》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110533019A (en) * | 2018-05-23 | 2019-12-03 | 杭州海康威视数字技术股份有限公司 | License plate locating method, device and storage medium |
CN110321895A (en) * | 2019-04-30 | 2019-10-11 | 北京市商汤科技开发有限公司 | Certificate recognition methods and device, electronic equipment, computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106886777B (en) | 2020-06-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109726643B (en) | Method and device for identifying table information in image, electronic equipment and storage medium | |
CN109658584B (en) | Bill information identification method and device | |
CN104867225B (en) | A kind of bank note towards recognition methods and device | |
CN108108753B (en) | Identification method and device for check box selection state based on support vector machine | |
CN106326887B (en) | A kind of method of calibration and device of optical character identification result | |
CN107067536B (en) | A kind of image boundary determines method, apparatus, equipment and storage medium | |
CN107103683B (en) | Paper money identification method and device, electronic equipment and storage medium | |
CN108734161B (en) | Method, device and equipment for identifying prefix number area and storage medium | |
CN109389110B (en) | Region determination method and device | |
CN114387591A (en) | License plate recognition method, system, equipment and storage medium | |
CN106898078B (en) | Port currency version identification method and device | |
CN106886777B (en) | Character boundary determining method and device | |
CA3139448A1 (en) | Image correction method, device and system | |
CN104346609A (en) | Method and device for recognizing characters on printed products | |
CN105139508B (en) | A kind of method and device of detection bank note | |
EP2256691B1 (en) | Image processing device for vehicle and image processing program | |
Fernández-Caballero et al. | Display text segmentation after learning best-fitted OCR binarization parameters | |
CN107680246B (en) | Method and equipment for positioning curve boundary in paper money pattern | |
CN106898085A (en) | Identification bank note towards method and device | |
EP2919149A2 (en) | Image processing apparatus and image processing method | |
CN109726722B (en) | Character segmentation method and device | |
CN111814780A (en) | Bill image processing method, device and equipment and storage medium | |
CN111583156A (en) | Document image shading removing method and system | |
CN110059695B (en) | Character segmentation method based on vertical projection and terminal | |
JP5010627B2 (en) | Character recognition device and character recognition method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |