A method for segmenting connected characters in an image and related apparatus

By using geometric features of individual characters and an improved dripping algorithm, effective segmentation points are selected for segmenting contiguous characters. This solves the accuracy problem of the dripping algorithm in segmenting contiguous characters and achieves higher segmentation accuracy.

CN113971803BActive Publication Date: 2025-11-11SHANGHAI UNIV (JIAXING ZHEJIANG) EMERGING IND RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111242648.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-25
Publication Date
2025-11-11
Estimated Expiration
2041-10-25

AI Technical Summary

Technical Problem

Existing dripping algorithms are prone to inaccurate segmentation when segmenting contiguous characters due to incorrect selection of the initial dripping point.

Method used

By identifying the adhesion region based on the geometric features of a single character, candidate segmentation points are selected using the vertical projection map, upper contour map, and lower contour map, and the effective segmentation points are determined and segmented using an improved dripping algorithm.

Benefits of technology

It improves the accuracy of segmenting contiguous characters, avoids incorrect segmentation caused by incorrect initial drop point selection, and enhances the precision of the segmentation method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113971803B_ABST
    Figure CN113971803B_ABST
Patent Text Reader

Abstract

This invention discloses a method and related equipment for segmenting connected characters in an image. The method includes: identifying connected regions by statistically analyzing the geometric features of individual characters; and selecting segmentation points twice using the vertical projection map, upper contour map, and lower contour map of the connected regions, as well as the geometric features of individual characters. This ensures that the segmentation points better reflect the actual characteristics of the connected characters. Furthermore, the method for determining the initial drop point and seed point in the dripping algorithm seed method is improved, avoiding the possibility that the selected initial drop point might be located in a recessed area of ​​the character or inside the character, leading to incorrect segmentation. Therefore, this method for segmenting connected characters is more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of image recognition, and more specifically, to a method and related equipment for segmenting connected characters in an image. Background Technology

[0002] OCR (Optical Character Recognition) is a technology that uses optical methods to convert text in paper or image documents into black-and-white dot matrix image files. Then, recognition software converts the text in the image into text format so that word processing software can further edit and process it. Currently, OCR has a wide range of applications, such as license plate character recognition, business card and ID information recognition, and bank deposit and withdrawal amount recognition. The main workflow of OCR technology currently includes image acquisition, image preprocessing, and single-character recognition. Character segmentation is an indispensable part of an OCR system and occupies an extremely important position.

[0003] The dripping water algorithm is a commonly used method for character segmentation. Its basic principle is to simulate the process of water droplets falling from a height under the influence of gravity to segment connected characters. In this process, the trajectory of the water droplets constitutes the path for segmenting connected characters; however, the initial droplet point may be located in the concave part of the character or inside the character, which will cause incorrect segmentation. Therefore, the character segmentation accuracy of the traditional dripping water algorithm is relatively low.

[0004] Therefore, it is necessary to propose a method for segmenting connected characters in an image to at least partially solve the problems existing in the prior art. Summary of the Invention

[0005] The summary section introduces a series of simplified concepts, which will be further explained in detail in the detailed description section. The summary section of this invention is not intended to limit the key features and essential technical features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.

[0006] To at least partially solve the above problems, in a first aspect, the present invention proposes a method for segmenting connected characters in an image, the method comprising:

[0007] Adhesion regions are determined based on the geometric features of individual characters, wherein the aforementioned geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The aforementioned adhesive area includes the aforementioned adhesive characters;

[0008] Based on the vertical projection, upper contour, and lower contour of the adhesion region, candidate segmentation points for the adhesion region are determined, including candidate upper segmentation points and candidate lower segmentation points.

[0009] Valid segmentation points are determined based on the geometric features of the individual characters and the candidate segmentation points, wherein the valid segmentation points include valid upper segmentation points and valid lower segmentation points.

[0010] Based on the above effective segmentation points, the adhering characters are segmented using the dripping algorithm.

[0011] Optionally, the above-mentioned determination of the adhesion region based on the geometric features of a single character includes:

[0012] Geometric features of row strings and / or column strings in the above image are obtained using the contour connected component detection method;

[0013] The region corresponding to the row string and / or column string whose geometric features exceed a preset threshold is the aforementioned adhesion region. The preset threshold is determined by the geometric features of the aforementioned individual character.

[0014] Optionally, determining the candidate segmentation points of the adhesion region based on the vertical projection, upper contour, and lower contour of the adhesion region includes:

[0015] Based on the vertical projection map, upper contour map and lower contour map of the above-mentioned adhesion region, the extreme point coordinate set is obtained. The extreme point coordinate set includes the extreme point coordinates of the vertical projection map, the extreme point coordinates of the upper contour map and the extreme point coordinates of the lower contour map.

[0016] The points whose element differences in the above extreme point coordinate set are less than a preset value are selected as candidate segmentation points for the above-mentioned adhesion region.

[0017] Optionally, the determination of effective segmentation points based on the geometric features of the individual characters and the candidate segmentation points includes:

[0018] Based on the geometric features of the individual characters, the effective upper segmentation points are selected from the candidate upper segmentation points by choosing the segmentation points with smaller variances corresponding to the left or right endpoints of the adhesion region.

