CN112990183A - Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters - Google Patents
Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters Download PDFInfo
- Publication number
- CN112990183A CN112990183A CN202110547648.0A CN202110547648A CN112990183A CN 112990183 A CN112990183 A CN 112990183A CN 202110547648 A CN202110547648 A CN 202110547648A CN 112990183 A CN112990183 A CN 112990183A
- Authority
- CN
- China
- Prior art keywords
- point
- stroke
- chinese character
- framework
- branch
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 78
- 230000011218 segmentation Effects 0.000 claims abstract description 99
- 238000000605 extraction Methods 0.000 claims abstract description 49
- 238000004891 communication Methods 0.000 claims abstract description 48
- 238000012545 processing Methods 0.000 claims abstract description 10
- 238000004364 calculation method Methods 0.000 claims description 15
- 239000013598 vector Substances 0.000 claims description 14
- 239000011159 matrix material Substances 0.000 claims description 9
- 230000008859 change Effects 0.000 claims description 8
- 238000007781 pre-processing Methods 0.000 claims description 7
- 238000000513 principal component analysis Methods 0.000 claims description 6
- 230000009466 transformation Effects 0.000 claims description 6
- 230000002457 bidirectional effect Effects 0.000 claims description 3
- 238000005192 partition Methods 0.000 claims 4
- 238000010586 diagram Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 11
- 238000004590 computer program Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000012217 deletion Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 230000037430 deletion Effects 0.000 description 3
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000012937 correction Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000002349 favourable effect Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/22—Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/25—Determination of region of interest [ROI] or a volume of interest [VOI]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/20—Image preprocessing
- G06V10/26—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
- G06V10/267—Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/40—Extraction of image or video features
- G06V10/44—Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Data Mining & Analysis (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Cheminformatics (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Character Discrimination (AREA)
Abstract
The invention belongs to the technical field of image processing, and particularly relates to an off-line handwritten Chinese character homonymous stroke extraction method, system and device, aiming at solving the problem that the conventional handwritten Chinese character homonymous stroke extraction method is lacked, so that students cannot be guided to normally write Chinese characters precisely to the stroke level. The method comprises the following steps: acquiring a handwritten Chinese character image and a reference Chinese character image; zooming the minimum external rectangle of the foreground area of the reference Chinese character image to realize the alignment of the minimum external rectangle with the handwritten Chinese character image; acquiring a segmentation communication area of a handwritten Chinese character image; calculating the minimum external rectangle, the main direction and the relative position relation with other strokes of each stroke communication area of the reference Chinese character image; adjusting the stroke position; acquiring a homonymous stroke communication area in a handwritten Chinese character image; and outputting the stroke connected region with the same name and the point set corresponding to the outline thereof. The invention realizes the extraction of homonymous strokes of handwritten Chinese characters, and further can guide students to write Chinese characters regularly by being accurate to the stroke level.
Description
Technical Field
The invention belongs to the technical field of image processing, and particularly relates to a method, a system and a device for extracting homonymous strokes of off-line handwritten Chinese characters.
Background
Can write Chinese characters in a standard and beautiful way and is beneficial to the study, work and life of one person. At present, exemplary teaching resources for teaching students to normatively write Chinese characters are rich, but feedback guidance of calligraphy practice works of the students mainly depends on manual work, and efficiency is low, so that intelligent means is needed to timely and effectively give targeted guidance opinions to the calligraphy works of the students, and the calligraphy practice effect of the students is improved.
The method is characterized in that a student is guided to correctly and normatively write the Chinese characters, except for judging the alignment and the error of the written Chinese characters, more importantly, guidance suggestions are given to regularity of each stroke, a stroke frame structure and the like of the Chinese characters, so that each stroke of the handwritten Chinese characters needs to be accurately distinguished, and the matched connected region in a handwritten Chinese character image is called homonymous stroke of the reference Chinese character. The Chinese characters are various and are the combination of communicated areas with complex topological structures, and the difficulty in extracting homonymous strokes of handwritten Chinese characters is increased due to the fact that the Chinese characters written by different people are different. Based on the method, the invention provides an off-line handwritten Chinese character homonymous stroke extraction method.
Disclosure of Invention
In order to solve the problems in the prior art, namely solving the problem that the standard writing of Chinese characters by students cannot be guided precisely to the stroke level due to the lack of the extraction method of the homonymous strokes of the handwritten Chinese characters at present, the invention provides an off-line extraction method of homonymous strokes of the handwritten Chinese characters, which comprises the following steps:
s10, acquiring a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
s20, extracting the minimum external rectangle of the foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
s30, extracting pixel points on the outline outside each connected region in the replaced handwritten Chinese character image, and constructing a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the first point set; constructing a closed contour as a segmentation communicating area, and calculating a minimum circumscribed rectangle and a main direction of each segmentation communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
s40, correcting the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in S20, and drawing the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
s50, sorting the boundary strokes and the internal strokes from big to small by the long side of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
s60, in a third point set that the distance between the third point set and the main direction of the segmentation communicating area is less than the set main direction distance threshold, the gradient direction distance between the third point set and the segmentation communicating area is less than the set gradient direction distance threshold, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation communicating area, the stroke category of the stroke contour point corresponding to the segmentation communicating area contour point is taken as the stroke category of the segmentation communicating area contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation communicating area; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
and S70, extracting the images of the homonymous stroke communication areas and the point sets corresponding to the outer contours thereof as homonymous stroke extraction results of the handwritten Chinese character images and outputting the homonymous stroke extraction results.
In some preferred embodiments, in step S30, "extracting skeleton end points and skeleton branch points of the chinese character from the second point set, and extracting a skeleton branch set as the first skeleton branch set by combining the skeleton end points and the skeleton branch points; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set as a second framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point, wherein the method comprises the following steps of:
acquiring skeleton end points and skeleton branch points of the Chinese characters from the second point set;
traversing pixel points in the second point set, if the current pixel point is not a framework end point and a framework branch point, taking the pixel point as a first point of a framework branch in a pre-constructed first framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework end point and the framework branch point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood points of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework end point and the framework branch point, so as to obtain a framework branch of the handwritten Chinese character image; continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed to obtain a first skeleton branch set of the handwritten Chinese character image;
extracting a framework inflection point of the Chinese character from the first framework branch set;
traversing the pixel points in the second point set again, if the current pixel point is not a framework endpoint, a framework branch point and a framework inflection point, taking the pixel point as a first point of a framework branch in a pre-constructed second framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework endpoint, the framework branch point and the framework inflection point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood point of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework endpoint, the framework branch point and the framework inflection point, so as to obtain a framework branch of the handwritten Chinese character image; and continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed, and obtaining a second skeleton branch set of the handwritten Chinese character image.
In some preferred embodiments, in step S30, "go through the first point set in combination with the skeleton branch point and the skeleton inflection point, and calculate the corresponding point pair between the first point set and the second point set", the method includes:
for each pixel point in the first point set, if the neighborhood point set comprises a framework branch point and a framework inflection point, taking a characteristic point closest to the pixel as a corresponding point to form a corresponding point pair; if the neighborhood point set does not contain the framework branch point and the framework inflection point, taking a pixel point closest to the pixel as a corresponding point; the characteristic points comprise skeleton end points, skeleton branch points and skeleton inflection points.
In some preferred embodiments, the method for determining the main direction, the sub direction, the single x direction, and the single y direction corresponding to the split communication area includes:
solving two eigenvalues and eigenvectors of the covariance matrix for the point set corresponding to the outer contour of each segmentation communicating area by adopting a Principal Component Analysis (PCA) method;
calculating an included angle between the two eigenvectors and the x axis, taking the included angle between the eigenvector corresponding to the larger eigenvalue of the two eigenvalues and the x axis as a main direction of the divided communicating region, and taking the included angle between the other eigenvector and the x axis as a secondary direction;
if the ratio of the large characteristic value to the small characteristic value in the two characteristic values is larger than a set threshold value, the segmentation communicating area is unidirectional, otherwise the segmentation communicating area is bidirectional; if the division communication area is in a single direction, if the angular distance between the main direction of the division communication area and the x axis is smaller than the angular distance between the main direction of the division communication area and the y axis, the division communication area is in a single x direction, otherwise, the division communication area is in a single y direction.
In some preferred embodiments, in step S40, "the relative position relationship between each stroke connected region and other strokes" is calculated by:
for each stroke connected regionIf other strokes are takenIn the single x direction, the judgment is madeWhether or not to be atAbove or below; if it isIn the single y direction, the judgment is madeWhether or not to be atLeft or right of; otherwise, judgingWhether or not to be atUp/down/left/right;
judgment ofWhether or not to be atThe above method of (1) is: let x coordinate atBetween the left edge and the right edge of the circumscribed rectangle, and from the upper edge of the image to the stroke of the y coordinateThe area between the upper edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatAbove (1);
judgment ofWhether or not to be atThe following method is as follows: coordinate x on the strokeBetween the left edge and the right edge of the circumscribed rectangle, and between the lower edge and the stroke of the image by the y coordinateThe area between the lower edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatBelow (1);
judgment ofWhether or not to be atThe method to the left of (1) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the left edge to the stroke of the imageThe area between the left edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the left;
judgment ofWhether or not to be atThe right method of (3) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the right edge to the stroke of the imageThe area between the right edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the right of (c).
In some preferred embodiments, the "adjusting stroke position" in step S50 is performed by:
pair of strokesAccording to the strokeCalculating a forbidden area of the stroke according to the relative position relation of the stroke and all the strokes with the adjusted positions, and calculating a feasible adjusting area according to the current position of the stroke;
the method comprises the steps of reserving a handwritten Chinese character communication area which is in a feasible adjustment area of a stroke, is not in a forbidden area of the stroke and has a stroke main direction smaller than a threshold value, taking a contour point set of the reserved Chinese character communication area under the hand as a target point set, taking the contour point set of the stroke communication area as a source point set, solving a transformation matrix from the source point set to the target point set according to an iterative nearest neighbor method, and further adjusting the position of a reference Chinese character stroke according to the obtained transformation matrix;
for theFor all strokes with adjusted positionsIf, ifIs out of positionAbove/below/left/right, thenAbove/below/left/right ofThe forbidden area of (a); if the stroke at the adjusted position of the stroke at the first position after the sorting in the step S50 is empty, the corresponding forbidden area is empty;
wherein,、、、respectively the coordinates, the width and the height of the upper left corner point of the stroke circumscribed rectangle,、respectively the width and the height of the image,、、、respectively to the left of the feasible adjustment regionCoordinates of the upper corner points, width and height,the predetermined coefficient represents the size of the feasible adjustment area.
In some preferred embodiments, the distance between two main directions of the divided communication areas is calculated by:
wherein,the distance in the main direction is indicated,、indicating the main direction of the two split linking areas.
The second aspect of the invention provides an off-line handwritten Chinese character homonymous stroke extraction system, which comprises: the device comprises an image acquisition module, an image alignment module, an area segmentation module, a feature element calculation module, a position adjustment module, a homonymy stroke connected area extraction module and an extraction result output module;
the image acquisition module is configured to acquire a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
the image alignment module is configured to extract a minimum circumscribed rectangle of a foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
the region segmentation module is configured to extract pixel points on the outer contour of each connected region in the replaced handwritten Chinese character image and construct a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the first point set; constructing a closed contour as a segmentation communicating area, and calculating a minimum circumscribed rectangle and a main direction of each segmentation communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
the characteristic element calculation module is configured to correct the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in the image alignment module, and draw the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
the position adjusting module is configured to sort the boundary strokes and the internal strokes from big to small by the long edge of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
the homonymous stroke connected region extraction module is configured to set the gradient direction distance between each contour point in the contour point set of the segmentation connected region of the handwritten Chinese character image and the set gradient direction distance threshold value in a third contour point set with the distance between the third contour point and the main direction of the segmentation connected region being smaller than the set main direction distance threshold value, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation connected region, and the stroke category of the stroke contour point corresponding to the segmentation connected region contour point is taken as the stroke category of the segmentation connected region contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation region; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
and the extraction result output module is configured to extract the image of the homonymous stroke communication area and the point set corresponding to the outline thereof as the homonymous stroke extraction result of the handwritten Chinese character image to output.
In a third aspect of the present invention, a storage device is provided, in which a plurality of programs are stored, the programs being adapted to be loaded and executed by a processor to implement the above-mentioned method for extracting homonymous strokes of handwritten Chinese characters.
In a fourth aspect of the present invention, a processing apparatus is provided, which includes a processor and a storage device; a processor adapted to execute various programs; a storage device adapted to store a plurality of programs; the program is suitable for being loaded and executed by a processor to realize the off-line handwritten Chinese character homonymy stroke extraction method.
The invention has the beneficial effects that:
the invention realizes the extraction of homonymous strokes of handwritten Chinese characters, and further can guide students to write Chinese characters regularly by being accurate to the stroke level.
1) The method aligns the preprocessed handwritten Chinese character image with the reference Chinese character image, performs area segmentation on the handwritten Chinese character, respectively extracts the characteristic elements of the handwritten Chinese character segmentation area and the characteristic elements of the reference Chinese character stroke communication area, adopts a constraint overlap nearest neighbor method to adjust the stroke position of the reference Chinese character, and realizes the extraction of the homonymous strokes of the offline handwritten Chinese character based on the characteristic elements, the position and the gradient direction constraint.
2) The area segmentation method for the handwritten Chinese character image can segment the handwritten Chinese character image into image elements with better unidirectionality, and is favorable for extracting homonymous strokes of crossed strokes; the stroke position of the reference Chinese character is adjusted under the additional constraint condition, the homonymous strokes are extracted based on multiple constraints, and the accuracy of extracting the homonymous strokes is improved on the basis of keeping the inter-stroke frame structure. The output result of the method can be used for deeply analyzing the overall structure, stroke arrangement, stroke form and the like of the written Chinese characters, and provides a technical basis for guiding the standard writing of the Chinese characters.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings.
FIG. 1 is a schematic flow chart of a method for extracting homonymous strokes of an offline handwritten Chinese character according to an embodiment of the present invention;
FIG. 2 is a block diagram of an offline handwritten Chinese character homonymous stroke extraction system according to an embodiment of the present invention;
FIG. 3 is a simplified flowchart of a method for extracting homonymous strokes of an offline handwritten Chinese character according to an embodiment of the present invention;
FIG. 4 is an exemplary diagram of a handwritten Chinese character image and a reference Chinese character image in accordance with an embodiment of the invention;
FIG. 5 is an exemplary diagram of the alignment of handwritten Chinese character images and reference Chinese character images in accordance with an embodiment of the present invention;
FIG. 6 is a diagram illustrating a segmentation result of connected regions of a handwritten Chinese character image according to an embodiment of the present invention;
FIG. 7 is an exemplary diagram of a result of homonymous stroke extraction for a handwritten Chinese character, in accordance with an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
The invention discloses a method for extracting homonymous strokes of off-line handwritten Chinese characters, which comprises the following steps of:
s10, acquiring a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
s20, extracting the minimum external rectangle of the foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
s30, extracting pixel points on the outline outside each connected region in the replaced handwritten Chinese character image, and constructing a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the first point set; constructing a closed contour as a segmentation communicating area, and calculating a minimum circumscribed rectangle and a main direction of each segmentation communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
s40, correcting the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in S20, and drawing the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
s50, sorting the boundary strokes and the internal strokes from big to small by the long side of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
s60, in a third point set that the distance between the third point set and the main direction of the segmentation communicating area is less than the set main direction distance threshold, the gradient direction distance between the third point set and the segmentation communicating area is less than the set gradient direction distance threshold, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation communicating area, the stroke category of the stroke contour point corresponding to the segmentation communicating area contour point is taken as the stroke category of the segmentation communicating area contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation communicating area; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
and S70, extracting the images of the homonymous stroke communication areas and the point sets corresponding to the outer contours thereof as homonymous stroke extraction results of the handwritten Chinese character images and outputting the homonymous stroke extraction results.
In order to more clearly explain the method for extracting homonymous strokes of the offline handwritten Chinese characters, the steps in one embodiment of the method of the invention are expanded and detailed in the following with reference to fig. 1 and 3.
S10, acquiring a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
in the embodiment, a handwritten Chinese character image is obtained firstly, an original image of the handwritten Chinese character image is obtained by shooting or scanning through a camera, the handwritten Chinese character image is preprocessed, so that a Chinese character area is white, the rest part of the handwritten Chinese character image is black, and the preprocessed (preferably subjected to binarization processing in the invention) image is used as the handwritten Chinese character image of the method; the reference Chinese character and the handwritten Chinese character are the same Chinese character, the reference Chinese character data is stored as the vector outline of the ordered strokes, the stroke outline points can be obtained from the vector outline, the strokes are drawn on the image to obtain the reference Chinese character image, wherein the Chinese character part is a white foreground, and the rest part is a black background, as shown in figure 4.
S20, extracting the minimum external rectangle of the foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
in this example, the process of calculating the aspect ratio of the second rectangle to be scaled to the scaling of the first rectangle is as shown in equation (1):
wherein,、is the width and the height of the first rectangle,、is the width and the height of the second rectangle,indicating the scaling.
Scaling the second rectangle according to the scaling ratio to obtain a third rectangle; and constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image. Further, the handwritten Chinese character image and the reference Chinese character image are aligned, and the alignment result is shown in FIG. 5.
S30, extracting pixel points on the outline outside each connected region in the replaced handwritten Chinese character image, and constructing a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the first point set; constructing a closed contour as a segmentation communicating area, and calculating a minimum circumscribed rectangle and a main direction of each segmentation communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
in this example, the area segmentation and the area feature element calculation are performed on the handwritten Chinese character image, specifically:
s31, extracting pixel points on the outline outside each connected region in the replaced handwritten Chinese character image, and constructing a first point set;
s32, extracting the skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; the method specifically comprises the following steps:
for the pixel points in the first point setBuilding a neighborhood point setAnd a deletion mark image with the same size as the handwritten Chinese character image, wherein the position of the pixel point (namely the Chinese character part) corresponding to the foreground area in the handwritten Chinese character image in the initial mark image is marked as non-deletion, and the rest part is marked as deletion; using a thinning algorithm to check each pixel in the marked image, and marking the pixel meeting the deleting condition as to-be-deleted; for each pixel point in the first point setSet of neighborhood points ofEach neighborhood point in (1)If, ifMarked as to be deleted, then sequentially traversingThe eight neighborhood pixel points are marked as not deleted and not in the setAdding pixel points inThen is atDeletion in(ii) a Marking the pixel points marked to be deleted in the marked image as deleted; repeating the steps of 'inspection of marked image → update of pixel neighborhood set in first point set → update of marked image' until no more pixels in the marked image are marked to be deleted, taking the obtained neighborhood point set as a second point set, and the points in the second point set are simply called skeleton points; wherein, aggregateThe initial element of (A) is a pixel point. The extraction process of the skeleton points can be specifically referred to documents: "rafael c. gonzalez, richarde. woods. digital image processing (third edition)." electronics industry press, 2011. "11 th.Section 1.7, which is not described in detail herein.
S33, extracting the skeleton end points and the skeleton branch points of the Chinese characters from the second point set, and extracting a skeleton branch set by combining the skeleton end points and the skeleton branch points to be used as a first skeleton branch set; and extracting a framework inflection point from the first framework branch set, and re-extracting the framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set. The method comprises the following specific steps:
firstly, obtaining framework end points and framework branch points of the Chinese characters from a second point set, wherein the framework end points are defined as estimation points of which only one neighbor or two adjacent neighbors in eight neighborhoods are framework points; the skeleton branch point is defined as a skeleton point with 0-1 or 1-0 change times more than 4 and even number in the eight neighborhoods, namely, in the eight neighborhoods of a certain pixel point in the second point set, if the neighbor point is the pixel point in the second point set, the neighbor point is marked as 1, otherwise, the neighbor point is marked as 0; the eight neighborhoods are visited in numerical order from small to large in the following table, and the number of 0-1 or 1-0 changes in the neighborhoods is counted.
TABLE 1
The eight numbered regions of 1-8 in table 1 represent eight neighborhoods.
Traversing each pixel point in the second point set, if the current pixel point is not a framework endpoint or a framework branch point, performing image growth by taking the pixel point as a seed pixel point until a certain pixel point is a framework endpoint or a framework branch point or the certain pixel point does not belong to the second point set, stopping the growth, and extracting a grown pixel segment as a framework branch; deleting the pixel points which are not the skeleton branch points in the pixel points covered by the skeleton branch in the second point set; and repeating the steps until all the points in the second pixel point set are the skeleton branch points. Traversing pixel points in a second point set, if the current pixel point is not a framework endpoint or a framework branch point, taking the pixel point as a first point of a framework branch in a pre-constructed first framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework endpoint or the framework branch point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood point of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework endpoint or the framework branch point, so as to obtain a framework branch of the handwritten Chinese character image; and continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed. And obtaining a first skeleton branch set of the handwritten Chinese character image.
Extracting a framework inflection point of the Chinese character from the first framework branch set, wherein the definition of the framework inflection point is as follows: for pixel point in each skeleton branchIf distanceThe index distance is a set distanceTwo pixel points of、CalculatingOpening angle formed by two pixel pointsIf the opening angle is smaller than the set threshold valueThen, thenIs a framework inflection point; the calculation process is shown in formula (2):
in one embodiment of the invention, the size of the aligned handwritten chinese character image and the reference chinese character image is 340x310,preferably in the configuration of 11, and preferably,preferably configured at 140.
Traversing the pixel points in the second point set again, if the current pixel point is not a framework endpoint, a framework branch point and a framework inflection point, taking the pixel point as a first point of a framework branch in a pre-constructed second framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework endpoint, the framework branch point and the framework inflection point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood point of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework endpoint, the framework branch point and the framework inflection point, so as to obtain a framework branch of the handwritten Chinese character image; and continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed, and obtaining a second skeleton branch set of the handwritten Chinese character image.
S34, after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, and calculating corresponding point pairs of the first point set and the second point set; the method specifically comprises the following steps:
for each pixel point in the first point set, if the neighborhood point set comprises a framework branch point and a framework inflection point, taking a characteristic point closest to the pixel as a corresponding point to form a corresponding point pair; if the neighborhood point set does not contain the framework branch point and the framework inflection point, taking a pixel point closest to the pixel as a corresponding point to form a corresponding point pair; the characteristic points comprise skeleton end points, skeleton branch points and skeleton inflection points.
S35, traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the pixel points in the first point set; and constructing a closed contour as a segmentation communicating area, and calculating the minimum circumscribed rectangle and the main direction of each segmentation communicating area. The method specifically comprises the following steps:
traversing the second skeleton branch set, and extracting the pixel point set of which the corresponding point in the first point set is the point for the pixel point on each skeleton branchTo, forThe points belonging to the outline of the same handwritten Chinese character image communication area are sorted according to the outline index to obtain one or more sub-outlines; if there is more than one sub-outline, the sub-outline is inserted and sorted byAnd sorted set of sub-profilesCalculating the position with the minimum distance between the distance and the adjacent sub-contour as the sub-contourWherein the distance to the neighborhood sub-outline is calculated ifInsert into、Then calculate the following two distances-First pixel point ofThe pixel distance of the last pixel point andlast pixel point andthe sum of the pixel distances of the first pixel point,Last pixel point andthe pixel distance of the last pixel point andfirst pixel point ofThe sum of the pixel distances of the first pixel point,If it is toInsert into、In betweenThe smallest distance among all insertion positions, thenInsert into、If there is aThen will beThe pixel points in the image are inserted after being arranged in a reverse order; set of sub-contoursLast inThe next neighbor sub-outline of the sub-outline is the first sub-outline; and after the sorting is finished, the closed outline formed by all the pixel points in the sub-outline set is a segmentation communicating area of the handwritten Chinese character image. The segmentation result of connected regions in the handwritten Chinese character image is shown in FIG. 6.
Calculating the minimum circumscribed rectangle and the main direction of each divided communicating area as the characteristic elements of the divided communicating areas, wherein the main direction, the secondary direction, the single x direction and the single y direction corresponding to each divided communicating area are determined by the following steps:
solving two eigenvalues and eigenvectors of the covariance matrix for the point set corresponding to the outer contour of each segmentation communicating area by adopting a Principal Component Analysis (PCA) method;
calculating an included angle between the two eigenvectors and the x axis, taking the included angle between the eigenvector corresponding to the larger eigenvalue of the two eigenvalues and the x axis as a main direction of the divided communicating region, and taking the included angle between the other eigenvector and the x axis as a secondary direction;
if the ratio of the large characteristic value to the small characteristic value in the two characteristic values is larger than a set threshold value, the segmentation communicating area is unidirectional, otherwise the segmentation communicating area is bidirectional; if the division communication area is in a single direction, if the angular distance between the main direction of the division communication area and the x axis is smaller than the angular distance between the main direction of the division communication area and the y axis, the division communication area is in a single x direction, otherwise, the division communication area is in a single y direction. In the present invention, in the case of the present invention,preferably configured as 10.
The method for calculating the included angle between the feature vector and the x axis is shown as formula (3):
S40, correcting the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in S20, and drawing the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
in this example, the contour of the stroke vector of the chinese character in the reference chinese character image is corrected in accordance with the scaling obtained in S20, as shown in equation (4):
wherein,、the original coordinates of the contour points corresponding to the contour of the stroke vector,、and the coordinates after the correction of the contour points corresponding to the stroke vector contour are shown.
And after correction, sequentially drawing single strokes of Chinese characters in the corrected reference Chinese character image on the image according to the stroke writing sequence, extracting pixel points on the outer contour of each stroke communicating area, and calculating the minimum external rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area to serve as stroke characteristic elements of the reference Chinese character image.
Wherein, the relative position relation of each stroke connected region and other strokes is calculated, and the method specifically comprises the following steps:
for each stroke connected regionIf other strokes are takenIn the single x direction, the judgment is madeWhether or not to be atAbove or below; if it isIn the single y direction, the judgment is madeWhether or not to be atLeft or right of; otherwise, judgingWhether or not to be atUp/down/left/right;
judgment ofWhether or not to be atThe above method of (1) is: let x coordinate atBetween the left edge and the right edge of the circumscribed rectangle, and from the upper edge of the image to the stroke of the y coordinateThe area between the upper edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatAbove (1);
judgment ofWhether or not to be atThe following method is as follows: coordinate x on the strokeBetween the left edge and the right edge of the circumscribed rectangle, and between the lower edge and the stroke of the image by the y coordinateThe area between the lower edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatBelow (1);
judgment ofWhether or not to be atThe method to the left of (1) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the left edge to the stroke of the imageThe area between the left edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the left;
judgment ofWhether or not to be atThe right method of (3) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the right edge to the stroke of the imageThe area between the right edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the right of (c).
And finally, judging whether the stroke is above or below or on the left or right of all other strokes, if so, taking the stroke as a boundary stroke, and if not, taking the stroke as an internal stroke.
S50, sorting the boundary strokes and the internal strokes from big to small by the long side of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
in this example, the specific process of adjusting the stroke position is as follows:
pair of strokesAccording to the strokeCalculating a forbidden area of the strokes according to the relative position relation of the strokes with all the adjusted positions, and calculating a feasible adjusting area according to the current position of the strokes;
and (3) reserving a handwritten Chinese character communication area which is in a feasible adjustment area of the stroke, is not in a forbidden area of the stroke and has a main direction smaller than a threshold value with the stroke, taking the contour point set of the reserved Chinese character communication area under the hand as a target point set, taking the contour point set of the stroke communication area as a source point set, solving a transformation matrix from the source point set to the target point set according to an iterative nearest neighbor method, and further adjusting the position of the reference Chinese character stroke according to the obtained transformation matrix.
for theFor all strokes with adjusted positionsIf, ifIs out of positionAbove/below/left/right, thenAbove/below/left/right ofThe forbidden area of (a); if the stroke at the adjusted position of the stroke at the first position after the sorting in the step S50 is empty, the corresponding forbidden area is empty;
wherein,、、、respectively the coordinates, the width and the height of the upper left corner point of the stroke circumscribed rectangle,、respectively the width and the height of the image,、、、the coordinate width and the height of the upper left corner point of the feasible adjustment area are respectively,for a preset coefficient indicating the size of the feasible adjustment region, N is preferably configured to be 4 in the present invention.
S60, in a third point set that the distance between the third point set and the main direction of the segmentation communicating area is less than the set main direction distance threshold, the gradient direction distance between the third point set and the segmentation communicating area is less than the set gradient direction distance threshold, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation communicating area, the stroke category of the stroke contour point corresponding to the segmentation communicating area contour point is taken as the stroke category of the segmentation communicating area contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation communicating area; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character; the results of the extraction are shown in fig. 7.
In this example, the distance between the two main directions of the divided connected regions is calculated as follows:
wherein,the distance in the main direction is indicated,、indicating a main direction of two divided connected areas, a main direction distance thresholdIs preferably arranged as。
And S70, extracting the images of the homonymous stroke communication areas and the point sets corresponding to the outer contours thereof as homonymous stroke extraction results of the handwritten Chinese character images and outputting the homonymous stroke extraction results.
In the embodiment, the connected region of the strokes with the same name in the handwritten Chinese character image and the point set corresponding to the outer contour thereof are output, so that a data basis is provided for subsequently evaluating the handwritten Chinese characters and guiding the writing specification.
An off-line handwritten Chinese character homonymous stroke extraction system according to a second embodiment of the present invention, as shown in fig. 2, includes: the system comprises an image acquisition module 100, an image alignment module 200, an area segmentation module 300, a feature element calculation module 400, a position adjustment module 500, a homonymy stroke connected area extraction module 600 and an extraction result output module 700;
the image obtaining module 100 is configured to obtain a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
the image alignment module 200 is configured to extract a minimum circumscribed rectangle of a foreground region of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
the region segmentation module 300 is configured to extract pixel points on the outer contour of each connected region in the replaced handwritten Chinese character image, and construct a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, and extracting pixel points of each pixel point on the skeleton branch corresponding to the first point set; constructing a closed contour as a segmentation communicating area, and calculating a minimum circumscribed rectangle and a main direction of each segmentation communicating area;
the skeleton end point is only one neighbor or two adjacent neighbors in eight neighborhoodsFramework points centered at framework points: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
the feature element calculation module 400 is configured to correct the contour of the stroke vector of the Chinese character in the reference Chinese character image according to the scaling obtained in the image alignment module, and sequentially draw the single strokes of the Chinese character in the corrected reference Chinese character image on the image according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
the position adjusting module 500 is configured to sort the boundary strokes and the internal strokes from large to small by the long edge of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
the homonymous stroke connected region extraction module 600 is configured to set a gradient direction distance between each contour point in a contour point set of a segmentation connected region of the handwritten Chinese character image and a set gradient direction distance threshold in a third contour point set in which a distance between the contour point set of the segmentation connected region and a main direction of the segmentation connected region is smaller than the main direction distance threshold, and a stroke contour point with a closest pixel distance is used as a corresponding point of the contour point of the segmentation connected region, and a stroke category of the stroke contour point corresponding to the segmentation connected region contour point is used as a stroke category of the segmentation connected region contour point, and a stroke category with the largest number of contour points is used as a stroke category of the segmentation region; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
the extraction result output module 700 is configured to extract the image of the homonymous stroke connected region and the point set corresponding to the outline thereof as the homonymous stroke extraction result of the handwritten Chinese character image for output.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process and related description of the system described above may refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
It should be noted that, the system for extracting homonymous strokes of offline handwritten chinese characters provided in the above embodiment is only illustrated by the division of the above functional modules, and in practical applications, the above functions may be allocated to different functional modules according to needs, that is, the modules or steps in the embodiment of the present invention are further decomposed or combined, for example, the modules in the above embodiment may be combined into one module, or may be further split into multiple sub-modules, so as to complete all or part of the above described functions. The names of the modules and steps involved in the embodiments of the present invention are only for distinguishing the modules or steps, and are not to be construed as unduly limiting the present invention.
A storage device according to a third embodiment of the present invention stores a plurality of programs, and the programs are adapted to be loaded by a processor and to implement the method for extracting homonymous strokes of handwritten Chinese characters.
A processing apparatus according to a fourth embodiment of the present invention includes a processor and a storage device; a processor adapted to execute various programs; a storage device adapted to store a plurality of programs; the program is suitable for being loaded and executed by a processor to realize the off-line handwritten Chinese character homonymy stroke extraction method.
It can be clearly understood by those skilled in the art that, for convenience and brevity, the specific working processes and related descriptions of the storage device and the processing device described above may refer to the corresponding processes in the foregoing method examples, and are not described herein again.
Referring now to FIG. 8, there is illustrated a block diagram of a computer system suitable for use as a server in implementing embodiments of the system, method and apparatus of the present application. The server shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 8, the computer system includes a Central Processing Unit (CPU) 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM803, various programs and data necessary for system operation are also stored. The CPU801, ROM 802, and RAM803 are connected to each other via a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a display such as a cathode ray tube, a liquid crystal display, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a local area network card, modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the CPU801, performs the above-described functions defined in the method of the present application. It should be noted that the computer readable medium mentioned above in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the C language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network or a wide area network, or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The terms "first," "second," and the like are used for distinguishing between similar elements and not necessarily for describing or implying a particular order or sequence.
The terms "comprises," "comprising," or any other similar term are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
So far, the technical solutions of the present invention have been described in connection with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the scope of the present invention is obviously not limited to these specific embodiments. Equivalent changes or substitutions of related technical features can be made by those skilled in the art without departing from the principle of the invention, and the technical scheme after the changes or substitutions can fall into the protection scope of the invention.
Claims (10)
1. An off-line handwritten Chinese character homonymous stroke extraction method is characterized by comprising the following steps:
s10, acquiring a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
s20, extracting the minimum external rectangle of the foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
s30, extracting pixel points on the outline outside each connected region in the replaced handwritten Chinese character image, and constructing a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, extracting pixel points of each pixel point on the skeleton branch corresponding to the pixel points in the first point set, constructing a closed contour as a partition communicating area, and calculating the minimum circumscribed rectangle and the main direction of each partition communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the skeleton branch points are skeleton points with the number of 0-1 or 1-0 change times more than 4 and even number in eight neighborhoods; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
s40, correcting the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in S20, and drawing the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
s50, sorting the boundary strokes and the internal strokes from big to small by the long side of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
s60, in a third point set that the distance between the third point set and the main direction of the segmentation communicating area is less than the set main direction distance threshold, the gradient direction distance between the third point set and the segmentation communicating area is less than the set gradient direction distance threshold, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation communicating area, the stroke category of the stroke contour point corresponding to the segmentation communicating area contour point is taken as the stroke category of the segmentation communicating area contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation communicating area; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
and S70, extracting the images of the homonymous stroke communication areas and the point sets corresponding to the outer contours thereof as homonymous stroke extraction results of the handwritten Chinese character images and outputting the homonymous stroke extraction results.
2. The method for extracting homonymous strokes of offline handwritten Chinese characters according to claim 1, wherein in step S30, "skeleton end points and skeleton branch points of Chinese characters are extracted from the second point set, and a skeleton branch set is extracted by combining the skeleton end points and the skeleton branch points to serve as a first skeleton branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set as a second framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point, wherein the method comprises the following steps of:
acquiring skeleton end points and skeleton branch points of the Chinese characters from the second point set;
traversing pixel points in the second point set, if the current pixel point is not a framework end point and a framework branch point, taking the pixel point as a first point of a framework branch in a pre-constructed first framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework end point and the framework branch point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood points of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework end point and the framework branch point, so as to obtain a framework branch of the handwritten Chinese character image; continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed to obtain a first skeleton branch set of the handwritten Chinese character image;
extracting a framework inflection point of the Chinese character from the first framework branch set;
traversing the pixel points in the second point set again, if the current pixel point is not a framework endpoint, a framework branch point and a framework inflection point, taking the pixel point as a first point of a framework branch in a pre-constructed second framework branch set, acquiring a neighborhood point of the pixel point, judging whether the neighborhood point belongs to the second point set or does not belong to the framework endpoint, the framework branch point and the framework inflection point, if so, adding the neighborhood point into the current framework branch, and circularly traversing the neighborhood point of the neighborhood point until the neighborhood point does not belong to the second point set or belongs to the framework endpoint, the framework branch point and the framework inflection point, so as to obtain a framework branch of the handwritten Chinese character image; and continuously traversing the residual pixel points of the second point set until all the pixel points in the second point set are completely traversed, and obtaining a second skeleton branch set of the handwritten Chinese character image.
3. The method for extracting homonymous strokes of offline handwritten Chinese characters according to claim 1, wherein in step S30, "go through the first point set in combination with the skeleton branch points and the skeleton inflection points, and calculate the corresponding point pairs between the first point set and the second point set", the method comprises:
for each pixel point in the first point set, if the neighborhood point set comprises a framework branch point and a framework inflection point, taking a characteristic point closest to the pixel as a corresponding point to form a corresponding point pair; if the neighborhood point set does not contain the framework branch point and the framework inflection point, taking a pixel point closest to the pixel as a corresponding point; the characteristic points comprise skeleton end points, skeleton branch points and skeleton inflection points.
4. The method for extracting homonymous strokes of off-line handwritten Chinese characters according to claim 1, wherein the method for judging the main direction, the secondary direction, the single x direction and the single y direction corresponding to the divided connected region comprises the following steps:
solving two eigenvalues and eigenvectors of the covariance matrix for the point set corresponding to the outer contour of each segmentation communicating area by adopting a Principal Component Analysis (PCA) method;
calculating an included angle between the two eigenvectors and the x axis, taking the included angle between the eigenvector corresponding to the larger eigenvalue of the two eigenvalues and the x axis as a main direction of the divided communicating region, and taking the included angle between the other eigenvector and the x axis as a secondary direction;
if the ratio of the large characteristic value to the small characteristic value in the two characteristic values is larger than a set threshold value, the segmentation communicating area is unidirectional, otherwise the segmentation communicating area is bidirectional; if the division communication area is in a single direction, if the angular distance between the main direction of the division communication area and the x axis is smaller than the angular distance between the main direction of the division communication area and the y axis, the division communication area is in a single x direction, otherwise, the division communication area is in a single y direction.
5. The method for extracting homonymous strokes of offline handwritten Chinese characters according to claim 4, wherein the calculation method of the relative position relationship between each stroke connected area and other strokes is as follows:
for each stroke connected regionIf other strokes are takenIn the single x direction, the judgment is madeWhether or not to be atAbove or below; if it isIn the single y direction, the judgment is madeWhether or not to be atLeft or right of; otherwise, judgingWhether or not to be atUp/down/left/right;
judgment ofWhether or not to be atThe above method of (1) is: let x coordinate atThe minimum circumscribed rectangle is between the left edge and the right edge, and the y coordinate is from the upper edge of the reference Chinese character image to the strokeThe area between the upper edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatUpper part ofA method for preparing;
judgment ofWhether or not to be atThe following method is as follows: coordinate x on the strokeThe minimum circumscribed rectangle is between the left edge and the right edge, and the y coordinate is from the lower edge to the stroke of the reference Chinese character imageThe area between the lower edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatBelow (1);
judgment ofWhether or not to be atThe method to the left of (1) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the left edge to the stroke of the imageThe area between the left edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the left;
judgment ofWhether or not to be atThe right method of (3) is: the y coordinate is arranged in the strokeBetween the upper edge and the lower edge of the circumscribed rectangle, and the x coordinate is from the right edge to the stroke of the imageThe area between the right edges is marked as a region of interest ifIntersect with the region of interest, thenIn thatTo the right of (c).
6. The method for extracting homonymous strokes of offline handwritten Chinese characters according to claim 5, wherein in step S50, "adjusting stroke positions" includes:
pair of strokesAccording to the strokeCalculating a forbidden area of the stroke according to the relative position relation of the stroke and all the strokes with the adjusted positions, and calculating a feasible adjusting area according to the current position of the stroke;
the method comprises the steps of reserving a handwritten Chinese character communication area which is in a feasible adjustment area of a stroke, is not in a forbidden area of the stroke and has a stroke main direction smaller than a threshold value, taking a contour point set of the reserved Chinese character communication area under the hand as a target point set, taking the contour point set of the stroke communication area as a source point set, solving a transformation matrix from the source point set to the target point set according to an iterative nearest neighbor method, and further adjusting the position of a reference Chinese character stroke according to the obtained transformation matrix;
for theFor all strokes with adjusted positionsIf, ifIs out of positionAbove/below/left/right, thenAbove/below/left/right ofThe forbidden area of (a); if the stroke at the adjusted position of the stroke at the first position after the sorting in the step S50 is empty, the corresponding forbidden area is empty;
wherein,、、、respectively the coordinates, the width and the height of the upper left corner point of the stroke circumscribed rectangle,、respectively the width and the height of the image,、、、respectively the coordinates, the width and the height of the upper left corner point of the feasible adjustment area,the predetermined coefficient represents the size of the feasible adjustment area.
7. The method for extracting homonymous strokes of offline handwritten Chinese characters according to claim 6, wherein the distance between two main directions of the divided communicating areas is calculated by:
8. An off-line handwritten Chinese character homonymous stroke extraction system is characterized by comprising: the device comprises an image acquisition module, an image alignment module, an area segmentation module, a feature element calculation module, a position adjustment module, a homonymy stroke connected area extraction module and an extraction result output module;
the image acquisition module is configured to acquire a handwritten Chinese character image and a reference Chinese character image; the handwritten Chinese character image is a binary image obtained by preprocessing a shot or scanned hard-tipped writing Chinese character image; the standard Chinese character image is a standard Chinese character image with known strokes and writing sequence;
the image alignment module is configured to extract a minimum circumscribed rectangle of a foreground area of the handwritten Chinese character image as a first rectangle; extracting a minimum external rectangle of the foreground region of the reference Chinese character image as a second rectangle; calculating the aspect ratio of the second rectangle, scaling to the scaling of the first rectangle, and scaling the second rectangle according to the scaling to obtain a third rectangle; constructing an image with the same size as the third rectangle, placing the foreground area of the handwritten Chinese character image in the middle of the constructed image as a first image, and replacing the original handwritten Chinese character image with the first image;
the region segmentation module is configured to extract pixel points on the outer contour of each connected region in the replaced handwritten Chinese character image and construct a first point set; extracting skeleton points of the replaced handwritten Chinese character image by combining the first point set, and constructing a second point set; extracting framework end points and framework branch points of the Chinese characters from the second point set, and extracting a framework branch set by combining the framework end points and the framework branch points to be used as a first framework branch set; extracting a framework inflection point from the first framework branch set, and re-extracting a framework branch set by combining a framework endpoint, a framework branch point and the framework inflection point to be used as a second framework branch set;
after re-extraction, traversing the first point set by combining the skeleton branch points and the skeleton inflection points, calculating corresponding point pairs of the first point set and the second point set, further traversing the second skeleton branch set, extracting pixel points of each pixel point on the skeleton branch corresponding to the pixel points in the first point set, constructing a closed contour as a partition communicating area, and calculating the minimum circumscribed rectangle and the main direction of each partition communicating area;
the skeleton endpoint is a skeleton point with only one neighbor or two adjacent neighbors in the eight neighborhoods as a skeleton point: the branch points of the framework are 0-1 or 1-0 change in eight neighborhoodsThe number of the skeleton points is more than 4 and is an even number; the frame inflection point is that the field angle formed by the frame inflection point and two pixel points which are away from the frame inflection point by a set index distance is smaller than a set field angle threshold value;Pixel points in the skeleton branch;
the characteristic element calculation module is configured to correct the outline of the Chinese character stroke vector in the reference Chinese character image according to the zoom ratio obtained in the image alignment module, and draw the single stroke of the Chinese character in the corrected reference Chinese character image on the image in sequence according to the stroke writing sequence; after drawing, extracting pixel points on the outer contour of each stroke communicating area, calculating the minimum circumscribed rectangle, the main direction and the relative position relation with other strokes of each stroke communicating area, and judging whether the stroke is above or below or on the left or on the right of all other strokes, if so, the stroke is taken as a boundary stroke, otherwise, the stroke is taken as an internal stroke;
the position adjusting module is configured to sort the boundary strokes and the internal strokes from big to small by the long edge of the minimum bounding rectangle of the strokes; after sorting, traversing the strokes in sequence and adjusting the stroke positions; extracting an outer contour point set of each stroke communication area of the Chinese character in the reference Chinese character image after the position is adjusted to be used as a third point set;
the homonymous stroke connected region extraction module is configured to set the gradient direction distance between each contour point in the contour point set of the segmentation connected region of the handwritten Chinese character image and the set gradient direction distance threshold value in a third contour point set with the distance between the third contour point and the main direction of the segmentation connected region being smaller than the set main direction distance threshold value, and the stroke contour point with the closest pixel distance is taken as the corresponding point of the contour point of the segmentation connected region, and the stroke category of the stroke contour point corresponding to the segmentation connected region contour point is taken as the stroke category of the segmentation connected region contour point, and the stroke category with the largest number of contour points is taken as the stroke category of the segmentation region; after classification, sequentially marking the handwritten Chinese character segmentation communicating areas with the same stroke category, merging all the segmentation communicating areas with the same category and the same connection into one, and taking the segmentation communicating area with the largest product after merging as the homonymous stroke communicating area of the stroke of the category in the handwritten Chinese character image in the reference Chinese character;
and the extraction result output module is configured to extract the image of the homonymous stroke communication area and the point set corresponding to the outline thereof as the homonymous stroke extraction result of the handwritten Chinese character image to output.
9. A storage device having stored therein a plurality of programs, wherein said programs are adapted to be loaded and executed by a processor to implement the method for extracting homonymous strokes of handwritten chinese characters as claimed in any of claims 1 to 7.
10. A processing device comprising a processor and a storage device; a processor adapted to execute various programs; a storage device adapted to store a plurality of programs; wherein the program is adapted to be loaded and executed by a processor to implement the method for extracting homonymous strokes of handwritten Chinese characters as claimed in any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110547648.0A CN112990183B (en) | 2021-05-19 | 2021-05-19 | Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110547648.0A CN112990183B (en) | 2021-05-19 | 2021-05-19 | Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112990183A true CN112990183A (en) | 2021-06-18 |
CN112990183B CN112990183B (en) | 2021-08-10 |
Family
ID=76337032
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110547648.0A Active CN112990183B (en) | 2021-05-19 | 2021-05-19 | Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112990183B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113642542A (en) * | 2021-10-14 | 2021-11-12 | 中国科学院自动化研究所 | Method for extracting homonymous strokes of handwritten Chinese characters based on position constraint |
CN114495117A (en) * | 2022-02-15 | 2022-05-13 | 甘肃政法大学 | Stroke extraction method of Chinese handwritten Chinese character |
CN115471849A (en) * | 2022-11-03 | 2022-12-13 | 南京信息工程大学 | Handwritten Chinese character image evaluation method and system |
CN115841671A (en) * | 2023-02-21 | 2023-03-24 | 南京信息工程大学 | Calligraphy character skeleton correction method, system and storage medium |
CN116580129A (en) * | 2023-04-18 | 2023-08-11 | 南京信息工程大学 | Method, device and storage medium for improving calligraphy character skeleton based on distance transformation |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103488339A (en) * | 2013-09-09 | 2014-01-01 | 北京大学 | Method for generating individualized digital ink of Chinese characters |
CN103927537A (en) * | 2014-05-08 | 2014-07-16 | 电子科技大学 | Extraction algorithm of self-adapting intersection regions of strokes of Chinese characters |
CN104156721A (en) * | 2014-07-31 | 2014-11-19 | 南京师范大学 | Off-line Chinese character stroke extraction method based on template matching |
CN104951788A (en) * | 2015-07-08 | 2015-09-30 | 上海海事大学 | Extracting method of strokes of separate character in calligraphy work |
US20150339525A1 (en) * | 2013-01-11 | 2015-11-26 | Natural Intelligent Technologies S.R.L. | Process of handwriting recognition and related apparatus |
CN112597876A (en) * | 2020-12-20 | 2021-04-02 | 湖北工业大学 | Calligraphy Chinese character judging method based on feature fusion |
-
2021
- 2021-05-19 CN CN202110547648.0A patent/CN112990183B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150339525A1 (en) * | 2013-01-11 | 2015-11-26 | Natural Intelligent Technologies S.R.L. | Process of handwriting recognition and related apparatus |
CN103488339A (en) * | 2013-09-09 | 2014-01-01 | 北京大学 | Method for generating individualized digital ink of Chinese characters |
CN103927537A (en) * | 2014-05-08 | 2014-07-16 | 电子科技大学 | Extraction algorithm of self-adapting intersection regions of strokes of Chinese characters |
CN104156721A (en) * | 2014-07-31 | 2014-11-19 | 南京师范大学 | Off-line Chinese character stroke extraction method based on template matching |
CN104951788A (en) * | 2015-07-08 | 2015-09-30 | 上海海事大学 | Extracting method of strokes of separate character in calligraphy work |
CN112597876A (en) * | 2020-12-20 | 2021-04-02 | 湖北工业大学 | Calligraphy Chinese character judging method based on feature fusion |
Non-Patent Citations (2)
Title |
---|
张瑞 等: "一种基于端点顺序预测的手写体笔画恢复方法", 《计算机科学》 * |
朱江 等: "一种基于骨架特征顺序编码的脱机手写体数字识别方法", 《小型微型计算机系统》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113642542A (en) * | 2021-10-14 | 2021-11-12 | 中国科学院自动化研究所 | Method for extracting homonymous strokes of handwritten Chinese characters based on position constraint |
CN114495117A (en) * | 2022-02-15 | 2022-05-13 | 甘肃政法大学 | Stroke extraction method of Chinese handwritten Chinese character |
CN115471849A (en) * | 2022-11-03 | 2022-12-13 | 南京信息工程大学 | Handwritten Chinese character image evaluation method and system |
CN115841671A (en) * | 2023-02-21 | 2023-03-24 | 南京信息工程大学 | Calligraphy character skeleton correction method, system and storage medium |
CN116580129A (en) * | 2023-04-18 | 2023-08-11 | 南京信息工程大学 | Method, device and storage medium for improving calligraphy character skeleton based on distance transformation |
CN116580129B (en) * | 2023-04-18 | 2024-05-14 | 南京信息工程大学 | Method, device and storage medium for improving calligraphy character skeleton based on distance transformation |
Also Published As
Publication number | Publication date |
---|---|
CN112990183B (en) | 2021-08-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112990183B (en) | Method, system and device for extracting homonymous strokes of offline handwritten Chinese characters | |
CN111325203B (en) | American license plate recognition method and system based on image correction | |
CN108229509B (en) | Method and device for identifying object class and electronic equipment | |
CN110866871A (en) | Text image correction method and device, computer equipment and storage medium | |
CN111611643B (en) | Household vectorization data acquisition method and device, electronic equipment and storage medium | |
TWI536277B (en) | Form identification method and device | |
CN110781885A (en) | Text detection method, device, medium and electronic equipment based on image processing | |
WO2020125057A1 (en) | Livestock quantity identification method and apparatus | |
CN107563379B (en) | Method for positioning text in natural scene image | |
CN109493400A (en) | Handwriting samples generation method, device, computer equipment and storage medium | |
US8805056B2 (en) | Automatic detection and grouping of straight lines in images for personalization | |
CN108171127A (en) | A kind of invoice automatic identifying method based on deep learning | |
CN114529837A (en) | Building outline extraction method, system, computer equipment and storage medium | |
CN110176064B (en) | Automatic identification method for main body object of photogrammetric generation three-dimensional model | |
Mousa et al. | Building detection and regularisation using DSM and imagery information | |
CN113762269A (en) | Chinese character OCR recognition method, system, medium and application based on neural network | |
CN111862040B (en) | Portrait picture quality evaluation method, device, equipment and storage medium | |
CN114266860A (en) | Three-dimensional face model establishing method and device, electronic equipment and storage medium | |
CN113223011B (en) | Small sample image segmentation method based on guide network and full-connection conditional random field | |
CN113642542B (en) | Method for extracting homonymous strokes of handwritten Chinese characters based on position constraint | |
CN111612045B (en) | Universal method for acquiring target detection data set | |
CN113657377A (en) | Structured recognition method for airplane ticket printing data image | |
CN117237681A (en) | Image processing method, device and related equipment | |
CN109117841B (en) | Scene text detection method based on stroke width transformation and convolutional neural network | |
CN111667429A (en) | Target positioning and correcting method for inspection robot |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |