CN116798040A - Method, device, equipment and storage medium for cutting sticky characters - Google Patents

Method, device, equipment and storage medium for cutting sticky characters Download PDF

Info

Publication number
CN116798040A
CN116798040A CN202210725026.7A CN202210725026A CN116798040A CN 116798040 A CN116798040 A CN 116798040A CN 202210725026 A CN202210725026 A CN 202210725026A CN 116798040 A CN116798040 A CN 116798040A
Authority
CN
China
Prior art keywords
character image
point
path
vertex
weight
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.)
Pending
Application number
CN202210725026.7A
Other languages
Chinese (zh)
Inventor
丁娜
黄伟林
姚植元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202210725026.7A priority Critical patent/CN116798040A/en
Publication of CN116798040A publication Critical patent/CN116798040A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/15Cutting or merging image elements, e.g. region growing, watershed or clustering-based techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/18Extraction of features or characteristics of the image
    • G06V30/1801Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections
    • G06V30/18076Detecting partial patterns, e.g. edges or contours, or configurations, e.g. loops, corners, strokes or intersections by analysing connectivity, e.g. edge linking, connected component analysis or slices

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Character Input (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for segmenting sticky characters, wherein the method comprises the following steps: preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; constructing a second adhesion character image into a weighted undirected graph; constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first side, and the first weight is determined by the depth value of the valley and/or the peak of the path for constructing the second sticky character; and solving the minimum value of the energy function to obtain a segmentation result of the second adhesion character image. And the energy function for determining the weight of all sides of the weighted undirected graph is constructed by constructing a weighted undirected graph model of the second adhesion character image, the minimum solution of the energy function is obtained according to the maximum flow minimum cutting theorem, and then the dividing points are accurately positioned, so that the second adhesion character is accurately divided.

Description

Method, device, equipment and storage medium for cutting sticky characters
Technical Field
The present application relates to a character segmentation technique, and in particular, to a method, apparatus, device, and storage medium for adhering character segmentation.
Background
Character segmentation is a problem in the field of character recognition, and the occurrence of sticky handwritten characters makes the problem more urgent to solve. The current adhered character segmentation method comprises an iterative segmentation method, wherein the iterative segmentation method is to segment an image for as many times as possible based on foreground features, background features or combined features of the foreground and the background of an adhered character image, and an optimal segmentation mode is obtained based on a recognizer. However, the iterative segmentation method is excessively dependent on the selection of the identifier, and the quality of the identifier has a great influence on the performance of the segmentation method.
Disclosure of Invention
In order to solve the above technical problems, the present application is expected to provide a method, a device, an apparatus and a storage medium for sticky character segmentation.
The technical scheme of the application is realized as follows:
in a first aspect, there is provided a method of sticky character segmentation, the method comprising:
preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; wherein, all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph;
constructing the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point;
constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing characters in the second sticky character image; the area item of the energy function is used for determining a second weight of the second side, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label;
and solving the minimum value of the energy function to obtain a segmentation result of the second adhesion character image.
In the above scheme, the method further comprises:
when determining that a path for constructing characters in the second adhesion character image forms the valley, respectively acquiring pixel points which are positioned at the highest positions on two paths for forming the valley, namely a first pixel point and a second pixel point;
determining the distances between the lowest points of the valleys and the first pixel points and the second pixel points in the vertical direction respectively;
taking the shortest distance as the depth value of the valley;
and/or when determining that the paths for constructing the characters in the second adhesion character image form the convex peak, respectively acquiring the pixel points at the lowest positions on the two paths for forming the convex peak, namely a third pixel point and a fourth pixel point;
determining the distance between the highest point of the convex peak and the first pixel point and the distance between the highest point of the convex peak and the second pixel point in the vertical direction respectively;
and taking the shortest distance as the depth value of the convex peak.
In the above scheme, the first weight is a base number, and the e index is a power of a negative value of the depth value of the valley;
or, the first weight is the base, the e index is the power of the negative value of the depth value of the convex peak;
alternatively, the first weight is a base, and the e index is a power of a negative value of a sum of the depth value of the valley and the depth value of the peak.
In the above scheme, the method further comprises: acquiring N bifurcation points formed by the M paths; the bifurcation point is used as a reference, and pixel points which are positioned at the highest positions on all paths connected with the bifurcation point are searched along a first direction; searching the pixel points at the lowest positions on all paths connected with the bifurcation point along the second direction;
the determining a path for constructing characters in the second adhesion character image to form the valley includes:
when two pixel points are found along the first direction, determining a path for constructing characters in the second adhesion character image to form the valley;
and/or determining that the path for constructing the characters in the second adhesion character image forms the convex peak comprises the following steps:
and when two pixel points are found along the second direction, determining a path for constructing characters in the second adhesion character image to form the convex peak.
In the above scheme, the method further comprises:
acquiring the leftmost pixel point and the rightmost pixel point of the second adhesion character, and calculating a first distance between the leftmost pixel point and the rightmost pixel point;
calculating a second distance between the center point of each path and the leftmost pixel point, and calculating a ratio of the second distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the starting point label;
and calculating a third distance between the center point of each path and the rightmost pixel point, and calculating the ratio of the third distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the end point label.
In the above scheme, the second weight is the base number e, and the true number e is the inverse of the logarithm of the first probability; the first probability is the probability that the vertex is consistent with the starting point label;
or, the second weight is the base number e and the true number e is the inverse of the logarithm of the second probability; the second probability is a probability that the vertex is consistent with the end point label.
In the above scheme, the preprocessing the first adhesion character image to be segmented includes:
performing binarization processing and refinement processing on the first adhesion character image to obtain a third adhesion character image;
traversing all black pixel points of the third adhesion character image, and finding out P characteristic points; wherein the feature points include bifurcation points, or end points and bifurcation points;
and splitting characters in the third adhesion character image based on the P characteristic points to obtain the second adhesion character image constructed by M paths.
In a second aspect, there is provided an adhesive character segmentation apparatus, comprising:
the processing unit is used for preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; wherein, all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph;
the construction unit is used for constructing the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point;
the construction unit is also used for constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing the second sticky character; the area item of the energy function is used for determining a second weight of the second side, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label;
and the processing unit is also used for solving the minimum value of the energy function to obtain the segmentation result of the second adhesion character image.
In a third aspect, there is provided a sticky character segmentation apparatus comprising: a processor and a memory configured to store a computer program capable of running on the processor, wherein the processor is configured to perform the steps of the aforementioned method when the computer program is run.
In a fourth aspect, a computer readable storage medium is provided, on which a computer program is stored, wherein the computer program, when being executed by a processor, carries out the steps of the aforementioned method.
The application discloses a method, a device, equipment and a storage medium for segmenting adhered characters, wherein the method for segmenting adhered characters is to construct an energy function for determining weight values of all sides of a weighted undirected graph by constructing a weighted undirected graph model of a second adhered character image, obtain the minimum solution of the energy function according to the maximum flow minimum cutting theorem, further accurately position segmentation points and accurately segment the second adhered characters.
Drawings
FIG. 1 is a flow chart of a method for stuck character segmentation in an embodiment of the application;
FIG. 2 is a schematic diagram of preprocessing of a sticky character image "90" in an embodiment of the application;
FIG. 3 is a schematic diagram of a preprocessing flow for adhering character images in an embodiment of the present application;
FIG. 4 is a schematic diagram of two sides of a weighted undirected graph in accordance with an embodiment of the present application;
FIG. 5 is a graph showing the characteristics of the region term of the energy function in an embodiment of the present application;
FIG. 6 is a diagram showing boundary term characteristics in an embodiment of the present application;
FIG. 7 is a schematic diagram of a weighted undirected graph in accordance with an embodiment of the present application;
FIG. 8 is a schematic diagram of a process for segmenting sticky characters in an embodiment of the application;
FIG. 9 is a sample set of sticky character data in an embodiment of the application;
FIG. 10 is a graph showing the segmentation result of sticky characters in an embodiment of the present application;
FIG. 11 is a schematic diagram showing a structure of a device for adhering character segmentation according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a sticky character segmentation apparatus according to an embodiment of the application.
Detailed Description
For a more complete understanding of the nature and the technical content of the embodiments of the present application, reference should be made to the following detailed description of embodiments of the application, taken in conjunction with the accompanying drawings, which are meant to be illustrative only and not limiting of the embodiments of the application.
An embodiment of the present application provides a method for partitioning a sticky character, and fig. 1 is a first flow chart of the method for partitioning a sticky character in the embodiment of the present application, as shown in fig. 1, the method for partitioning a sticky character may specifically include:
step 101: preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph.
Fig. 2 is a schematic diagram illustrating preprocessing of the sticky character image "90", as shown in fig. 2, and fig. 2 (a) is an original image of the sticky character image "90", that is, a first sticky character image in an embodiment of the application; fig. 2 (d) is a second sticky character image constructed of 4 paths, i.e., path 1, path 2, path 3, and path 4, obtained by preprocessing fig. 2 (a).
In the embodiment of the application, all pixel points on one path share the same label and belong to the same category. One path corresponds to one vertex of the weighted undirected graph.
Namely, path 1, path 2, path 3, and path 4 correspond to vertex 1, vertex 2, vertex 3, and vertex 4, respectively, of the weighted undirected graph.
Fig. 3 is a schematic diagram of a process flow of adhering character images in an embodiment of the present application, as shown in fig. 3, step 101 may specifically include:
step 301: and performing binarization processing and refinement processing on the first adhesion character image to obtain a third adhesion character image.
Here, the binarization processing refers to a process of setting the gray value of the pixel of the foreground portion (i.e., the sticky character) on the image to 0 (i.e., black), setting the gray value of the pixel of the background portion to 255 (i.e., white), and displaying a clear black-and-white effect on the entire image. The binarization process greatly reduces the amount of data in the image, thereby highlighting the outline of the foreground portion (i.e., the sticky character).
Here, the refinement processing refers to processing the bold adhered characters in the image into skeleton characters with pixel width, so that redundant information in the image is removed, and basic frames and main characteristic information of the characters are reserved, thereby facilitating subsequent characteristic extraction and segmentation.
Illustratively, fig. 2 (a) is an original image of the sticky character image "90", i.e., a first sticky character image; the gray value of all pixel points of the sticky character image "90" in fig. 2 (a) is set to 0 (i.e., black), and is subjected to refinement processing, and the bold "90" is processed into a skeleton character of pixel width, i.e., a second sticky character image.
Step 302: traversing all black pixel points of the third adhesion character image, and finding out P characteristic points; wherein the feature points include bifurcation points, or end points and bifurcation points.
Traversing the number of black pixel points in the eight adjacent areas of the target black pixel point in all the black pixel points, and when the number of the black pixel points in the eight adjacent areas of the target black pixel point is equal to 1, the target pixel point is called an endpoint; when the sum of the numbers of black pixels in the eight neighborhood of the target black pixel is 3 or more, the target pixel is referred to as a bifurcation point.
By way of example, fig. 2 (c) shows 4 feature points found after traversing all black pixels of the third sticky character image, wherein the feature points include 3 bifurcation points a, b, and c, and 1 endpoint d.
The distance between adjacent feature points on a path is generally calculated, and when the distance is smaller than a preset distance threshold value, the adjacent feature points on the path are combined into a feature point. The bifurcation points b and c in fig. 2 (c) merge into one bifurcation point e, shown in fig. 2 (d).
Step 303: and splitting the characters in the third adhesion character image based on the P characteristic points to obtain a second adhesion character image constructed by M paths.
Illustratively, in fig. 2 (d), the two bifurcation points a and e and the end point d split the characters in the third sticky character image, so as to obtain a second sticky character image constructed by 4 paths, namely, path 1, path 2, path 3 and path 4.
Step 102: constructing the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point.
In the embodiment of the application, by constructing the weighted undirected graph model of the second adhesion character image, according to the maximum flow minimum cut theorem, the minimum cut is known to be equal to the maximum flow, and the minimum cut of the weighted undirected graph can be found by the maximum flow method, so that the second adhesion character image is segmented.
Where a cut is a subset C of the edge set E in the undirected graph, the cost of that cut (denoted as |c|) is the sum of the weights of all the edges of the edge subset C. The weights of the edges are determined by an energy function (described in more detail below).
Here, the weighted undirected graph g= (V, E, W) includes a vertex set V, an edge set E, and a weight set W of edges.
Wherein the vertex set V comprises two parts, defined as:
V=V′∪{S,T} (1)
v' denotes that each path corresponds to a set of vertices in the weighted undirected graph, namely path 1, path 2, path 3, and path 4 correspond to vertex 1, vertex 2, vertex 3, and vertex 4, respectively, of the weighted undirected graph. S represents the start of the weighted undirected graph and T represents the end of the weighted undirected graph. S belongs to a pixel set of a left character, and the label is 0; t belongs to the pixel set of the right character and the label is 1.
The edge set E includes two edges, the first edge being an edge between adjacent vertices in the vertex set V', called n-links, and in fig. 2 (d) path 1 is adjacent to path 2, path 2 is adjacent to path 3, path 4, respectively, path 3 is adjacent to path 4, so vertex 1 is connected to vertex 2, vertex 2 is connected to vertex 3, vertex 4, respectively, and vertex 3 is connected to vertex 4, as shown in fig. 4 (a). FIG. 4 is a schematic diagram of two sides of a weighted undirected graph in an embodiment of the present application, shown in FIG. 4 (a), and expressed mathematically as U { p, q }, p, q ε V'. The edge set of t-links is denoted epsilon.
The second type of edge is the edge of vertex 1, vertex 2, vertex 3, and vertex 4 in V 'that is connected to the start point S and end point T, respectively, and is called the T-links, i.e., as shown in FIG. 4 (b), the mathematical expressions U { p, S }, U { p, T }, p ε V'.
To sum up, the definition of edge set E is:
E=ε∪ p∈V′ {{p,S},{p,T}} (2)
the weight W of an edge is the process of assigning values to the edges t-links and n-links, and corresponds to the region term R (L) and the boundary term B (L) in the energy function respectively.
Step 103: constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing the second sticky character; the region term of the energy function is used for determining a second weight of the second edge, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label.
Here, it is assumed that labels of all vertices corresponding to the second sticky character image are l= u { L 1 ,l 2 ,…,l p -wherein, l i (i=1, 2, …, p) takes on the value 0 (left digit) or 1 (right digit).
Assuming that cut (cut) of the second sticky character image is L, the definition of the energy function is:
E(L)=λR(L)+B(L) (3)
where a cut is a subset C of the edge set E in the undirected graph, the cost of that cut (denoted as |c|) is the sum of the weights of all the edges of the edge subset C.
It should be noted that, in the embodiment of the present application, it is necessary to calculate the cut L of the second sticky character image, that is, a subset C of the edge set E in the undirected graph, where the disconnection of all edges in the subset C may disconnect the connection between the starting point S and the ending point T, that is, the left character and the right character of the sticky character are separated, so this edge subset is called "cut". If a cut has the smallest sum of all its edges, then this is called the smallest cut, i.e. the result of the graph cut.
Here, the energy function mainly includes two characteristic terms: region term R (L) and boundary term B (L).
Wherein the region term R (L) calculates that the vertex p is assigned to the label L p I.e. the vertex p belongs to the label L p The probability of (0 or 1), the greater the probability, the less energy. The boundary term B (L) calculates a penalty for discontinuities between adjacent pixels, the larger the difference between two adjacent pixels, the smaller the energy. λ is a balance factor between two feature terms, determining the extent to which the two features affect the segmentation.
Wherein the region term R (L) is defined as:
R(L)=∑ p∈P R p (L p ) (4)
wherein R is p (L p ) Indicating that vertex p belongs to label L p Is a probability of (2).
Illustratively, in some embodiments, the method further comprises:
acquiring the leftmost pixel point and the rightmost pixel point of the second adhesion character, and calculating a first distance between the leftmost pixel point and the rightmost pixel point;
calculating a second distance between the center point of each path and the leftmost pixel point, and calculating a ratio of the second distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the starting point label;
and calculating a third distance between the center point of each path and the rightmost pixel point, and calculating the ratio of the third distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the end point label.
FIG. 5 is a representation of the area term characteristics of the energy function in an embodiment of the present application, as shown in FIG. 5, looking up the leftmost edge of the second sticky characterPixel point and rightmost pixel point, x is used l And x r Respectively the horizontal positions of the leftmost pixel point and the rightmost pixel point, x r -x l The width of two consecutive numbers (i.e., first distance) is shown, x m Representing the horizontal position of the path center point.
The left character label is marked as 0 and the right character label is marked as 1. In the horizontal direction, by calculating the second distance x between the center point of each path and the leftmost pixel point m -x l And calculating the ratio of the second distance to the first distanceAnd calculating a third distance x between the pixel point and the rightmost pixel point r -x m And calculates the ratio of the third distance to the first distance +.>
The greater the probability (i.e., ratio), the less energy needs to be expended, i.e., the less the second weight, which, illustratively, in some embodiments, is the base e-true the inverse of the logarithm of the first probability; the first probability is the probability that the vertex is consistent with the starting point label;
or, the second weight is the base number e and the true number e is the inverse of the logarithm of the second probability; the second probability is a probability that the vertex is consistent with the end point label.
Here, the second weight of the t-links is calculated as follows:
the boundary term B (L) calculates the discontinuous penalty between adjacent pixel points, and the larger the difference between two adjacent pixel points is, the smaller the energy is.
The boundary term B (L) is defined as:
B(L)=∑ p,q∈N B <p,q> δ(L p ,L q ) (6)
wherein,,
B <p,q> penalty representing feature dissimilarity between adjacent vertices p and q, delta (L p ,L q ) The weight of the edge is calculated only when the labels of p and q belong to different categories, otherwise the weight is 0. In the segmentation problem of the sticky handwritten character, if two paths connected with the same bifurcation point can form a ' valley ' (as shown in fig. 6 (a)) or a ' peak ' (as shown in fig. 6 (B)), the second weight B of the second side is determined by calculating the depth value of the ' valley ' or the ' peak <p,q>
Illustratively, in some embodiments, the method further comprises:
when determining that a path for constructing characters in the second adhesion character image forms the valley, respectively acquiring pixel points which are positioned at the highest positions on two paths for forming the valley, namely a first pixel point and a second pixel point;
determining the distances between the lowest points of the valleys and the first pixel points and the second pixel points in the vertical direction respectively;
taking the shortest distance as the depth value of the valley;
and/or when determining that the path for constructing the second adhesion character forms the convex peak, respectively acquiring the pixel points at the lowest positions on the two paths forming the convex peak, namely a third pixel point and a fourth pixel point;
determining the distance between the highest point of the convex peak and the first pixel point and the distance between the highest point of the convex peak and the second pixel point in the vertical direction respectively;
and taking the shortest distance as the depth value of the convex peak.
FIG. 6 is a diagram showing boundary features of the embodiment of the present application, wherein the paths 2 and 4 form a valley, and the lowest point of the valley, i.e. the bifurcation point e, is shown in FIG. 6 (a), and the paths 2 and 4 forming the valley are obtainedThe vertical position of the bifurcation point e at the highest pixel point, namely the first pixel point and the second pixel point is marked as y c The vertical positions of the first pixel point and the second pixel point are respectively marked as y A And y B Calculate y c Respectively with y A And y B The depth value, which is the distance in the vertical direction, is the shortest distance. Depth value h of valley 1 Is expressed as:
h 1 =y c -min(y A ,y B ) (8)
as shown in fig. 6 (b), the path 3 and the path 4 form a convex peak, and the highest point of the convex peak is a bifurcation point e, and the pixel points of the path 3 and the path 4 forming the convex peak at the lowest position, namely a third pixel point and a fourth pixel point, are obtained, and the vertical position of the bifurcation point e is marked as y c The vertical positions of the third pixel point and the fourth pixel point are respectively marked as y A And y B Calculate y c Respectively with y A And y B The depth value, which is the distance in the vertical direction, is the shortest distance. Depth value h of convex peak 2 Is expressed as:
h 2 =max(y A ,y B )-y c (9)
the greater the depth value, i.e., the greater the likelihood of feature dissimilarity between adjacent vertices p and q, the less energy needs to be expended, i.e., the smaller the first weight, which, in some embodiments,
the first weight is the base, the e index is the power of the negative value of the depth value of the valley;
or, the first weight is the base, the e index is the power of the negative value of the depth value of the convex peak;
alternatively, the first weight is a base, and the e index is a power of a negative value of a sum of the depth value of the valley and the depth value of the peak.
Here, the first weight of the n-links is calculated as follows:
B <p,q> =exp(-(h 1 +h 2 )) (10)
illustratively, in some embodiments, the method further comprises: acquiring N bifurcation points formed by the M paths; the bifurcation point is used as a reference, and pixel points which are positioned at the highest positions on all paths connected with the bifurcation point are searched along a first direction; searching the pixel points at the lowest positions on all paths connected with the bifurcation point along the second direction;
the determining a path for constructing characters in the second adhesion character image to form the valley includes:
when two pixel points are found along the first direction, determining a path for constructing characters in the second adhesion character image to form the valley;
and/or determining that the path for constructing the characters in the second adhesion character image forms the convex peak comprises the following steps:
and when two pixel points are found along the second direction, determining a path for constructing characters in the second adhesion character image to form the convex peak.
By way of example, 2 bifurcation points a and e and 1 endpoint d are shown in fig. 2 (d). Searching the pixel point y at the highest position on all paths (namely the path 2 and the path 4) connected with the bifurcation point e along the first direction (namely upwards) by taking the bifurcation point e as a reference A And y B That is, it is determined that there are two pixel points, so it is determined that the path 2 and the path 4 form a valley. Finding the pixel point y at the lowest position on all paths (i.e., path 3 and path 4) connected to the bifurcation point e in the second direction (i.e., downward) A And y B That is, it is determined that there are two pixel points, so it is determined that the path 3 and the path 4 form a convex peak. Whether all paths connected to the bifurcation point a form valleys and/or peaks is searched, and the above scheme is not described.
Calculating a first weight B of a first edge with a vertex connected with a starting point S or an ending point T according to an energy function <p,q> And a second weight R of a second edge connected between adjacent vertices p (L p ) Labeling it on the corresponding side. Here, fig. 7 is a schematic diagram of a weighted undirected graph in an embodiment of the present application, that is, a weighted undirected graph constructed according to the second sticky character image.
Step 104: and solving the minimum value of the energy function to obtain a segmentation result of the first adhesion character image.
FIG. 8 is a schematic diagram of a process for segmenting a sticky character in an embodiment of the present application, as shown in FIG. 8, by solving the minimum value of the energy function, a segment L { (1, T), (2, T), (3, T), (4, S) } (as shown by the dotted line in the middle of FIG. 8 (a)) is obtained, that is, edges between vertex 1 and T, vertex 2 and T, vertex 3 and T, and vertex 4 and S are cut off. Correspondingly, the labels of the vertex 1, the vertex 2 and the vertex 3 are consistent with the label of the starting point S, and the label of the vertex 4 is consistent with the label of the end point T, so that the bifurcation point of the path 2, the path 3 and the path 4 is the division point of "90" (shown in fig. 8 (b)). Finally, the segmented character is restored to the original character, i.e., fig. 8 (c).
Here, the execution subject of steps 101 to 104 may be a processor of the sticky character segmentation apparatus.
The application discloses a method, a device, equipment and a storage medium for segmenting adhered characters, wherein the method for segmenting adhered characters is to construct an energy function for determining weight values of all sides of a weighted undirected graph by constructing a weighted undirected graph model of a second adhered character image, obtain the minimum solution of the energy function according to the maximum flow minimum cutting theorem, further accurately position segmentation points and accurately segment the second adhered characters.
Based on the above-described embodiment, in order to verify the effectiveness of the sticky character segmentation method of the present application, experimental verification was performed using the NIST specific database 19 (NIST Special Database, NIST sd 19) dataset. FIG. 9 is a sample set of sticky character data, as shown in FIG. 9, presenting a sample of partially sticky handwritten characters, specifically for evaluating the accuracy of the sticky character segmentation disclosed in the present application.
Fig. 10 is a segmentation result of the sticky character in the embodiment of the present application, and as shown in fig. 10, the segmentation result of a part of the samples in fig. 9 is shown, and it is obvious that the sticky character segmentation method of the present application has a good segmentation effect. The method can accurately divide the number strings (such as 00, 03, 17, 32 and the like) with simple structures, such as fewer adhesion parts, no closed loops or fewer loops and the like, or the number strings (such as 14, 28, 68, 96 and the like) with more adhesion parts, complicated structures, such as loops or multiple branches and the like. The segmentation accuracy of the sticky character segmentation can reach 96.8%.
In order to implement the method of the embodiment of the present application, based on the same inventive concept, the embodiment of the present application further provides a sticky character segmentation apparatus, and fig. 11 is a schematic structural diagram of a sticky character segmentation apparatus according to the embodiment of the present application, as shown in fig. 11, where the sticky character segmentation apparatus 110 includes:
a processing unit 1101, configured to pre-process the first sticky character image, to obtain a second sticky character image constructed by M paths; wherein, all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph;
a construction unit 1102, configured to construct the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point;
the construction unit 1102 is further configured to construct an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing the second sticky character; the area item of the energy function is used for determining a second weight of the second side, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label;
the processing unit 1101 is further configured to solve a minimum value of the energy function, to obtain a segmentation result of the second sticky character image.
The application discloses a method, a device, equipment and a storage medium for segmenting adhered characters, wherein the method for segmenting adhered characters is to construct an energy function for determining weight values of all sides of a weighted undirected graph by constructing a weighted undirected graph model of a second adhered character image, obtain the minimum solution of the energy function according to the maximum flow minimum cutting theorem, further accurately position segmentation points and accurately segment the second adhered characters.
In some embodiments, the method further includes a determining unit, configured to determine that when a path for constructing characters in the second sticky character image forms the valley, respectively obtain a pixel point at a highest position on two paths forming the valley, that is, a first pixel point and a second pixel point;
determining the distances between the lowest points of the valleys and the first pixel points and the second pixel points in the vertical direction respectively;
taking the shortest distance as the depth value of the valley;
and/or when determining that the path for constructing the second adhesion character forms the convex peak, respectively acquiring the pixel points at the lowest positions on the two paths forming the convex peak, namely a third pixel point and a fourth pixel point;
determining the distance between the highest point of the convex peak and the first pixel point and the distance between the highest point of the convex peak and the second pixel point in the vertical direction respectively;
and taking the shortest distance as the depth value of the convex peak.
In some embodiments, the first weight is a base number, e, an exponent being a power of a negative value of the depth value of the valley;
or, the first weight is the base, the e index is the power of the negative value of the depth value of the convex peak;
alternatively, the first weight is a base, and the e index is a power of a negative value of a sum of the depth value of the valley and the depth value of the peak.
In some embodiments, the system further comprises an acquisition unit, configured to acquire N bifurcation points formed by the M paths; the bifurcation point is used as a reference, and pixel points which are positioned at the highest positions on all paths connected with the bifurcation point are searched along a first direction; searching the pixel points at the lowest positions on all paths connected with the bifurcation point along the second direction; the determining unit is specifically configured to determine that a path for constructing characters in the second adhesion character image forms the valley when two pixel points are found along the first direction;
and/or determining to construct a path of the characters in the second adhesion character image to form the convex peak when two pixel points are found along the second direction.
In some embodiments, the obtaining unit is further configured to obtain a leftmost pixel point and a rightmost pixel point of the second sticky character, and calculate a first distance between the leftmost pixel point and the rightmost pixel point;
calculating a second distance between the center point of each path and the leftmost pixel point, and calculating a ratio of the second distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the starting point label;
and calculating a third distance between the center point of each path and the rightmost pixel point, and calculating the ratio of the third distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the end point label.
In some embodiments, the second weight is the base number e true number the inverse of the logarithm of the first probability; the first probability is the probability that the vertex is consistent with the starting point label;
or, the second weight is the base number e and the true number e is the inverse of the logarithm of the second probability; the second probability is a probability that the vertex is consistent with the end point label.
In some embodiments, the processing unit 1101 is specifically configured to perform binarization processing and refinement processing on the first sticky character image, so as to obtain a third sticky character image;
traversing all black pixel points of the third adhesion character image, and finding out P characteristic points; wherein the feature points include bifurcation points, or end points and bifurcation points;
and splitting characters in the third adhesion character image based on the P characteristic points to obtain the second adhesion character image constructed by M paths.
The embodiment of the present application further provides another sticky character segmentation apparatus, and fig. 12 is a schematic structural diagram of a sticky character segmentation apparatus according to an embodiment of the present application, as shown in fig. 12, the sticky character segmentation apparatus 120 includes: a processor 1201 and a memory 1202 configured to store a computer program capable of running on the processor;
wherein the processor 1201 is configured to execute the method steps of the foregoing embodiments when running a computer program.
Of course, in practice, as shown in FIG. 12, the various components of the adhesive character segmentation apparatus are coupled together via a bus system 1203. It is appreciated that the bus system 1203 is configured to facilitate coupled communication between the components. The bus system 1203 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration, the various buses are labeled as bus system 1203 in fig. 12.
In practical applications, the processor may be at least one of an application specific integrated circuit (ASIC, application Specific Integrated Circuit), a digital signal processing device (DSPD, digital Signal Processing Device), a programmable logic device (PLD, programmable Logic Device), a Field-programmable gate array (Field-Programmable Gate Array, FPGA), a controller, a microcontroller, and a microprocessor. It will be appreciated that the electronics for implementing the above-described processor functions may be other for different devices, and embodiments of the present application are not particularly limited.
The Memory may be a volatile Memory (RAM) such as Random-Access Memory; or a nonvolatile Memory (non-volatile Memory), such as a Read-Only Memory (ROM), a flash Memory (flash Memory), a Hard Disk (HDD) or a Solid State Drive (SSD); or a combination of the above types of memories and provide instructions and data to the processor.
In an exemplary embodiment, the present application also provides a computer-readable storage medium storing a computer program.
Optionally, the computer readable storage medium may be applied to any one of the methods in the embodiments of the present application, and the computer program causes a computer to execute a corresponding flow implemented by a processor in each method in the embodiments of the present application, which is not described herein for brevity.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing module, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units. Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware associated with program instructions, where the foregoing program may be stored in a computer readable storage medium, and when executed, the program performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, or the like, which can store program codes.
The methods disclosed in the method embodiments provided by the application can be arbitrarily combined under the condition of no conflict to obtain a new method embodiment.
The features disclosed in the several product embodiments provided by the application can be combined arbitrarily under the condition of no conflict to obtain new product embodiments.
The features disclosed in the embodiments of the method or the apparatus provided by the application can be arbitrarily combined without conflict to obtain new embodiments of the method or the apparatus.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of sticky character segmentation, the method comprising:
preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; wherein, all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph;
constructing the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point;
constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing characters in the second sticky character image; the area item of the energy function is used for determining a second weight of the second side, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label;
and solving the minimum value of the energy function to obtain a segmentation result of the second adhesion character image.
2. The method according to claim 1, wherein the method further comprises:
when determining that a path for constructing characters in the second adhesion character image forms the valley, respectively acquiring pixel points which are positioned at the highest positions on two paths for forming the valley, namely a first pixel point and a second pixel point;
determining the distances between the lowest points of the valleys and the first pixel points and the second pixel points in the vertical direction respectively;
taking the shortest distance as the depth value of the valley;
and/or when determining that the paths for constructing the characters in the second adhesion character image form the convex peak, respectively acquiring the pixel points at the lowest positions on the two paths for forming the convex peak, namely a third pixel point and a fourth pixel point;
determining the distance between the highest point of the convex peak and the first pixel point and the distance between the highest point of the convex peak and the second pixel point in the vertical direction respectively;
and taking the shortest distance as the depth value of the convex peak.
3. The method according to claim 2, wherein the method further comprises: acquiring N bifurcation points formed by the M paths; the bifurcation point is used as a reference, and pixel points which are positioned at the highest positions on all paths connected with the bifurcation point are searched along a first direction; searching the pixel points at the lowest positions on all paths connected with the bifurcation point along the second direction;
the determining a path for constructing characters in the second adhesion character image to form the valley includes:
when two pixel points are found along the first direction, determining a path for constructing characters in the second adhesion character image to form the valley;
and/or determining that the path for constructing the characters in the second adhesion character image forms the convex peak comprises the following steps:
and when two pixel points are found along the second direction, determining a path for constructing characters in the second adhesion character image to form the convex peak.
4. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the first weight is the base, the e index is the power of the negative value of the depth value of the valley;
or, the first weight is the base, the e index is the power of the negative value of the depth value of the convex peak;
alternatively, the first weight is a base, and the e index is a power of a negative value of a sum of the depth value of the valley and the depth value of the peak.
5. The method according to claim 1, wherein the method further comprises:
acquiring the leftmost pixel point and the rightmost pixel point of the second adhesion character, and calculating a first distance between the leftmost pixel point and the rightmost pixel point;
calculating a second distance between the center point of each path and the leftmost pixel point, and calculating a ratio of the second distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the starting point label;
and calculating a third distance between the center point of each path and the rightmost pixel point, and calculating the ratio of the third distance to the first distance to obtain the probability that the vertex corresponding to each path is consistent with the end point label.
6. The method of claim 1, wherein the step of determining the position of the substrate comprises,
the second weight is the base number e, and the true number e is the reciprocal of the logarithm of the first probability; the first probability is the probability that the vertex is consistent with the starting point label;
or, the second weight is the base number e and the true number e is the inverse of the logarithm of the second probability; the second probability is a probability that the vertex is consistent with the end point label.
7. The method of claim 1, wherein the preprocessing the first sticky character image comprises:
performing binarization processing and refinement processing on the first adhesion character image to obtain a third adhesion character image;
traversing all black pixel points of the third adhesion character image, and finding out P characteristic points; wherein the feature points include bifurcation points, or end points and bifurcation points;
and splitting characters in the third adhesion character image based on the P characteristic points to obtain the second adhesion character image constructed by M paths.
8. An adhesive character segmentation apparatus, the apparatus comprising:
the processing unit is used for preprocessing the first adhesion character image to obtain a second adhesion character image constructed by M paths; wherein, all pixel points on one path share the same label, and one path corresponds to one vertex of the weighted undirected graph;
the construction unit is used for constructing the second adhesion character image into a weighted undirected graph; the vertex set of the weighted undirected graph consists of M vertexes corresponding to the M paths, and the edge set consists of a first edge between adjacent vertexes and a second edge, wherein each vertex is respectively connected with a starting point and an ending point;
the construction unit is also used for constructing an energy function; the boundary item of the energy function is used for determining a first weight of the first edge, and the first weight is determined by a depth value of a valley and/or a peak of a path for constructing the second sticky character; the area item of the energy function is used for determining a second weight of the second side, and the second weight is determined by the probability that the vertex is consistent with the starting point label or the probability that the vertex is consistent with the end point label;
and the processing unit is also used for solving the minimum value of the energy function to obtain the segmentation result of the second adhesion character image.
9. A sticky character segmentation apparatus, comprising: a processor and a memory configured to store a computer program capable of running on the processor,
wherein the processor is configured to perform the steps of the method of any of claims 1 to 7 when the computer program is run.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
CN202210725026.7A 2022-06-23 2022-06-23 Method, device, equipment and storage medium for cutting sticky characters Pending CN116798040A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210725026.7A CN116798040A (en) 2022-06-23 2022-06-23 Method, device, equipment and storage medium for cutting sticky characters

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210725026.7A CN116798040A (en) 2022-06-23 2022-06-23 Method, device, equipment and storage medium for cutting sticky characters

Publications (1)

Publication Number Publication Date
CN116798040A true CN116798040A (en) 2023-09-22

Family

ID=88033329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210725026.7A Pending CN116798040A (en) 2022-06-23 2022-06-23 Method, device, equipment and storage medium for cutting sticky characters

Country Status (1)

Country Link
CN (1) CN116798040A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116994261A (en) * 2023-09-27 2023-11-03 山东金榜苑文化传媒有限责任公司 Intelligent recognition system for big data accurate teaching intelligent question card image

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116994261A (en) * 2023-09-27 2023-11-03 山东金榜苑文化传媒有限责任公司 Intelligent recognition system for big data accurate teaching intelligent question card image
CN116994261B (en) * 2023-09-27 2023-12-15 山东金榜苑文化传媒有限责任公司 Intelligent recognition system for big data accurate teaching intelligent question card image

Similar Documents

Publication Publication Date Title
CN109583345B (en) Road recognition method, device, computer device and computer readable storage medium
CN115239644B (en) Concrete defect identification method, device, computer equipment and storage medium
CN107424166B (en) Point cloud segmentation method and device
CN110598541A (en) Method and equipment for extracting road edge information
JP2008217706A (en) Labeling device, labeling method and program
EP3973507B1 (en) Segmentation for holographic images
CN116403094B (en) Embedded image recognition method and system
CN113469040B (en) Image processing method, device, computer equipment and storage medium
CN108629286A (en) A kind of remote sensing airport target detection method based on the notable model of subjective perception
CN111639607A (en) Model training method, image recognition method, model training device, image recognition device, electronic equipment and storage medium
CN114038004A (en) Certificate information extraction method, device, equipment and storage medium
CN115908363B (en) Tumor cell statistics method, device, equipment and storage medium
CN114638818A (en) Image processing method, image processing device, electronic equipment and storage medium
CN111507337A (en) License plate recognition method based on hybrid neural network
Shi et al. Adaptive graph cut based binarization of video text images
CN116798040A (en) Method, device, equipment and storage medium for cutting sticky characters
CN110222772B (en) Medical image annotation recommendation method based on block-level active learning
CN116612280A (en) Vehicle segmentation method, device, computer equipment and computer readable storage medium
CN115223172A (en) Text extraction method, device and equipment
CN114820679A (en) Image annotation method and device, electronic equipment and storage medium
CN112560856B (en) License plate detection and identification method, device, equipment and storage medium
CN112966687B (en) Image segmentation model training method and device and communication equipment
CN110826488B (en) Image identification method and device for electronic document and storage equipment
CN115630422A (en) BIM model display method and system
CN114529570A (en) Image segmentation method, image identification method, user certificate subsidizing method and system

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