[0019] Based on the geometric features of the individual characters, the effective lower segmentation points are selected from the candidate lower segmentation points, with the left or right endpoints of the adhesion region having smaller variances.

[0020] Optionally, the above-mentioned segmentation of the adhering characters based on the effective segmentation points and the dripping algorithm includes:

[0021] The above effective upper segmentation point is used as the starting drop point, and the above effective lower segmentation point is used as the seed point;

[0022] Based on the aforementioned starting drop point and seed point, the aforementioned dripping algorithm is used to segment the aforementioned contiguous characters.

[0023] Optionally, the above-mentioned segmentation of the adhering characters using the above-mentioned dripping algorithm based on the above-mentioned starting dripping point and the above-mentioned seed point includes:

[0024] When the ordinate of the starting drop point is less than half the ordinate of the seed point, the water droplet is mainly affected by gravity to separate the connected characters.

[0025] When the ordinate of the starting drop point is greater than half the ordinate of the seed point, the water droplet is subjected to a resultant force to separate the sticky characters.

[0026] When the ordinate of the starting droplet is equal to the ordinate of the seed point, the droplet is moved to the position of the seed point to separate the connected characters.

[0027] Optionally, the above methods also include:

[0028] Obtain the binarized image of the above image;

[0029] Geometric features of individual characters in the aforementioned binarized image are obtained using the contour connected component detection method.

[0030] Secondly, the present invention also proposes a device for segmenting connected characters in an image, comprising:

[0031] First determining unit: used to determine the adhesion region based on the geometric features of a single character, wherein the aforementioned geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The aforementioned adhesive area includes the aforementioned adhesive characters;

[0032] The second determining unit is used to determine candidate segmentation points of the adhesion region based on the vertical projection map, upper contour map and lower contour map of the adhesion region. The candidate segmentation points include candidate upper segmentation points and candidate lower segmentation points.

[0033] The third determining unit is used to determine effective segmentation points based on the geometric features of the aforementioned individual characters and the aforementioned candidate segmentation points, wherein the aforementioned effective segmentation points include effective upper segmentation points and effective lower segmentation points;

[0034] Segmentation Unit: Used to segment the above-mentioned contiguous characters based on the above effective segmentation points using the dripping algorithm.

[0035] Thirdly, an electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program stored in the memory to implement the steps of the method for segmenting stuck characters in an image as described in any of the first aspects above.

[0036] Fourthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method for segmenting contiguous characters in an image according to any of the preceding claims of the first aspect.

[0037] In summary, this scheme identifies the sticky regions by statistically analyzing the geometric features of individual characters. It then uses the vertical projection map, upper contour map, and lower contour map of the sticky region, along with the geometric features of individual characters, to filter segmentation points twice. This ensures that the segmentation points better reflect the actual characteristics of the sticky characters. Furthermore, it improves the method for determining the initial dripping point and seed point in the dripping algorithm's seed method, avoiding the possibility that the initial dripping point might be located in a recessed area of ​​the character or inside the character, leading to incorrect segmentation. Therefore, this method for segmenting sticky characters is more accurate.

[0038] The method for segmenting connected characters in an image according to the present invention, other advantages, objectives and features of the present invention will be apparent in part from the following description, and in part will be understood by those skilled in the art through study and practice of the present invention. Attached Figure Description

[0039] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit this specification. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0040] Figure 1 A schematic flowchart of a method for segmenting connected characters in an image, provided in an embodiment of this application;

[0041] Figure 2 This application provides an original image and a pre-processed schematic diagram of the surface of an IC chip, which are provided as embodiments of the present application.

[0042] Figure 3 This application provides a schematic diagram illustrating the extraction of a region of adhering characters.

[0043] Figure 4 A schematic diagram illustrating a vertical projection view and an upper and lower contour view provided for an embodiment of this application;

[0044] Figure 5A schematic diagram illustrating a candidate upper and lower segmentation point provided in an embodiment of this application;

[0045] Figure 6 A schematic diagram illustrating an effective upper and lower dividing point provided in an embodiment of this application;

[0046] Figure 7 This application provides a schematic diagram of the motion of a water droplet under the influence of gravity, as an embodiment of the present application.

[0047] Figure 8 This application provides a schematic diagram of the motion of a water droplet under the action of a resultant force.

[0048] Figure 9 This is a schematic diagram illustrating the effect of segmenting characters adhering to an image on a chip surface, provided in an embodiment of this application.

[0049] Figure 10 A schematic diagram of a device for segmenting characters that are stuck together in an image, provided in an embodiment of this application;

[0050] Figure 11 This is a schematic diagram of an electronic device structure for segmenting characters that are stuck together in an image, provided as an embodiment of this application. Detailed Implementation

[0051] This application provides a method and related device for segmenting connected characters in an image. This embodiment identifies the connected regions based on the geometric features of a single character and improves the method for determining the starting drop point and seed point of the dripping algorithm seed method. This avoids the phenomenon that the initial drop point may be located in the concave part of the character or inside the character, causing incorrect segmentation. Therefore, this method for segmenting connected characters is more accurate.

[0052] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The technical solutions of the embodiments of this application will now be clearly and completely described in conjunction with the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them.

[0053] Please see Figure 1 This is a flowchart illustrating a method for segmenting connected characters in an image according to an embodiment of this application, which specifically includes:

[0054] S110. Determine the adhesion region based on the geometric features of a single character, wherein the aforementioned geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The aforementioned adhesive area includes the aforementioned adhesive characters;

[0055] Specifically, the contour connected component detection method is used to perform contour detection on the image and statistical analysis on all individual characters. Rectangular boxes with aspect ratios between a preset threshold are selected. The preset threshold can be set according to the characteristics of the characters in the detected image. The maximum width W of the selected rectangle is then calculated. max and minimum width W min Simultaneously calculate the sum of the width, height, and aspect ratio of these rectangles, and finally obtain the average width X. w Average height X h Average aspect ratio X s The region corresponding to a rectangle whose area, width, and aspect ratio all exceed the first threshold is determined to be an adhered region.

[0056] S120. Based on the vertical projection diagram, upper contour diagram and lower contour diagram of the adhesion region, determine the candidate segmentation points of the adhesion region, including the candidate upper segmentation point and the candidate lower segmentation point.

[0057] Specifically, local extrema are calculated for the vertical projection, upper contour, and lower contour respectively. Depth thresholds are set on the left and right sides of the local extrema points to obtain the extrema points of the upper contour, lower contour, and vertical projection. Let the x-coordinate array of the upper contour extrema points be P{p0, p1, p2, p3, ..., p n The x-coordinate array of the extreme points of the lower contour is Q{q0, q1, q2, q3, ..., q n The vertical projection extreme point array is M{m0, m1, m2, m3, ..., m n The three sets of local extreme points are subtracted from each other. The extreme points of the upper and lower contours whose differences are all less than the second threshold are the candidate upper segmentation points and candidate lower segmentation points.

[0058] S130. Determine effective segmentation points based on the geometric features of the individual characters and the candidate segmentation points, wherein the effective segmentation points include effective upper segmentation points and effective lower segmentation points.

[0059] Specifically, based on the maximum width W of a single character max and minimum width W minThe effective upper and lower segmentation points are filtered at the left and right endpoints of the upper contour plot, respectively, to obtain two sets of data for the effective upper segmentation points and two sets of data for the effective lower segmentation points. The segmentation points corresponding to the data with smaller variances are selected as the effective upper and lower segmentation points.

[0060] S140. Based on the above effective segmentation points, the above-mentioned contiguous characters are segmented using the dripping algorithm.

[0061] Specifically, the effective upper segmentation point is used as the starting drop point of the droplet algorithm, and the effective lower segmentation point is used as the seed point. When the ordinate of the starting drop point is less than the third threshold, the droplet is mainly subjected to gravity to segment the connected characters. When the ordinate of the starting drop point is greater than the third threshold, the droplet is subjected to the resultant force to segment the connected characters. When the ordinate of the starting drop point is equal to the third threshold, the droplet is translated to the position of the seed point to segment the connected characters.

[0062] In summary, this embodiment's method of identifying adhered regions by statistically analyzing the geometric features of individual characters is more accurate. Furthermore, by using the vertical projection map, upper contour map, and lower contour map of the adhered region, along with the geometric features of individual characters, to filter segmentation points twice, the segmentation points better reflect the actual characteristics of adhered characters. Additionally, improvements have been made to the seed method of the dripping algorithm, preventing the initial dripping point from being located in a recessed area of ​​the character or inside the character, thus avoiding incorrect segmentation. This makes the method for segmenting adhered characters more accurate.

[0063] In some examples, the above-mentioned determination of adhesion regions based on the geometric features of a single character includes:

[0064] Geometric features of row strings and / or column strings in the above image are obtained using the contour connected component detection method;

[0065] The region corresponding to the row string and / or column string whose geometric features exceed a preset threshold is the aforementioned adhesion region. The preset threshold is determined by the geometric features of the aforementioned individual character.

[0066] Specifically, the image undergoes contour connectivity detection. Based on prior conditions such as the area, width, and height of the minimum bounding box of the connected components, row and column bounding boxes are determined. Adjacent row (or column) bounding boxes are merged, resulting in row strings and / or the aforementioned column strings. The row strings (column strings rotated 90 degrees) are then horizontally projected into single rows. Contours are detected again, and bounding boxes are drawn. If the following formula is satisfied, the region is considered a connected region:

[0067]

[0068] Where A represents the area of ​​the rectangle, W represents the width of the rectangle, and H represents the height of the rectangle. The coefficients 60, 0.8, and 1.5 in the formula are set according to the characteristics of the characters in the image to meet the requirements of the characters in the image. For example, if the characters in the image are generally large, the threshold in the formula can be increased to meet the actual situation of the image.

[0069] In summary, by comprehensively judging the area, width, height, and aspect ratio of the circumscribed rectangle using the contour connected component detection method, it is possible to more accurately determine whether a region is a connected region.

[0070] In some examples, determining candidate segmentation points for the adhesion region based on its vertical projection, upper contour, and lower contour maps includes:

[0071] Based on the vertical projection map, upper contour map and lower contour map of the above-mentioned adhesion region, the extreme point coordinate set is obtained. The extreme point coordinate set includes the extreme point coordinates of the vertical projection map, the extreme point coordinates of the upper contour map and the extreme point coordinates of the lower contour map.

[0072] The points whose element differences in the above extreme point coordinate set are less than a preset value are selected as candidate segmentation points for the above-mentioned adhesion region.

[0073] Specifically, local extrema are calculated for the vertical projection, upper contour, and lower contour respectively. Depth thresholds are set on the left and right sides of the local extrema points to obtain the extrema points of the upper contour, lower contour, and vertical projection. Let the x-coordinate array of the upper contour extrema points be P{p0,p1,p2,p... 3…… ,p n The x-coordinate array of the extreme points of the lower contour is Q{q0,q1,q2,q...} 3…… ,q n The vertical projection extreme point array is M{m0,m1,m2,m...} 3…… ,m n The three sets of local extreme points are mutually screened to obtain candidate upper and lower dividing points, i.e., if p i and q i If the following formula is satisfied simultaneously, then p is considered to be... i and q i The coordinates of the corresponding extreme points are the candidate upper and lower dividing points.

[0074]

[0075] It is understandable that the 5 in the formula can be adjusted according to the size of the characters in the image.

[0076] In summary, by using the vertical projection and the fact that the difference between each pair of the upper and lower contours is less than a preset value as the judgment condition, most of the pseudo-projection extreme points of the upper and lower contours can be filtered out.

[0077] In some examples, the determination of effective segmentation points based on the geometric features of the individual characters and the candidate segmentation points includes:

[0078] Based on the geometric features of the individual characters, the effective upper segmentation points are selected from the candidate upper segmentation points by choosing the segmentation points with smaller variances corresponding to the left or right endpoints of the adhesion region.

[0079] Based on the geometric features of the individual characters, the effective lower segmentation points are selected from the candidate lower segmentation points, with the left or right endpoints of the adhesion region having smaller variances.

[0080] Specifically, based on the character width, the variance of candidate segmentation points, and the correspondence between upper and lower segmentation points, the effective upper and lower segmentation points of the adhering characters are determined, and the maximum width W in the geometric features of a single character is used as the basis for this determination. max and minimum width W min Filter candidate split points by performing the following steps: filtering from left to right and from right to left. Let the x-coordinates of a set of candidate split points be x{x0, x1, x2, x3, ..., x...}. n The formula for filtering from left to right is as follows:

[0081]

[0082] Where, when j = 0, p j This represents the left endpoint of the region of contiguous characters; when j > 0, p j This represents the valid segmentation point obtained from the previous screening. d represents the error.

[0083] Similarly, the formula for filtering from right to left is as follows:

[0084]

[0085] Where, when j = 0, p j p represents the right endpoint of the contiguous character region; when j>0, p j This represents the valid segmentation point obtained from the previous screening. d represents the error.

[0086] The above formula yields two sets of upper candidate points and two sets of lower candidate points. The two sets with smaller variances are selected as the effective upper split points S{s0,s1,s2,s...} 3…… ,s n} and effective lower split point T{t0,t1,t2,t 3…… ,t n}

[0087] Based on the correspondence between the upper and lower dividing points, a final filtering step is performed to obtain the final valid upper and lower dividing points. Let num be the number of characters in the connected region, and its formula is as follows:

[0088]

[0089] Among them, w t h represents the width of the adhesion area. t Indicates the height of the adhesion area, X s This indicates the average aspect ratio.

[0090] The specific screening methods are divided into the following four types:

[0091] A: When one group has the same number of items as num-1 and the other group has a non-zero number of items, the group with the number of items num-1 remains unchanged and the other group is filtered. The difference between each pair of upper and lower dividing points does not exceed 5 pixels.

[0092] B: When the number of each group is not the same as num-1, and the number of each group is neither 0 nor different, the smaller array is selected to filter the larger array, and the difference between each pair of upper and lower dividing points does not exceed 10 pixels.

[0093] C: When neither of the two groups is the same as num-1, and one of the groups has a count of 0, then fill the array with a count of 0 based on the array with a count of non-zero.

[0094] D: If both groups have the same number of elements as num-1 and neither is 1, then mutual filtering is performed. The difference between each pair of upper and lower dividing points does not exceed 5 pixels.

[0095] In summary, this embodiment selects a set of effective upper and lower segmentation points based on two methods: left-to-right and right-to-left. This avoids the phenomenon of incorrect segmentation caused by the initial drop point being located in the recess or inside the character.

[0096] In some examples, the above-mentioned effective segmentation points and dripping algorithm are used to segment the above-mentioned contiguous characters, including:

[0097] The above effective upper segmentation point is used as the starting drop point, and the above effective lower segmentation point is used as the seed point;

[0098] Based on the aforementioned starting drop point and seed point, the aforementioned dripping algorithm is used to segment the aforementioned contiguous characters.

[0099] Specifically, based on the filtering in the above embodiments, the upper segmentation point is taken as the starting drop point, and the effective lower segmentation point is taken as the seed point. The adhering characters are then segmented using the dripping algorithm.

[0100] Please see Figure 7 and Figure 8 ;

[0101] In some examples, segmenting the above-mentioned connected characters using the above-mentioned dripping algorithm based on the above-mentioned starting dripping point and the above-mentioned seed point includes:

[0102] When the ordinate of the above-mentioned starting dripping point is less than half of the ordinate of the above-mentioned seed point, the water droplet mainly acts under the action of gravity to segment the above-mentioned connected characters;

[0103] When the ordinate of the above-mentioned starting dripping point is greater than half of the ordinate of the above-mentioned seed point, the above-mentioned water droplet acts under the action of the resultant force to segment the above-mentioned connected characters;

[0104] When the ordinate of the above-mentioned starting dripping point is equal to the ordinate of the above-mentioned seed point, the above-mentioned water droplet translates to the position where the above-mentioned seed point is located to segment the above-mentioned connected characters.

[0105] Specifically, in Figure 7 and Figure 8 y0 is the ordinate of the current water droplet, cony is the ordinate of the effective lower segmentation point; x0 is the abscissa of the current water droplet, conx is the abscissa of the effective lower water segmentation point, && represents and, the * symbol represents that it may be a black pixel or a white pixel, b represents a black pixel, and w represents a white pixel.

[0106] Assume that (x0, y0) is the position of the current water droplet, that is, the upper segmentation point position, and the seed point position is (x1, y1), that is, the lower segmentation point position. Select the dripping method of the water droplet according to the distance between the current water droplet position and the seed point. There are three dripping methods as follows:

[0107] The following y1 is cony in the figure, and x1 is conx in the figure.

[0108] The first case: When 0 ≤ y0 < 0.5 * y1, the water droplet mainly acts under the action of gravity. Please refer to Figure 7 .

[0109] When x0 > x1, with the lower left as the guiding direction, if (x0, y0 + 1) is a white pixel, the water droplet will directly drip downward; if (x0, y0 + 1) is a black pixel, it will successively take the lower left, lower right, left, and right as the next water droplet position.

[0110] When x0 = x1, it is only under the action of gravity. Because at this time, the guiding point and the water droplet point are in the same column and are not guided by any direction.

[0111] When x0 < x1, with the lower right as the guiding direction. If (x0, y0 + 1) is a white pixel, the water droplet will directly drip downward; if (x0, y0 + 1) is a black pixel, it will successively take the lower right, lower left, right, and left as the next water droplet position.

[0112] Among them, when a water droplet falls into a character depression, i.e., a local extremum, the corresponding processing is as follows: In cases (a), (b), and (c), if cases (4) and (5) appear alternately, it should transfer from a(4) to b(6), b(4) to b(6), and c(4) to b(6).

[0113] The second case: When 0.5*y1 ≤ y0 < y1, the water droplet is under the action of the combined force. Please refer to Figure 8 .

[0114] When x0 > x1, the direction of the combined force is lower left; if (x0 + 1, y0 + 1) is a white pixel, the water droplet will directly drip in the lower left direction; if (x0 + 1, y0 + 1) is a black pixel, then it will successively take down, lower right, left, and right as the next water droplet position.

[0115] When x0 = x1, the direction of the combined force is downward, maintaining the same motion rule as when only under the action of gravity.

[0116] When x0 < x1, the direction of the combined force is lower right. If (x0 - 1, y0 - 1) is a white pixel, the water droplet will directly drip in the lower left direction; if (x0 - 1, y0 - 1) is a black pixel, then it will successively take down, lower left, right, and left as the next water droplet position.

[0117] Among them, when a water droplet falls into a character depression, i.e., a local extremum, the corresponding processing is as follows: When the water droplet shows continuous alternation of a(4) → b(5) → a(4), it should transfer from a(4) to (a)6; when the water droplet shows continuous alternation of a(4) → a(5) → a(6) or a(5) → a(4) → a(5), it should transfer from a(4) to (a)6; when the water droplet shows continuous alternation of b(4) → a(5) → b(4) or b(5) → c(5) → b(5), it should transfer from b(4) or b(5) to b(6); when the water droplet shows continuous alternation of c(4) → b(5) → c(4), it should transfer from c(4) to c(6); when the water droplet shows continuous alternation of c(4) → c(5) → c(4) or c(5) → c(4) → c(5), it should transfer from c(4) to c(6).

[0118] The third case: When y0 = y1, the water droplet translates to the seed point position.

[0119] In summary, by narrowing the gravitational range to improve the accuracy of segmentation, the direction of the water droplet under the action of gravity is the first choice direction, and the position of the seed point only serves as a guiding direction, avoiding the water droplet from generating a skew path to approach the seed point position and causing incorrect segmentation.

[0120] In some examples, the above method further includes:

[0121] Obtain the binarized image of the above image;

[0122] Geometric features of individual characters in the aforementioned binarized image are obtained using the contour connected component detection method.

[0123] Specifically, a binary image is an image in which every pixel is either black or white. Binary images are convenient for describing character features. It can be understood that the method for binarizing an image can be any one of the following: OpenCV binary method, Huang thresholding method, iterative method, or InterModes thresholding method.

[0124] In summary, binarized images can effectively represent character information while saving space and improving recognition speed.

[0125] In another embodiment, a method for segmenting characters adhering to an image on the surface of an IC chip is provided. Please refer to [link / reference]. Figures 2-9 ;

[0126] like Figure 2 As shown, the contrast and brightness of the IC chip surface image collected from the industrial site are processed, and then the image is binarized to improve the brightness and remove invalid information. In order to accurately obtain the character width, the image is scaled. The resulting image may contain a lot of noise, which is often detrimental to character segmentation, so median filtering is applied to the image. Finally, to prevent broken characters from affecting the character width statistics, the image is dilated.

[0127] Contour detection is performed on the white pixels in the preprocessed chip surface image to detect connected components and construct the minimum bounding rectangle for each contour. The bounding rectangles in the image are then filtered to locate the characters in the target image. Based on the characteristics of characters printed on the chip surface, rectangles with an aspect ratio between [0.4, 0.95] are considered normal characters. The average aspect ratio, width, and height of the normal characters are calculated and used as the aspect ratio X of the standard characters. s Width X w and height X h At the same time, the minimum character width W is obtained. min and maximum character width W max .

[0128] like Figure 3 As shown, contour connectivity detection is performed on the expanded chip surface image. Based on prior conditions such as the area, width, and height of the minimum bounding rectangle of the connected component, a row and column judgment process is performed, i.e., the judgment of row and column rectangles. Adjacent row and column rectangles are merged to obtain the row and column character regions. The row characters (column characters rotated 90 degrees) are horizontally projected, and contour connectivity is detected again. If the following formula condition is met, the characters are considered to be connected.

[0129]

[0130] Where: A represents the area of ​​the rectangle, W represents the width of the rectangle, and H represents the height of the rectangle.

[0131] To obtain the vertical projection, upper contour, and lower contour of a binary image, such as... Figure 4 As shown. Local maxima are found for the vertical projection and upper contour maps, and local minima are found for the lower contour map. The local range of the local extrema is set to 6 pixels to the left and right, thus obtaining... Figure 5 The local extreme points are candidate upper and lower segmentation points. The three sets of local extreme points are mutually screened to obtain candidate upper and lower segmentation points. That is, extreme points that simultaneously meet the following three conditions are used as candidate upper and lower segmentation points: the difference between the upper contour extreme point and the lower contour extreme point is no more than 5 pixels, the difference between the upper contour extreme point and the vertical projection extreme point is no more than 5 pixels, and the difference between the vertical projection extreme point and the lower contour extreme point is no more than 5 pixels. Figure 5 The point indicated by the straight line in the diagram is the candidate upper and lower dividing point.

[0132] Let num be the number of connected characters in the connected region, then the number of dividing points is num-1. Therefore, the average character width of the connected region is MeanWidth = w. t / num, where num is calculated using the following formula:

[0133]

[0134] Where: w t h represents the width of the adhesion area. t This indicates the height of the adhesion area.

[0135] Starting from both left and right ends and moving towards the other end, effective segmentation points are determined based on the character width. The variance of these two sets of segmentation points is calculated, and the set with the smaller variance is selected as the candidate upper and lower segmentation points. Using the one-to-one correspondence between the upper and lower segmentation points, the final effective segmentation points are obtained. Figure 6 The point pointed to by the straight line in the diagram is a valid cut point.

[0136] exist Figure 7 and Figure 8 In the diagram, y0 is the current vertical coordinate of the water droplet, cony is the vertical coordinate of the effective lower segmentation point, x0 is the current horizontal coordinate of the water droplet, conx is the horizontal coordinate of the effective lower segmentation point, && means AND, * indicates that it may be a black pixel or a white pixel, b represents a black pixel, and w represents a white pixel.

[0137] In the diagram below, y1 is cony and x1 is conx.

[0138] When the water droplet is not within the gravitational influence range of the lower dividing point, it is mainly affected by gravity, with the lower dividing point primarily acting as a directional guide. When the droplet enters the influence range of the lower dividing point, it is affected by both the gravitational force of the lower dividing point and gravity. Assume (x0, y0) is the current position of the water droplet, the lower dividing point is at (x1, y1), and the gravitational force of the lower dividing point ranges from 0.5y1 to y1. Therefore, when y0 is less than 0.5y1, the droplet's motion follows the rules as follows: Figure 7 As shown, when a water droplet falls into the recessed area of ​​a character, i.e., a local extremum, the corresponding processing is as follows: when the water droplet alternates between a(4)→a(5)→a(4), it should switch from a(4) to b(6); when the water droplet alternates between b(4)→b(5)→b(4), it should switch from b(4) to b(6); when the water droplet alternates between c(4)→c(5)→c(4), it should switch from c(4) to b(6). When the water droplet enters the gravitational range, i.e., from 0.5y1 to y1, the movement rules of the water droplet are as follows. Figure 8 As shown, the dripping occurs according to the direction of the resultant force. When a water droplet falls into the recessed part of a character, i.e., a local extremum, the corresponding processing is as follows: When the water droplet alternates between a(4)→b(5)→a(4), it should switch from a(4) to (a)6; when the water droplet alternates between a(4)→a(5)→a(6) or a(5)→a(4)→a(5), it should switch from a(4) to (a)6; when the water droplet alternates between b(4)→a(5)→b(4) or b(5)→c(5)→b(5), it should switch from b(4) or b(5) to b(6); when the water droplet alternates between c(4)→b(5)→c(4), it should switch from c(4) to c(6); when the water droplet alternates between c(4)→c(5)→c(4) or c(5)→c(4)→c(5), it should switch from c(4) to c(6). When y0 = y1, the water droplet position is directly translated to the lower dividing point position.

[0139] To prevent under-segmentation of contiguous characters, a segmentation condition is set based on the character width. When the aspect ratio of the segmented image is greater than 1.5X... s If the formula is not satisfied, the segmentation path is obtained. For example... Figure 9 As shown, this method ultimately achieves accurate and effective segmentation of characters adhering to the chip surface image.

[0140] It is evident that the method for segmenting contiguous characters based on this embodiment can effectively segment contiguous characters in an image.

[0141] Please see Figure 10 One embodiment of the device for segmenting characters that are stuck together in an image in this application may include:

[0142] First determining unit 21: used to determine the adhesion region based on the geometric features of a single character, wherein the geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The aforementioned adhesive area includes the aforementioned adhesive characters;

[0143] The second determining unit 22 is used to determine candidate segmentation points of the adhesion region based on the vertical projection map, upper contour map and lower contour map of the adhesion region. The candidate segmentation points include candidate upper segmentation points and candidate lower segmentation points.

[0144] The third determining unit 23 is used to determine effective segmentation points based on the geometric features of the aforementioned single character and the aforementioned candidate segmentation points, wherein the aforementioned effective segmentation points include effective upper segmentation points and effective lower segmentation points;

[0145] Segmentation unit 24: used to segment the above-mentioned contiguous characters based on the above-mentioned effective segmentation points using the dripping algorithm.

[0146] like Figure 11 As shown, this application embodiment also provides an electronic device 300, including a memory 310, a processor 320, and a computer program 311 stored in the memory 320 and executable on the processor. When the processor 320 executes the computer program 311, it implements the steps of any of the methods for segmenting the sticky characters in the above-mentioned image.

[0147] Since the electronic device described in this embodiment is the device used to implement the segmentation device for adhering characters in an image according to the embodiment of this application, those skilled in the art can understand the specific implementation method and various variations of the electronic device in this embodiment based on the method described in the embodiment of this application. Therefore, how the electronic device implements the method in the embodiment of this application will not be described in detail here. Any device used by those skilled in the art to implement the method in the embodiment of this application is within the scope of protection of this application.

[0148] In practical implementation, when the computer program 311 is executed by the processor, it can achieve the following: Figure 1 Any of the corresponding implementation methods in the embodiments.

[0149] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0150] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0151] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0152] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0153] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0154] This application also provides a computer program product, which includes computer software instructions that, when executed on a processing device, cause the processing device to perform actions such as... Figure 1 The process of segmenting connected characters in the image in the corresponding embodiment.

[0155] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0156] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0157] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or indirect coupling or communication connection between apparatuses or units, and may be electrical, mechanical, or other forms.

[0158] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0159] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0160] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0161] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for segmenting connected characters in an image, characterized in that, The method includes: Adhesion regions are determined based on the geometric features of individual characters, wherein the geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The adhesion area includes the adhesion characters; Based on the vertical projection, upper contour, and lower contour of the adhesion region, candidate segmentation points of the adhesion region are determined, including candidate upper segmentation points and candidate lower segmentation points. Valid segmentation points are determined by the geometric features of the individual character and the candidate segmentation points, wherein the valid segmentation points include valid upper segmentation points and valid lower segmentation points; The step of determining effective segmentation points using the geometric features of the individual character and the candidate segmentation points includes: Based on the geometric features of the individual character, the effective upper segmentation point is selected from the candidate upper segmentation points by choosing the segmentation point with the smaller variance corresponding to the left or right endpoint of the adhesion region. Based on the geometric features of the individual character, the effective lower segmentation point is selected from the candidate lower segmentation points by choosing the segmentation point with the smaller variance corresponding to the left or right endpoint of the adhesion region. The effective upper and lower segmentation points are filtered based on the number of characters in the adhered region (num) to obtain the final effective upper and lower segmentation points. The number of characters in the adhered region is calculated using the formula num = w. t / (h t ×X s ) Calculate, w t h represents the width of the adhesion area. t Indicates the height of the adhesion area, X s Indicates the average aspect ratio; The screening process includes the following rules: When there is a set of segmentation points with the same number of points as num-1 and another set of segmentation points has a number of points other than 0, the set with the number of points num-1 remains unchanged and the other set is filtered, with each pair of upper and lower segmentation points differing by no more than 10 pixels. When the number of dividing points in both groups is not the same as num-1 and the number of dividing points in both groups is not zero and they are different from each other, select the array with the smaller number of dividing points to filter the array with the larger number of dividing points, and the difference between each pair of upper and lower dividing points shall not exceed 10 pixels. When neither of the two sets of split points is the same as num-1, and one set has 0 split points, fill the zero array with split points based on the non-zero array; When the number of segmentation points in both groups is the same as num-1 and they are not single points, they are mutually filtered, and the difference between each pair of upper and lower segmentation points does not exceed 5 pixels. Based on the effective segmentation points, the adhering characters are segmented using the dripping algorithm.

2. The method as described in claim 1, characterized in that, The determination of the adhesion region based on the geometric features of a single character includes: Geometric features of the row and / or column strings of the image are obtained using the contour connected component detection method; The region corresponding to the row string and / or column string whose geometric features exceed a preset threshold is the adhesion region, and the preset threshold is determined by the geometric features of the individual character.

3. The method as described in claim 1, characterized in that, The step of determining candidate segmentation points for the adhesion region based on its vertical projection, upper contour, and lower contour views includes: An extreme point coordinate set is obtained based on the vertical projection map, upper contour map, and lower contour map of the adhesion region. The extreme point coordinate set includes the extreme point coordinates of the vertical projection map, the extreme point coordinates of the upper contour map, and the extreme point coordinates of the lower contour map. The points whose difference between the elements in the extreme point coordinate set is less than a preset value are selected as candidate segmentation points for the adhesion region.

4. The method as described in claim 1, characterized in that, The segmentation of the contiguous characters based on the effective segmentation points and the dripping algorithm includes: The effective upper segmentation point is used as the starting drop point, and the effective lower segmentation point is used as the seed point; The adhering characters are segmented using the dripping algorithm based on the starting dripping point and the seed point.

5. The method as described in claim 4, characterized in that, The segmentation of the contiguous characters using the dripping algorithm based on the starting dripping point and the seed point includes: When the ordinate of the starting drop point is less than half the ordinate of the seed point, the water droplet is mainly affected by gravity to segment the sticky characters; When the ordinate of the starting drop point is greater than half the ordinate of the seed point, the water droplet is subjected to a resultant force to separate the sticky characters; When the ordinate of the starting droplet is equal to the ordinate of the seed point, the droplet is translated to the position of the seed point to segment the adhering characters.

6. The method as described in claim 1, characterized in that, The method further includes: Obtain the binarized image of the image; Geometric features of individual characters in the binarized image are obtained based on the contour connected component detection method.

7. A device for segmenting characters that are stuck together in an image, characterized in that, include: First determining unit: used to determine the adhesion region based on the geometric features of a single character, wherein the geometric features include: average width X w Average height X h Maximum width W max and minimum width W min The adhesion area includes the adhesion characters; The second determining unit is used to determine candidate segmentation points of the adhesion region based on the vertical projection map, upper contour map and lower contour map of the adhesion region, wherein the candidate segmentation points include candidate upper segmentation points and candidate lower segmentation points; The third determining unit is used to determine effective segmentation points based on the geometric features of the single character and the candidate segmentation points, wherein the effective segmentation points include effective upper segmentation points and effective lower segmentation points; The step of determining effective segmentation points using the geometric features of the individual character and the candidate segmentation points includes: Based on the geometric features of the individual character, the effective upper segmentation point is selected from the candidate upper segmentation points by choosing the segmentation point with the smaller variance corresponding to the left or right endpoint of the adhesion region. Based on the geometric features of the individual character, the effective lower segmentation point is selected from the candidate lower segmentation points by choosing the segmentation point with the smaller variance corresponding to the left or right endpoint of the adhesion region. The effective upper and lower segmentation points are filtered based on the number of characters in the adhered region (num) to obtain the final effective upper and lower segmentation points. The number of characters in the adhered region is calculated using the formula num = w. t / (h t ×X s ) Calculate, w t h represents the width of the adhesion area. t Indicates the height of the adhesion area, X s Indicates the average aspect ratio; The screening process includes the following rules: When there is a set of segmentation points with the same number of points as num-1 and another set of segmentation points has a number of points other than 0, the set with the number of points num-1 remains unchanged and the other set is filtered, with each pair of upper and lower segmentation points differing by no more than 10 pixels. When the number of dividing points in both groups is not the same as num-1 and the number of dividing points in both groups is not zero and they are different from each other, select the array with the smaller number of dividing points to filter the array with the larger number of dividing points, and the difference between each pair of upper and lower dividing points shall not exceed 10 pixels. When neither of the two sets of split points is the same as num-1, and one set has 0 split points, fill the zero array with split points based on the non-zero array; When the number of segmentation points in both groups is the same as num-1 and they are not single points, they are mutually filtered, and the difference between each pair of upper and lower segmentation points does not exceed 5 pixels. Segmentation unit: used to segment the contiguous characters based on the effective segmentation points using a dripping algorithm.

8. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program stored in the memory, implements the steps of the method for segmenting adhering characters in an image as claimed in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method for segmenting connected characters in an image as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Laser-induced thermal etching metal detonator coded character segmentation method based on image processing

    CN108960239A

  • Character-cutting method and device, compute device and storage medium

    CN109325492A