WO2023065397A1 - 一种手写汉字图像的笔顺识别方法及系统 - Google Patents

一种手写汉字图像的笔顺识别方法及系统 Download PDF

Info

Publication number
WO2023065397A1
WO2023065397A1 PCT/CN2021/128101 CN2021128101W WO2023065397A1 WO 2023065397 A1 WO2023065397 A1 WO 2023065397A1 CN 2021128101 W CN2021128101 W CN 2021128101W WO 2023065397 A1 WO2023065397 A1 WO 2023065397A1
Authority
WO
WIPO (PCT)
Prior art keywords
stroke
segment
chinese character
strokes
code
Prior art date
Application number
PCT/CN2021/128101
Other languages
English (en)
French (fr)
Inventor
刘三女牙
杨宗凯
舒江波
戴志诚
易宝林
张维
吴亮
Original Assignee
华中师范大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华中师范大学 filed Critical 华中师范大学
Publication of WO2023065397A1 publication Critical patent/WO2023065397A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding

Definitions

  • the invention belongs to the technical field of computer image processing, and more specifically relates to a stroke order recognition method and system for handwritten Chinese character images.
  • Post-event evaluation refers to allowing the writer to write the target Chinese character at one time without interruption, and then extracts the characteristic data of the handwritten Chinese character to compare with the template Chinese characters and conduct a normative evaluation
  • real-time evaluation refers to the writer writing the target Chinese character every time A stroke of , the system immediately judges its normativeness.
  • the Chinese character skeleton extraction operation is an important step in the stroke order recognition of static handwritten Chinese characters.
  • the Chinese character skeleton can be obtained by performing the Chinese character skeleton extraction operation on the static handwritten Chinese characters.
  • the Chinese character skeleton can correctly reflect the topological structure of Chinese characters without redundant burrs or side branches.
  • Any pixel P in a static handwritten Chinese character image has 4 adjacent pixels, which are located at its top, bottom, left, and right respectively. These 4 pixels are the 4 neighborhoods of pixel P; the D neighborhood of pixel P is the four neighbors The point corresponding to the vertex; the 4-neighborhood and the D-neighborhood of the pixel P constitute the 8-neighborhood of the pixel P; the encoding rule of the direction of the 8-neighborhood is: starting from the neighbor point to the left of the pixel P, mark the 8-neighborhood counterclockwise as P0, P1, P2, P3, P4, P5, P6, P7; the direction code from P to P0 is 0, the direction code from P to P1 is 1, the direction code from P to P2 is 2, and the direction code from P to P3 is 3.
  • the code for the direction from P to P4 is 4, the code for the direction from P to P5 is 5, the code for the direction from P to P6 is 6, and the code for the direction from P to P7 is 7.
  • the pixels constituting the part of the handwritten Chinese characters are handwriting pixels; deleting the intersection points in the Chinese character skeleton can obtain multiple stroke segments, and each stroke segment is composed of multiple handwriting pixels; when a certain stroke When all handwriting pixels in the segment are traversed, the recording method of the direction encoding of a certain handwriting pixel A is as follows:
  • the first handwriting pixel accessed by the traversal operation has no direction code, and the direction codes of other handwriting pixels in the stroke segment form a set, which is the eight-neighborhood code chain of the stroke segment.
  • the upper left corner of the image is used as the origin of the coordinate system, the horizontal axis is positive to the right, and the vertical axis is positive to the vertical axis.
  • the specific coordinate data can be all positive integers.
  • centroid of a stroke segment of a static handwritten Chinese character or a stroke of a standard Chinese character is the mean value of all pixel coordinate values of the stroke segment or stroke.
  • the object of the present invention is to provide a method and system for recognizing stroke order in handwritten Chinese character images, aiming to solve the problem of stroke order recognition in static handwritten Chinese character images.
  • the invention provides a stroke order recognition method of a handwritten Chinese character image, comprising the following steps:
  • Preprocessing step Carry out Chinese character skeleton extraction operation to original handwritten Chinese character image, obtain Chinese character skeleton image; Carry out segmentation operation to described Chinese character skeleton, obtain the segmented image that contains a plurality of strokes; Described original handwritten Chinese character image only contains 1 handwritten Chinese character;
  • the first stroke order matching step through the branch and limit method, according to the stroke set, the stroke order matching operation is carried out to the stroke segments in the segmented image, and the successfully matched stroke segments are formed into a successful stroke segment set, and the stroke sequence from the successful stroke set is completed.
  • the first mapping from the segment set to the stroke set each stroke segment is mapped to a stroke order that matches successfully; the stroke segments that fail to match are formed into a failed stroke segment set, and the following second stroke order is performed on the failed stroke segment set matching step;
  • the acquisition method of the stroke set is: searching in the standardized Chinese character font library to obtain the standard stroke set of the handwritten Chinese characters in the original handwritten Chinese character image, referred to as the stroke set for short;
  • the establishment method of the standard Chinese character library is as follows: according to the eight-neighborhood direction coding rule, a standard Chinese character library is established for all Chinese characters in the first-level font library of the national standard.
  • the standard Chinese character library is composed of a standard stroke set of each Chinese character, and the standard stroke The set includes the stroke order and centroid of each stroke;
  • stroke order matching step for the second time for each stroke segment in the described failed stroke segment set, calculate respectively the distance between the centroid of the stroke segment and the centroid of each stroke in the described stroke set, and form a distance set; The minimum distance in the distance set; find the stroke order of the stroke corresponding to the minimum distance in the stroke set, and determine that the stroke order matches the stroke successfully; complete the second mapping from the failed stroke set to the stroke set : Map each stroke segment to a successful matching stroke order;
  • any handwriting pixel point of the Chinese character skeleton image in the described preprocessing step only has 4 or less adjacent handwriting pixel points in its eight neighborhoods; There is only one adjacent handwriting pixel in its eight neighborhoods, and there are only two adjacent handwriting pixels in its eight neighborhoods;
  • the standard stroke set in the standard Chinese character font library also includes illegal direction coding and legal direction coding of each stroke;
  • the rules for encoding the illegal direction are:
  • the illegal direction codes are 0 and 4;
  • the illegal direction codes are 0 and 4;
  • the rules for encoding the legal direction are:
  • the main direction code of the stroke is the most frequently occurring direction code in the eight-neighborhood coding chain of the stroke.
  • the stroke matching operation in the first stroke order matching step includes the following steps:
  • Matching weight calculation step calculate the main direction code of each stroke segment, and compare the illegal direction codes of all strokes in the stroke set respectively: if the main direction code of the stroke segment does not belong to the illegal direction code of one of the strokes Direction coding, calculate the matching weight of the stroke segment and the stroke, and continue to compare the next stroke; otherwise, determine that the stroke segment does not match the stroke, and continue to compare the next stroke; until the comparison of all strokes is completed;
  • the main direction code of the stroke segment is the direction code with the largest number of occurrences in the eight-neighborhood code chain of the stroke segment;
  • the matching weight is the distance between the centroid of the stroke segment and the centroid of the stroke
  • Step of matching stroke order according to all matching weights of each stroke segment, complete the first mapping by branch and bound method.
  • the stroke fusion operation in the stroke fusion step comprises the following steps:
  • (1) stroke coding step take the starting point as the starting point to traverse each stroke in the stroke set to be fused, and calculate the direction coding of each handwriting pixel except the starting point according to the eight-neighborhood direction coding rule , each of the direction codes constitutes an eight-neighborhood code chain of the segment according to the traversal order of the traversal operation;
  • Step of flipping strokes for each stroke in the set of strokes to be fused, search for the image of the stroke in the third mapping, and search in the set of strokes according to the image of the stroke
  • the legal direction code of the corresponding stroke judge whether the eight-neighborhood coding chain of the stroke segment is included in the legal direction code, if not, flip the stroke segment, and put the reversed stroke segment into the to-be-fused Stroke set, delete the stroke before flipping; otherwise, do not flip the stroke, and keep the stroke in the set of strokes to be fused;
  • Fusion stroke step arbitrarily get two strokes in the collection of strokes to be fused: the first stroke and the second stroke, for the initial pixel P1 and the termination pixel P2 of the first stroke, And the start pixel point P3 and the end pixel point P4 of the second stroke, calculate the distance D1, D2, D3 and D4; D1 is the distance between P1 and P3, D2 is the distance between P1 and P4, and D3 is P2 The distance between P1 and P3, D4 is the distance between P2 and P4; if the smallest distance among D1 ⁇ D4 is less than the set threshold, the two closest points among P1 ⁇ P4 are taken for fusion, and the fused The strokes are put into the set of strokes to be fused; otherwise, it is determined that the fusion fails, and the strokes that fail to fuse are deleted; the strokes that fail to fuse are those belonging to all Describe the strokes of the failure stroke set;
  • Fusion completion step repeatedly execute the step of fusing strokes for the set of strokes to be fused until one stroke is fused.
  • the invention provides a stroke order recognition system for handwritten Chinese character images, comprising:
  • Stroke set acquisition module used to establish a standardized Chinese character font library for all Chinese characters in the national standard first-level font library according to the eight-neighborhood direction coding rule.
  • the standardized Chinese character font library is composed of a standard stroke set for each Chinese character. The order of strokes and the center of mass of each stroke; the standard stroke set of the handwritten Chinese character in the original handwritten Chinese character image is searched in the described standardized Chinese character font library, hereinafter referred to as the stroke set;
  • the original handwritten Chinese character image only contains 1 handwritten Chinese character
  • Preprocessing module for extracting the Chinese character skeleton from the original handwritten Chinese character image to obtain a Chinese character skeleton image; performing a segmentation operation on the Chinese character skeleton to obtain a segmented image containing multiple stroke segments;
  • the first stroke order matching module used to perform a stroke order matching operation on the stroke segments in the segmented image according to the stroke set through the branch and limit method, and form the successfully matched stroke segments into a successful stroke segment set, and complete the process from the successful
  • the first mapping from the stroke set to the stroke set each stroke is mapped to the stroke order of the successful match; the strokes that fail to match are formed into a failed stroke set, and the following second steps are performed on the failed stroke set: Operations in the stroke order matching module;
  • the second stroke order matching module for each stroke segment in the failed stroke set, calculate the distance between the centroid of the stroke segment and the centroid of each stroke in the stroke set, and form a distance set; find the The minimum distance in the distance set; find the stroke order of the stroke corresponding to the minimum distance in the stroke set, and determine that the stroke order matches the stroke successfully; complete the second mapping from the failed stroke set to the stroke set: Map each stroke segment to a successful matching stroke order;
  • Stroke fusion module for merging the first mapping and the second mapping into a third mapping, and combining more than 2 stroke segments mapped to the same stroke order in the third mapping to form a stroke to be fused in this stroke order Segment sets; respectively perform a stroke fusion operation on each of the sets of strokes to be fused: fuse the strokes in each set of strokes to be fused into one stroke.
  • any handwriting pixel point of the skeleton image of Chinese characters in the preprocessing module only has 4 or less adjacent handwriting pixel points in its eight neighborhoods; There is only one adjacent handwriting pixel in its eight neighborhoods, and there are only two adjacent handwriting pixels in its eight neighborhoods;
  • the standard stroke set in the stroke set acquisition module also includes illegal direction coding and legal direction coding of each stroke;
  • the rules for encoding the illegal direction are:
  • the illegal direction codes are 0 and 4;
  • the illegal direction codes are 0 and 4;
  • the rules for encoding the legal direction are:
  • the main direction code of the stroke is the most frequently occurring direction code in the eight-neighborhood coding chain of the stroke.
  • the first stroke order matching module includes the following submodules:
  • Matching weight calculation sub-module used to calculate the main direction code of each stroke segment, and compare the illegal direction codes of all strokes in the stroke set: if the main direction code of the stroke segment does not belong to the illegal direction code of one of the strokes Direction coding, calculate the matching weight of the stroke segment and the stroke, and continue to compare the next stroke; otherwise, determine that the stroke segment does not match the stroke, and continue to compare the next stroke; until the comparison of all strokes is completed;
  • the main direction code of the stroke segment is the direction code with the largest number of occurrences in the eight-neighborhood code chain of the stroke segment;
  • the matching weight is the distance between the centroid of the stroke segment and the centroid of the stroke
  • Matching stroke order sub-module used to complete the first mapping by branch and bound method according to all the matching weights of each stroke segment.
  • the stroke fusion module includes the following submodules:
  • Stroke coding sub-module used for traversing each stroke in the set of strokes to be fused with the starting point as the starting point, and calculating the direction coding of each handwriting pixel except the starting point according to the eight-neighborhood direction coding rule , each of the direction codes constitutes an eight-neighborhood code chain of the segment according to the traversal order of the traversal operation;
  • Flip stroke sub-module for each stroke segment in the set of stroke segments to be fused, search for the image of the stroke segment in the third mapping, and search for the corresponding stroke segment in the stroke set according to the image of the stroke segment
  • the legal direction code of the stroke judge whether the eight-neighborhood coding chain of the stroke segment is included in the legal direction code, if not, then flip the stroke segment, and put the flipped stroke segment into the pen to be fused Segment set, delete the stroke before flipping; otherwise, do not flip the stroke, and keep the stroke in the set of strokes to be fused;
  • Fusion stroke sub-module used to arbitrarily take two strokes in the set of strokes to be fused: the first stroke and the second stroke, the starting pixel P1 and the ending pixel P2 of the first stroke, and The starting pixel point P3 and the ending pixel point P4 of the second stroke segment calculate the distances D1, D2, D3 and D4; D1 is the distance between P1 and P3, D2 is the distance between P1 and P4, and D3 is the distance between P2 and The distance between P3, D4 is the distance between P2 and P4; if the smallest distance among D1 ⁇ D4 is less than the set threshold, then take the two closest points among P1 ⁇ P4 for fusion, and the fused pen Put the segment into the set of segments to be fused; otherwise, it is judged that the fusion has failed, and the segment that fails to be merged is deleted; the segment that fails to fuse is the segment that belongs to the The strokes of the failed stroke set;
  • Fusion completion sub-module it is used to repeatedly execute the operation in the fusion stroke sub-module of the stroke segment set to be fused until it is fused into one stroke segment.
  • the invention provides a stroke order recognition device for a handwritten Chinese character image, which is characterized in that it includes a memory and a processor; the memory is used to store a computer program; and the processor is used to realize when the computer program is executed.
  • the present invention provides a computer-readable storage medium, which is characterized in that a computer program is stored on the storage medium, and when the computer program is executed by a processor, the method for recognizing the stroke order of a handwritten Chinese character image as described above is realized.
  • the stroke order recognition method provided by the present invention is aimed at static handwritten Chinese character images, the writing experience of the writer writing Chinese characters on paper is more real and smooth, avoiding the need for writing or distortion of the experience of writing on electronic devices.
  • the present invention fully considers the different stroke types of Chinese characters, and studies and summarizes this based on the eight-neighborhood direction coding rules, provides the illegal direction coding of different types of strokes, and calculates the first stroke order matching step according to the illegal direction coding.
  • Matching weight, the first stroke order matching method of the present invention is meticulous and comprehensive, and can achieve the beneficial effect of high stroke order matching accuracy.
  • the matching weight of the present invention is the distance between the centroid of the stroke segment and the centroid of the stroke, and the calculation method is simple and effective.
  • the invention performs the first stroke order matching and the second stroke order matching on handwritten Chinese characters, which can ensure that each stroke segment in the handwritten Chinese characters has a matching stroke order.
  • the present invention Compared with the prior art that achieves stroke fusion by setting thresholds, the present invention fully considers different stroke types of Chinese characters, and realizes stroke fusion through eight-neighborhood coding chains of different strokes and legal direction coding of different strokes.
  • the stroke fusion method is more detailed and comprehensive, and can achieve the beneficial effect of high accuracy of stroke fusion.
  • the accuracy rate of stroke order recognition in static handwritten Chinese character images can be effectively improved.
  • Fig. 1 is the flow chart of the stroke order recognition method of the handwritten Chinese character image that the embodiment of the present invention provides;
  • Fig. 2 is the flowchart of the stroke order matching operation in the stroke order matching step for the first time in the stroke order recognition method of the handwritten Chinese character image provided by the embodiment of the present invention
  • Fig. 3 is the flow chart of the stroke fusion operation in the stroke fusion step in the stroke order recognition method of the handwritten Chinese character image provided by the embodiment of the present invention
  • Fig. 4 is the original handwritten Chinese character image in the stroke order recognition method of the handwritten Chinese character image provided by the embodiment of the present invention
  • Fig. 5 is the marked Chinese character image in the stroke order recognition method of the handwritten Chinese character image provided by the embodiment of the present invention.
  • Fig. 6 is the schematic diagram of the eight-neighborhood direction encoding rule in the stroke order recognition method of the handwritten Chinese character image that the embodiment of the present invention provides;
  • Fig. 7 is a schematic diagram of stroke segments in a segmented image in a stroke order recognition method for a handwritten Chinese character image provided by an embodiment of the present invention.
  • the stroke order recognition method for handwritten Chinese character images includes a preprocessing step, a first stroke order matching step, a second stroke order matching step, a stroke segment fusion step, and a restoration and normalization step.
  • the preprocessing steps are performed: extracting the Chinese character skeleton from the original handwritten Chinese character image to obtain the Chinese character skeleton image; performing segmentation operation on the Chinese character skeleton to obtain the segmented image containing multiple stroke segments.
  • the original handwritten Chinese character image is shown in Figure 4, and the method for obtaining the original handwritten Chinese character image includes the following steps:
  • A0 On A4 size paper, design squares of uniform size
  • A1 Writers are asked to write a Chinese character in each square
  • A2 Use a photographing instrument to photograph the written paper to obtain the original image
  • A3 Extract the outline of the original image, divide each grid, and extract the handwritten Chinese characters in each grid; the handwritten Chinese character image in a single grid is the original handwritten Chinese character image.
  • the stroke order recognition method provided by the embodiment of the present invention is aimed at static handwritten Chinese character images, and the writing experience of the writer writing Chinese characters on paper is more realistic and smooth, thus avoiding the distortion of the writer's writing experience on electronic devices.
  • B0-0 Perform contour recognition on a single Chinese character image, and extract the enclosing rectangle of the Chinese character;
  • B0-2 Use the perspective projection matrix to segment and extract the square bounding box, and scale it to a size of 500*500 pixels.
  • B1-1 Use the Zhang-Suen thinning algorithm to process the Chinese character image to obtain the preliminary thinned Chinese character skeleton
  • the split operation consists of the following steps:
  • C0 Delete the intersection points in the Chinese character skeleton image, store the intersection points in the first list L1, delete redundant noise points, divide the strokes of Chinese characters into multiple stroke segments, and obtain a preliminary segmented image; among them, in its eight neighbors
  • the number of handwriting pixel points contained in is greater than or equal to 3, which is an intersection point;
  • C1 traverse the preliminary segmented image, find the starting and ending points of all strokes, and store them in the second list L2;
  • C2 Take out a start and end point of each stroke segment from the second list L2, traverse the stroke segment, find out the inflection point in the stroke segment, and delete the inflection point;
  • C3 Traversing the first list L1 of intersections, connecting two intersections whose distance is less than the threshold, if there is no inflection point in the connected stroke, keep the connected stroke; if there is an inflection point, cancel the connection; the threshold can be Set to 6.
  • the first stroke order matching step is as follows: through the branch and boundary method, perform stroke order matching operation on the stroke segments in the segmented image according to the stroke set, form the successful stroke segment set with the successfully matched stroke segments, and complete the process from the successful stroke segment set to the stroke set.
  • the first mapping each stroke segment is mapped to the stroke order that matches successfully; the stroke segments that fail to match are formed into a failed stroke segment set, and the following second stroke order matching step is performed on the failed stroke segment set.
  • the method for obtaining the stroke set is: searching the standard stroke set of the handwritten Chinese characters in the original handwritten Chinese character image in the standardized Chinese character font library, referred to as the stroke set for short.
  • the establishment method of the standardized Chinese character font is as follows: according to the eight-neighborhood direction coding rule shown in Figure 6, a standardized Chinese character font is established for all Chinese characters in the national standard first-level font.
  • the standardized Chinese character font is composed of the standard stroke set of each Chinese character, and the standard stroke The set includes stroke order, centroid, illegal direction code and legal direction code for each stroke.
  • the illegal direction codes are 0 and 4;
  • the illegal direction codes are 0 and 4;
  • the main direction code of a stroke is the most frequently occurring direction code in the eight-neighborhood coding chain of the stroke.
  • the stroke order matching operation includes a matching weight calculation step and a stroke order matching step:
  • Matching weight calculation steps calculate the main direction code of each stroke segment, and compare the illegal direction codes of all strokes in the stroke set: if the main direction code of the stroke segment does not belong to the illegal direction code of one of the strokes, calculate the stroke segment and The matching weight of the stroke, and continue to compare the next stroke; otherwise, determine that the stroke does not match the stroke, and continue to compare the next stroke; until the comparison of all strokes is completed;
  • the main direction code of a stroke segment is the direction code that appears most frequently in the eight-neighborhood code chain of the stroke segment.
  • the matching weight is the distance between the centroid of the stroke segment and the centroid of the stroke.
  • the matching weight calculation method in the embodiment of the present invention is simple and effective.
  • the embodiment of the present invention fully considers the different stroke types of Chinese characters, and conducts research and summary based on the eight-neighborhood direction coding rules, provides the illegal direction coding of different types of strokes, and calculates the first stroke order matching step according to the illegal direction coding
  • the matching weight in the first stroke order matching method of the embodiment of the present invention is meticulous and comprehensive, and can achieve the beneficial effect of high stroke order matching accuracy.
  • Steps of matching stroke order according to all matching weights of each stroke segment, stroke order matching is performed by the branch-and-bound method, and the successfully matched stroke segments are formed into a successful stroke segment set, and the first mapping from the successful stroke segment set to the stroke set is completed: Each stroke segment is mapped to a stroke order that matches successfully; the stroke segments that fail to match are formed into a failed stroke segment set, and the following second stroke order matching operation is performed on the failed stroke segment set.
  • the second stroke order matching step is: for each stroke segment in the failed stroke segment set, calculate the distance between the centroid of the stroke segment and the centroid of each stroke in the stroke set, and form a distance set; find the minimum distance in the distance set; find The stroke order of the stroke corresponding to the minimum distance in the stroke set determines that the stroke order matches the stroke segment successfully; complete the second mapping from the failed stroke segment set to the stroke set: map each stroke segment to the stroke order that matches successfully.
  • the embodiment of the present invention performs the first stroke order matching and the second stroke order matching for handwritten Chinese characters, so as to ensure that each stroke segment in the handwritten Chinese characters has a matching stroke order.
  • the stroke fusion step is: the first mapping and the second mapping are merged into a third mapping, and more than two strokes mapped to the same stroke order in the third mapping form the stroke set to be fused for this stroke order; Stroke fusion operation for the stroke set to be fused: merge the strokes in each stroke set to be fused into one stroke.
  • the stroke fusion operation includes a stroke encoding step, a flipping stroke step, a fusion stroke step and a fusion completion step:
  • Stroke coding steps take the starting point as the starting point to traverse each stroke in the fusion stroke set, and calculate the direction coding of each handwriting pixel except the starting point according to the eight-neighborhood direction coding rule, and the coding of each direction is according to the traversal
  • the traversal order of operations constitutes the eight-neighborhood encoding chain of the segment.
  • Turn over the stroke step treat each stroke in the fusion stroke set, search for the image of the stroke in the third mapping, and search for the legal direction code of the corresponding stroke in the stroke set according to the image of the stroke; judge the Whether the eight-neighborhood coding chain of the stroke segment is included in the legal direction code, if not, then flip the stroke segment, put the flipped stroke segment into the set of stroke segments to be fused, and delete the stroke segment before flipping; otherwise , the stroke is not flipped, and the stroke remains in the set of strokes to be merged.
  • the method of flipping the stroke segment if the stroke segment u contains n handwriting pixels, i.e. u: ⁇ p 0 , p 1 ,..., p n-2 , p n-1 ⁇ , then flip the result of the stroke segment u is u′: ⁇ p n-1 , p n-2 ,..., p 1 , p 0 ⁇ ;
  • Step of fusing strokes any two strokes in the set of strokes to be fused: the first stroke and the second stroke, the starting pixel point P1 and the ending pixel point P2 of the first stroke, and the second stroke
  • the starting pixel point P3 and the ending pixel point P4 calculate the distance D1, D2, D3 and D4; D1 is the distance between P1 and P3, D2 is the distance between P1 and P4, D3 is the distance between P2 and P3 D4 is the distance between P2 and P4; if the smallest distance among D1 ⁇ D4 is less than the set threshold, take the two closest points among P1 ⁇ P4 for fusion, and put the fused strokes into the pending Fusion of the stroke set; otherwise, it is determined that the fusion fails, and the stroke of the fusion failure is deleted; the stroke of the fusion failure is the stroke that belongs to the failed stroke set in the first stroke and the second stroke.
  • Fusion completion step Repeat step E2 for the stroke segment set to be fused until it is fused into one stroke segment.
  • the embodiment of the present invention Compared with the prior art that achieves stroke fusion by setting thresholds, the embodiment of the present invention fully considers different stroke types of Chinese characters, and realizes stroke fusion through eight-neighborhood coding chains of different strokes and legal direction coding of different strokes.
  • the stroke fusion method of the embodiment of the invention is more detailed and comprehensive, and can achieve the beneficial effect of high stroke fusion accuracy.
  • the restoration and normalization step is: perform restoration and normalization operation on the segmented image after performing stroke fusion operation, and obtain the marked Chinese character image with stroke order marking completed, including the following sub-steps:
  • F1 Use the inverse matrix to restore and normalize the pixels in each stroke; the size of the image after restoration and normalization is still 500*500 pixels, and all strokes are restored to their positions before restoration and normalization;
  • the stroke order recognition system for handwritten Chinese character images includes a stroke set acquisition module, a preprocessing module, a first stroke order matching module, a second stroke order matching module, a stroke segment fusion module and a restoration and normalization module.
  • the stroke set acquisition module is used to establish a standardized Chinese character font for all Chinese characters in the national standard first-level font according to the eight-neighborhood direction coding rule.
  • the standardized Chinese character font is composed of a standard stroke set for each Chinese character.
  • the standard stroke set includes the stroke order of each stroke. Centroid, illegal direction coding and legal direction coding; look up the standard stroke set of handwritten Chinese characters in the original handwritten Chinese character image in the standardized Chinese character font library, hereinafter referred to as the stroke set.
  • the illegal direction codes are 0 and 4;
  • the illegal direction codes are 0 and 4;
  • the main direction code of a stroke is the most frequently occurring direction code in the eight-neighborhood coding chain of the stroke.
  • the preprocessing module is used for extracting the Chinese character skeleton from the original handwritten Chinese character image to obtain the Chinese character skeleton image; performing segmentation operation on the Chinese character skeleton to obtain the segmented image containing multiple stroke segments.
  • the extraction operation of the Chinese character skeleton is: performing normalization processing on the original handwritten Chinese character image; performing thinning processing on the normalized Chinese character image to obtain the Chinese character skeleton image.
  • the acquisition method of the original handwritten Chinese character image is as follows: on A4 size paper, design squares of uniform size; ask the writer to write a Chinese character in each square; use a photographing instrument to photograph the written paper to obtain the original image ; Extract the outline of the original image, divide each grid, and extract the handwritten Chinese characters in each grid; the handwritten Chinese character image in a single grid is the original handwritten Chinese character image.
  • the normalization processing operation is: conduct contour recognition on a single Chinese character image, extract the enclosing rectangle of the Chinese character; expand and extract the square enclosing box from the enclosing rectangle; use the perspective projection matrix to segment and extract the square enclosing box, and scale it to 500*500 The size of the pixel.
  • the thinning processing operation is as follows: perform grayscale and binarization processing operations on the Chinese character image in turn; use the Zhang-Suen thinning algorithm to process the Chinese character image to obtain the preliminary thinned Chinese character skeleton; use the index table thinning algorithm to process the preliminary The thinned Chinese character skeleton is processed again to obtain the final Chinese character skeleton image.
  • Any handwriting pixel of the Chinese character skeleton image has only 4 or less adjacent handwriting pixels in its eight-neighborhood.
  • the split operation is:
  • the first stroke order matching module is used to perform a stroke order matching operation on the stroke segments in the segmented image according to the stroke set through the branch and limit method, and form the successfully matched stroke segments into a successful stroke set to complete the process from the successful stroke set to the stroke set.
  • the first mapping each stroke is mapped to the stroke order that matches successfully; the strokes that fail to match are formed into a failed stroke set, and the operation in the following second stroke order matching module is performed on the failed stroke set.
  • the first stroke order matching module includes the following submodules:
  • Matching weight calculation sub-module used to calculate the main direction code of each stroke segment, and compare the illegal direction codes of all strokes in the stroke set: if the main direction code of the stroke segment does not belong to the illegal direction code of one of the strokes, then calculate the The matching weight of the stroke segment and the stroke, and continue to compare the next stroke; otherwise, determine that the stroke segment does not match the stroke, and continue to compare the next stroke; until the comparison of all strokes is completed;
  • the main direction code of a stroke segment is the direction code that appears most frequently in the eight-neighborhood code chain of the stroke segment.
  • the matching weight is the distance between the centroid of the stroke segment and the centroid of the stroke.
  • Matching stroke order sub-module it is used to perform stroke order matching through the branch and limit method according to all matching weights of each stroke segment, to form the successful stroke segment set from the successful stroke segment set, and to complete the first step from the successful stroke segment set to the stroke set
  • Mapping Map each stroke segment to the stroke order that matches successfully; combine the stroke segments that fail to match into a failed stroke segment set, and perform the following operations in the second stroke order module on the failed stroke segment set.
  • the second stroke order matching module is used to calculate the distance between the centroid of the stroke segment and the centroid of each stroke in the stroke set for each stroke segment in the failed stroke segment set, and form a distance set; find the minimum distance in the distance set; find The stroke order of the stroke corresponding to the minimum distance in the stroke set determines that the stroke order matches the stroke segment successfully; complete the second mapping from the failed stroke segment set to the stroke set: map each stroke segment to the stroke order that matches successfully.
  • the stroke fusion module is used to merge the first mapping and the second mapping into a third mapping, and more than two strokes mapped to the same stroke order in the third mapping form the stroke set to be fused in this stroke order; Stroke fusion operation for the stroke set to be fused: merge the strokes in each stroke set to be fused into one stroke.
  • the stroke fusion module includes the following submodules:
  • Stroke segment encoding sub-module used to traverse each segment of the stroke segment set to be fused with the starting point as the starting point, and calculate the direction encoding of each handwriting pixel point except the starting point according to the eight-neighborhood direction encoding rule, each direction
  • the coding forms the eight-neighborhood coding chain of the segment according to the traversal sequence of the traversal operation.
  • Flip stroke segment sub-module for each stroke segment in the fused stroke segment set, look up the image of the stroke segment in the third mapping, and search for the legal direction code of the corresponding stroke in the stroke set according to the image of the stroke segment; Determine whether the eight-neighborhood coding chain of the stroke is included in the legal direction code, if not, flip the stroke, put the flipped stroke into the stroke set to be merged, and delete the stroke before flipping ; Otherwise, the stroke is not flipped, and the stroke remains in the set of strokes to be fused.
  • the method of flipping the stroke segment if the stroke segment u contains n handwriting pixels, i.e. u: ⁇ p 0 , p 1 ,..., p n-2 , p n-1 ⁇ , then flip the result of the stroke segment u is u′: ⁇ p n-1 , p n-2 ,..., p 1 , p 0 ⁇ ;
  • Fusion stroke sub-module used to arbitrarily take two strokes in the collection of strokes to be fused: the first stroke and the second stroke, the starting pixel P1 and the ending pixel P2 of the first stroke, and the second stroke
  • the starting pixel point P3 and the ending pixel point P4 of the stroke calculate the distance D1, D2, D3 and D4;
  • D1 is the distance between P1 and P3,
  • D2 is the distance between P1 and P4,
  • D3 is the distance between P2 and P3 D4 is the distance between P2 and P4; if the smallest distance among D1 ⁇ D4 is less than the set threshold, take the two closest points among P1 ⁇ P4 for fusion, and put the fused strokes into Enter the stroke segment set to be fused; otherwise, it is determined that the fusion fails, and the stroke segment that fails to be fused is deleted;
  • the stroke segment that fails to fuse is the stroke segment that belongs to the failed stroke set in the first stroke segment and the second stroke segment set.
  • Fusion completion sub-module it is used to repeatedly execute the operation in the fusion stroke sub-module of the stroke segment set to be fused until it is fused into one stroke segment.
  • the restoration and normalization module is used to perform the restoration and normalization operation on the segmented image after performing the stroke fusion operation, and obtain the labeled Chinese character image with the stroke order labeling completed.
  • the restore normalization operation is:

Abstract

一种手写汉字图像的笔顺识别方法及系统,其中,笔顺识别方法包括预处理步骤、第一次笔顺匹配步骤、第二次笔顺匹配步骤和笔段融合步骤;笔顺识别方法是针对静态手写汉字图像,避免了在电子设备上书写体验的失真;基于八邻域方向编码规则给出了不同类型笔画的非法方向编码,并根据非法方向编码来计算第一次笔顺匹配步骤中的匹配权重;对手写汉字进行第一次笔顺匹配和第二次笔顺匹配,可确保手写汉字中的每个笔段都有匹配的笔顺;通过不同笔段的八邻域编码链和不同笔画的合法方向编码来实现笔段融合;通过笔顺识别方法,能有效提高静态手写汉字图像中笔顺识别的准确率。

Description

一种手写汉字图像的笔顺识别方法及系统 【技术领域】
本发明属于计算机图像处理技术领域,更具体地,涉及一种手写汉字图像的笔顺识别方法及系统。
【背景技术】
在规范汉字书写教学的整个过程中,小学低年级的汉字教学是基础所在,但低年级的多数学习者书写出的汉字风格多变,对每个学生写过的所有汉字都给出纠正信息并辅助改正很难实现。且大部分家长和教师没有受过严格的、系统的规范汉字书写教育,即使最终能实现一对一的辅导,教师和家长也无法对学生书写的汉字给出具体化和规范化的评价信息。
随着信息技术的不断发展与完善,已经出现了很多计算机辅助的汉字书写评价系统。相关研究工作可以分为事后评价和实时评价两类。事后评判是指让书写者不受打扰一次性书写完目标汉字,然后提取其手写汉字的特征数据与模版汉字进行对比并进行规范性评价;实时评判,则是指书写者每次写完目标汉字的一个笔画,系统立即评判其规范性。这两类系统的研究都已经有相当多的成果,且主要的关注点都在于手写汉字笔顺的正确性。
要深入研究手写汉字笔顺的正确性评价,手写汉字的数据化十分重要。目前很多汉字书写教学系统都是通过类似于书写平板之类设备搭配电容笔来进行汉字数据采集,电子设备有时序数据,能够很方便的采集到书写者手写汉字的笔顺信息。然而,此类设备大多较为坚硬且表面光滑,影响书写体验,在电子屏上书写时很难得到真正笔纸的书写体验。此外,电子设备采集了汉字笔段数据后,一般通过设置阈值来实现笔段融合,而很少考虑汉字笔画本身的特征。
让书写者使用硬笔在特定纸张上书写目标汉字,通过拍照采集原始图像,最后通过计算机图像处理技术从中提取出手写汉字的字迹数据,可以避免书写者在书写体验上的失真,但同时带来了笔顺识别的困难,静态手写汉字图像没有时序数据,要从静态手写汉字图像中识别出手写汉字的笔顺存在许多难点。
汉字骨架提取操作是静态手写汉字笔顺识别的重要步骤,对静态手写汉字进行汉字骨架提取操作能得到汉字骨架,汉字骨架能正确反映汉字的拓扑结构,没有多余的毛刺或旁枝。
一幅静态手写汉字图像中的任一像素P有4个相邻的像素,分别位于其上下左右,这4个像素是像素P的4邻域;像素P的D邻域是像素p的四个顶点对应的点;像素P的4邻域和D邻域组成像素P的八邻域;八邻域方向编码规则为:以像素P左边的邻域点为起点,逆时针将八邻域标记为P0、P1、P2、P3、P4、P5、P6、P7;P到P0的方向编码为0,P到P1的方向编码为1,P到P2的方向编码为2,P到P3的方向编码为3,P到P4的方向编码为4,P到P5的方向编码为5,P到P6的方向编码为6,P到P7的方向编码为7。
一幅静态手写汉字图像中构成手写汉字部分的像素点为笔迹像素点;删除汉字骨架中的交叉点可得到多个笔段,每个笔段由多个笔迹像素点组成;当对某个笔段中的所有笔迹像素点进行遍历操作时,某一笔迹像素点A的方向编码的记录方法如下:
(1)确定遍历操作中A的上一笔迹像素点A0;
(2)查找在A0的八邻域中,A所处的位置以及A0到A的方向编码X;
(3)将A的方向编码记为X,即X对应的笔迹像素点为A。
因此,遍历操作访问的第一个笔迹像素点没有方向编码,将该笔段中其他笔迹像素点的方向编码组成一个集合,即为该笔段的八邻域编码链。
根据八邻域方向编码规则对国标一级字库中的标准汉字建立八邻域编 码链时,将上述记录方法中的笔迹像素点替换为构成标准汉字的像素点,将笔段替换为笔画,即可得到构成标准汉字的每个笔画的八邻域编码链。
一幅静态手写汉字图像或标准汉字图像中,采用图像的左上角做为坐标系的原点,水平向右为横轴坐标轴正方向,垂直向下为纵轴坐标轴正方向,选取此坐标系可以使具体的坐标数据全为正整数。
静态手写汉字的笔段或标准汉字的笔画的质心为该笔段或该笔画的所有像素点坐标值的均值。
发明内容
针对现有技术的缺陷,本发明的目的在于提供一种手写汉字图像的笔顺识别方法及系统,旨在解决静态手写汉字图像中的笔顺识别的问题。
为实现上述目的,本发明提供了一种手写汉字图像的笔顺识别方法,包括以下步骤:
(1)预处理步骤:对原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对所述汉字骨架进行分割操作,得到含有多个笔段的分割图像;所述原始手写汉字图像仅包含1个手写汉字;
(2)第一次笔顺匹配步骤:通过分支界限法,根据笔画集对所述分割图像中的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集,完成从所述成功笔段集到所述笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对所述失败笔段集执行下述第二次笔顺匹配步骤;
所述笔画集的获取方法为:在规范汉字字库中查找获得所述原始手写汉字图像中的手写汉字的标准笔画集,简称为笔画集;
所述规范汉字字库的建立方法为:根据八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,所述规范汉字字库由每个汉字的标准笔画集构成,所述标准笔画集包括每个笔画的笔顺和质心;
(3)第二次笔顺匹配步骤:对所述失败笔段集中的每个笔段,分别计算该笔段的质心与所述笔画集中每个笔画的质心的距离,并组成距离集;查找所述距离集中的最小距离;查找所述最小距离对应的笔画在所述笔画集中的笔顺,判定该笔顺与该笔段匹配成功;完成从所述失败笔段集到所述笔画集的第二映射:将每个笔段映射到匹配成功的笔顺;
(4)笔段融合步骤:将所述第一映射和所述第二映射合并为第三映射,将所述第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个所述待融合笔段集进行笔段融合操作:将每个所述待融合笔段集中的笔段融合为1个笔段。
优选地,所述预处理步骤中的汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点;所述预处理步骤中的笔段的起终点在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点;
所述规范汉字字库中的标准笔画集还包括每个笔画的非法方向编码和合法方向编码;
所述非法方向编码的规则为:
若该笔画的主方向编码为0,则非法方向编码为2和6;
若该笔画的主方向编码为1,则非法方向编码为3和7;
若该笔画的主方向编码为2,则非法方向编码为0和4;
若该笔画的主方向编码为3,则非法方向编码为1和5;
若该笔画的主方向编码为4,则非法方向编码为2和6;
若该笔画的主方向编码为5,则非法方向编码为3和7;
若该笔画的主方向编码为6,则非法方向编码为0和4;
若该笔画的主方向编码为7,则非法方向编码为1和5;
所述合法方向编码的规则为:
若该笔画的主方向编码为0,则合法方向编码为0、1和7;
若该笔画的主方向编码为1,则合法方向编码为0、1和2;
若该笔画的主方向编码为2,则合法方向编码为1、2和3;
若该笔画的主方向编码为3,则合法方向编码为2、3和4;
若该笔画的主方向编码为4,则合法方向编码为3、4和5;
若该笔画的主方向编码为5,则合法方向编码为4、5和6;
若该笔画的主方向编码为6,则合法方向编码为5、6和7;
若该笔画的主方向编码为7,则合法方向编码为0、6和7;
所述笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方向编码。
优选地,所述第一次笔顺匹配步骤中的笔段匹配操作包括以下步骤:
(1)匹配权重计算步骤:计算每个所述笔段的主方向编码,并分别对比所述笔画集中所有笔画的非法方向编码:若所述笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
所述笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码;
所述匹配权重为该笔段的质心与该笔画的质心之间的距离;
(2)匹配笔顺步骤:根据每个所述笔段的所有的匹配权重,通过分支界限法完成所述第一映射。
优选地,所述笔段融合步骤中的笔段融合操作包括以下步骤:
(1)笔段编码步骤:以起始点为起点对所述待融合笔段集中的每个笔段进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹像素点的方向编码,各个所述方向编码按所述遍历操作的遍历顺序构成该笔段的八邻域编码链;
(2)翻转笔段步骤:对所述待融合笔段集中的每个笔段,在所述所述 第三映射中查找该笔段的像,根据该笔段的像在所述笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入所述待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在所述待融合笔段集中;
(3)融合笔段步骤:任取所述待融合笔段集中的两个笔段:第一笔段和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入所述待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;所述融合失败的笔段为所述第一笔段和所述第二笔段中属于所述失败笔段集的笔段;
(4)融合完成步骤:对所述待融合笔段集重复执行所述融合笔段步骤,直至融合为1个笔段。
本发明提供了一种手写汉字图像的笔顺识别系统,包括:
笔画集获取模块:用于根据八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,所述规范汉字字库由每个汉字的标准笔画集构成,所述标准笔画集包括每个笔画的笔顺和质心;在所述规范汉字字库中查找原始手写汉字图像中的手写汉字的标准笔画集,以下简称为笔画集;
所述原始手写汉字图像仅包含1个手写汉字;
预处理模块:用于对所述原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对所述汉字骨架进行分割操作,得到含有多个笔段的分割图像;
第一次笔顺匹配模块:用于通过分支界限法,根据所述笔画集对所述分割图像中的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集, 完成从所述成功笔段集到所述笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对所述失败笔段集执行下述第二次笔顺匹配模块中的操作;
第二次笔顺匹配模块:用于对所述失败笔段集中的每个笔段,分别计算该笔段的质心与所述笔画集中每个笔画的质心的距离,并组成距离集;查找所述距离集中的最小距离;查找所述最小距离对应的笔画在所述笔画集中的笔顺,判定该笔顺与该笔段匹配成功;完成从所述失败笔段集到所述笔画集的第二映射:将每个笔段映射到匹配成功的笔顺;
笔段融合模块:用于将所述第一映射和所述第二映射合并为第三映射,将所述第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个所述待融合笔段集进行笔段融合操作:将每个所述待融合笔段集中的笔段融合为1个笔段。
优选地,所述预处理模块中的汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点;所述预处理模块中的笔段的起终点在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点;
所述笔画集获取模块中的标准笔画集还包括每个笔画的非法方向编码和合法方向编码;
所述非法方向编码的规则为:
若该笔画的主方向编码为0,则非法方向编码为2和6;
若该笔画的主方向编码为1,则非法方向编码为3和7;
若该笔画的主方向编码为2,则非法方向编码为0和4;
若该笔画的主方向编码为3,则非法方向编码为1和5;
若该笔画的主方向编码为4,则非法方向编码为2和6;
若该笔画的主方向编码为5,则非法方向编码为3和7;
若该笔画的主方向编码为6,则非法方向编码为0和4;
若该笔画的主方向编码为7,则非法方向编码为1和5;
所述合法方向编码的规则为:
若该笔画的主方向编码为0,则合法方向编码为0、1和7;
若该笔画的主方向编码为1,则合法方向编码为0、1和2;
若该笔画的主方向编码为2,则合法方向编码为1、2和3;
若该笔画的主方向编码为3,则合法方向编码为2、3和4;
若该笔画的主方向编码为4,则合法方向编码为3、4和5;
若该笔画的主方向编码为5,则合法方向编码为4、5和6;
若该笔画的主方向编码为6,则合法方向编码为5、6和7;
若该笔画的主方向编码为7,则合法方向编码为0、6和7;
所述笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方向编码。
优选地,所述第一次笔顺匹配模块包括以下子模块:
匹配权重计算子模块:用于计算每个所述笔段的主方向编码,并分别对比所述笔画集中所有笔画的非法方向编码:若所述笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
所述笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码;
所述匹配权重为该笔段的质心与该笔画的质心之间的距离;
匹配笔顺子模块:用于根据每个所述笔段的所有的匹配权重,通过分支界限法完成所述第一映射。
优选地,所述笔画融合模块包括以下子模块:
笔段编码子模块:用于以起始点为起点对所述待融合笔段集中的每个笔段进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹 像素点的方向编码,各个所述方向编码按所述遍历操作的遍历顺序构成该笔段的八邻域编码链;
翻转笔段子模块:用于对所述待融合笔段集中的每个笔段,在所述所述第三映射中查找该笔段的像,根据该笔段的像在所述笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入所述待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在所述待融合笔段集中;
融合笔段子模块:用于任取所述待融合笔段集中的两个笔段:第一笔段和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入所述待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;所述融合失败的笔段为所述第一笔段和所述第二笔段中属于所述失败笔段集的笔段;
融合完成子模块:用于对待融合笔段集重复执行融合笔段子模块中的操作,直至融合为1个笔段。
本发明提供了一种手写汉字图像的笔顺识别装置,其特征在于,包括存储器和处理器;所述存储器,用于存储计算机程序;所述处理器,用于当执行所述计算机程序时,实现如上所述的手写汉字图像的笔顺识别方法。
本发明提供了一种计算机可读存储介质,其特征在于,所述存储介质上存储有计算机程序,当所述计算机程序被处理器执行时,实现如上所述的手写汉字图像的笔顺识别方法。
通过本发明所构思的以上技术方案,与现有技术相比,由于本发明提供的笔顺识别方法是针对静态手写汉字图像,书写者在纸张上书写汉字的 书写体验更真实更顺畅,避免了书写者在电子设备上书写体验的失真。
本发明充分考虑汉字的不同笔画类型,并基于八邻域方向编码规则对此进行研究总结,给出了不同类型笔画的非法方向编码,并根据非法方向编码来计算第一次笔顺匹配步骤中的匹配权重,本发明的第一次笔顺匹配方法细致全面,能够取得笔顺匹配准确率高的有益效果。
本发明的匹配权重为该笔段的质心与该笔画的质心之间的距离,计算方法简单有效。
本发明对手写汉字进行第一次笔顺匹配和第二次笔顺匹配,可确保手写汉字中的每个笔段都有匹配的笔顺。
相比现有技术通过设置阈值来实现笔段融合,本发明充分考虑汉字的不同笔画类型,通过不同笔段的八邻域编码链和不同笔画的合法方向编码来实现笔段融合,本发明的笔段融合方法更细致更全面,能够取得笔段融合准确率高的有益效果。
通过本发明提供的笔顺识别方法,能有效提高静态手写汉字图像中笔顺识别的准确率。
【附图说明】
图1是本发明实施例提供的手写汉字图像的笔顺识别方法的流程图;
图2是本发明实施例提供的手写汉字图像的笔顺识别方法中第一次笔顺匹配步骤中的笔顺匹配操作的流程图;
图3是本发明实施例提供的手写汉字图像的笔顺识别方法中笔段融合步骤中的笔段融合操作的流程图;
图4是本发明实施例提供的手写汉字图像的笔顺识别方法中的原始手写汉字图像;
图5是本发明实施例提供的手写汉字图像的笔顺识别方法中的标注汉字图像;
图6是本发明实施例提供的手写汉字图像的笔顺识别方法中的八邻域 方向编码规则的示意图;
图7是本发明实施例提供的手写汉字图像的笔顺识别方法中的分割图像中的笔段的示意图。
【具体实施方式】
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
如图1所示,本发明实施例提供的手写汉字图像的笔顺识别方法包括预处理步骤、第一次笔顺匹配步骤、第二次笔顺匹配步骤、笔段融合步骤和还原归一步骤。
首先要执行预处理步骤:对原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对汉字骨架进行分割操作,得到含有多个笔段的分割图像。
原始手写汉字图像如图4所示,原始手写汉字图像的获取方法包括以下步骤:
A0:在A4大小的纸张上,设计大小统一的方格;
A1:请书写者在每个方格中书写一个汉字;
A2:使用拍摄仪器拍摄书写后的纸张,获得原始图像;
A3:对原始图像进行轮廓提取,分割每个方格,提取出每个方格中的手写汉字;单个方格中的手写汉字图像为原始手写汉字图像。
本发明实施例提供的笔顺识别方法是针对静态手写汉字图像,书写者在纸张上书写汉字的书写体验更真实更顺畅,因此避免了书写者在电子设备上书写体验的失真。
汉字骨架提取操作包括以下步骤:
B0:对原始手写汉字图像进行归一化处理操作,包括以下步骤:
B0-0:对单个汉字图像进行轮廓识别,提取汉字的包围矩形;
B0-1:从包围矩形中拓展提取出正方形包围框;
B0-2:使用透视投影矩阵将正方形包围框分割提取出来,并缩放到500*500像素的尺寸大小。
B1:对归一化处理操作后的汉字图像进行细化处理操作,得到汉字骨架图像,包括以下步骤:
B1-0:依次对汉字图像进行灰度化、二值化处理操作;
B1-1:使用Zhang-Suen细化算法对汉字图像进行处理,得到初步细化的汉字骨架;
B1-2:使用索引表细化算法对初步细化的汉字骨架进行再一次处理,得到最终的汉字骨架图像,汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点。
分割操作包括以下步骤:
C0:删除汉字骨架图像中的交叉点,将交叉点存入第一列表L1中,删除多余的噪声点,将汉字笔画分割成多个笔段,得到初步分割图像;其中,在其八邻域中包含的笔迹像素点个数大于等于3的笔迹像素点为交叉点;
C1:遍历初步分割图像,找到所有笔段的起终点,存入第二列表L2中;
C2:从第二列表L2中取出一个每个笔段的起终点,遍历该笔段,找出该笔段中的拐点,并删除该拐点;
C3:遍历交叉点第一列表L1,将距离小于阈值的两个交叉点进行连接,若连接后的笔段没有拐点,则保留该连接后的笔段;若存在拐点,则取消连接;阈值可设定为6。
如图7所示,分割操作完成之后,笔段的第一起终点L和第二起终点M在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点。
第一次笔顺匹配步骤为:通过分支界限法,根据笔画集对分割图像中 的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集,完成从成功笔段集到笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对失败笔段集执行下述第二次笔顺匹配步骤。
笔画集的获取方法为:在规范汉字字库中查找原始手写汉字图像中的手写汉字的标准笔画集,简称为笔画集。
规范汉字字库的建立方法为:根据如图6所示的八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,规范汉字字库由每个汉字的标准笔画集构成,标准笔画集包括每个笔画的笔顺,质心,非法方向编码和合法方向编码。
非法方向编码的规则为:
若该笔画的主方向编码为0,则非法方向编码为2和6;
若该笔画的主方向编码为1,则非法方向编码为3和7;
若该笔画的主方向编码为2,则非法方向编码为0和4;
若该笔画的主方向编码为3,则非法方向编码为1和5;
若该笔画的主方向编码为4,则非法方向编码为2和6;
若该笔画的主方向编码为5,则非法方向编码为3和7;
若该笔画的主方向编码为6,则非法方向编码为0和4;
若该笔画的主方向编码为7,则非法方向编码为1和5;
合法方向编码的规则为:
若该笔画的主方向编码为0,则合法方向编码为0、1和7;
若该笔画的主方向编码为1,则合法方向编码为0、1和2;
若该笔画的主方向编码为2,则合法方向编码为1、2和3;
若该笔画的主方向编码为3,则合法方向编码为2、3和4;
若该笔画的主方向编码为4,则合法方向编码为3、4和5;
若该笔画的主方向编码为5,则合法方向编码为4、5和6;
若该笔画的主方向编码为6,则合法方向编码为5、6和7;
若该笔画的主方向编码为7,则合法方向编码为0、6和7;
笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方向编码。
如图2所示,笔顺匹配操作包括匹配权重计算步骤和匹配笔顺步骤:
匹配权重计算步骤:计算每个笔段的主方向编码,并分别对比笔画集中所有笔画的非法方向编码:若笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码。
匹配权重为该笔段的质心与该笔画的质心之间的距离。本发明实施例的匹配权重计算方法简单有效。
本发明实施例充分考虑汉字的不同笔画类型,并基于八邻域方向编码规则对此进行研究总结,给出了不同类型笔画的非法方向编码,并根据非法方向编码来计算第一次笔顺匹配步骤中的匹配权重,本发明实施例的第一次笔顺匹配方法细致全面,能够取得笔顺匹配准确率高的有益效果。
匹配笔顺步骤:根据每个笔段的所有的匹配权重,通过分支界限法进行笔顺匹配,将匹配成功的笔段组成成功笔段集,完成从成功笔段集到笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对失败笔段集执行下述第二次笔顺匹配操作。
第二次笔顺匹配步骤为:对失败笔段集中的每个笔段,分别计算该笔段的质心与笔画集中每个笔画的质心的距离,并组成距离集;查找距离集中的最小距离;查找最小距离对应的笔画在笔画集中的笔顺,判定该笔顺与该笔段匹配成功;完成从失败笔段集到笔画集的第二映射:将每个笔段 映射到匹配成功的笔顺。
本发明实施例对手写汉字进行了第一次笔顺匹配和第二次笔顺匹配,可确保手写汉字中的每个笔段都有匹配的笔顺。
笔段融合步骤为:将第一映射和第二映射合并为第三映射,将第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个待融合笔段集进行笔段融合操作:将每个待融合笔段集中的笔段融合为1个笔段。
如图3所示,笔段融合操作包括笔段编码步骤,翻转笔段步骤,融合笔段步骤和融合完成步骤:
笔段编码步骤:以起始点为起点对待融合笔段集中的每个笔段进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹像素点的方向编码,各个方向编码按遍历操作的遍历顺序构成该笔段的八邻域编码链。
翻转笔段步骤:对待融合笔段集中的每个笔段,在所述第三映射中查找该笔段的像,根据该笔段的像在笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在待融合笔段集中。
翻转笔段的方法:若笔段u含有n个笔迹像素点,即u:{p 0,p 1,...,p n-2,p n-1},则翻转该笔段u的结果为u′:{p n-1,p n-2,...,p 1,p 0};
融合笔段步骤:任取待融合笔段集中的两个笔段:第一笔段和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;融合失败的笔段为第一笔段和 第二笔段中属于失败笔段集的笔段。
融合完成步骤:对待融合笔段集重复执行步骤E2,直至融合为1个笔段。
相比现有技术通过设置阈值来实现笔段融合,本发明实施例充分考虑汉字的不同笔画类型,通过不同笔段的八邻域编码链和不同笔画的合法方向编码来实现笔段融合,本发明实施例的笔段融合方法更细致更全面,能够取得笔段融合准确率高的有益效果。
还原归一步骤为:对执行笔段融合操作后的分割图像执行还原归一化操作,得到笔顺标注完成的标注汉字图像,包括以下子步骤:
F0:求解步骤B0中的透视投影矩阵的逆矩阵;
F1:使用逆矩阵将每个笔段中的像素点还原归一化;还原归一化之后的图像大小仍为500*500像素,且所有笔段复原到未经还原归一化之前的位置;
F2:标注所有笔段的笔顺,如图5所示,标号1~6为笔段的笔顺。
本发明实施例提供的手写汉字图像的笔顺识别系统包括笔画集获取模块,预处理模块,第一次笔顺匹配模块,第二次笔顺匹配模块,笔段融合模块和还原归一模块。
笔画集获取模块用于根据八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,规范汉字字库由每个汉字的标准笔画集构成,标准笔画集包括每个笔画的笔顺,质心,非法方向编码和合法方向编码;在规范汉字字库中查找原始手写汉字图像中的手写汉字的标准笔画集,以下简称为笔画集。
非法方向编码的规则为:
若该笔画的主方向编码为0,则非法方向编码为2和6;
若该笔画的主方向编码为1,则非法方向编码为3和7;
若该笔画的主方向编码为2,则非法方向编码为0和4;
若该笔画的主方向编码为3,则非法方向编码为1和5;
若该笔画的主方向编码为4,则非法方向编码为2和6;
若该笔画的主方向编码为5,则非法方向编码为3和7;
若该笔画的主方向编码为6,则非法方向编码为0和4;
若该笔画的主方向编码为7,则非法方向编码为1和5;
合法方向编码的规则为:
若该笔画的主方向编码为0,则合法方向编码为0、1和7;
若该笔画的主方向编码为1,则合法方向编码为0、1和2;
若该笔画的主方向编码为2,则合法方向编码为1、2和3;
若该笔画的主方向编码为3,则合法方向编码为2、3和4;
若该笔画的主方向编码为4,则合法方向编码为3、4和5;
若该笔画的主方向编码为5,则合法方向编码为4、5和6;
若该笔画的主方向编码为6,则合法方向编码为5、6和7;
若该笔画的主方向编码为7,则合法方向编码为0、6和7;
笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方向编码。
预处理模块用于对原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对汉字骨架进行分割操作,得到含有多个笔段的分割图像。
其中,汉字骨架提取操作为:对原始手写汉字图像进行归一化处理操作;对归一化处理操作后的汉字图像进行细化处理操作,得到汉字骨架图像。
其中,原始手写汉字图像的获取方法为:在A4大小的纸张上,设计大小统一的方格;请书写者在每个方格中书写一个汉字;使用拍摄仪器拍摄书写后的纸张,获得原始图像;对原始图像进行轮廓提取,分割每个方格,提取出每个方格中的手写汉字;单个方格中的手写汉字图像为原始手写汉字图像。
归一化处理操作为:对单个汉字图像进行轮廓识别,提取汉字的包围矩形;从包围矩形中拓展提取出正方形包围框;使用透视投影矩阵将正方形包围框分割提取出来,并缩放到500*500像素的尺寸大小。
细化处理操作为:依次对汉字图像进行灰度化、二值化处理操作;使用Zhang-Suen细化算法对汉字图像进行处理,得到初步细化的汉字骨架;使用索引表细化算法对初步细化的汉字骨架进行再一次处理,得到最终的汉字骨架图像,汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点。
分割操作为:
(1)删除汉字骨架图像中的交叉点,将交叉点存入第一列表L1中,删除多余的噪声点,将汉字笔画分割成多个笔段,得到初步分割图像;其中,在其八邻域中包含的笔迹像素点个数大于等于3的笔迹像素点为交叉点;
(2)遍历初步分割图像,找到所有笔段的起终点,存入第二列表L2中;
(3)从第二列表L2中取出一个每个笔段的起终点,遍历该笔段,找出该笔段中的拐点,并删除该拐点;
(4)遍历交叉点第一列表L1,将距离小于阈值的两个交叉点进行连接,若连接后的笔段没有拐点,则保留该连接后的笔段;若存在拐点,则取消连接;阈值可设定为6。
分割操作完成之后,笔段的第一起终点L和第二起终点M在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点。
第一次笔顺匹配模块用于通过分支界限法,根据笔画集对分割图像中的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集,完成从成功笔段集到笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹 配失败的笔段组成失败笔段集,对失败笔段集执行下述第二次笔顺匹配模块中的操作。
第一次笔顺匹配模块包括以下子模块:
匹配权重计算子模块:用于计算每个笔段的主方向编码,并分别对比笔画集中所有笔画的非法方向编码:若笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码。
匹配权重为该笔段的质心与该笔画的质心之间的距离。
匹配笔顺子模块:用于根据每个笔段的所有的匹配权重,通过分支界限法进行笔顺匹配,将匹配成功的笔段组成成功笔段集,完成从成功笔段集到笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对失败笔段集执行下述第二次笔顺模块中的操作。
第二次笔顺匹配模块用于对失败笔段集中的每个笔段,分别计算该笔段的质心与笔画集中每个笔画的质心的距离,并组成距离集;查找距离集中的最小距离;查找最小距离对应的笔画在笔画集中的笔顺,判定该笔顺与该笔段匹配成功;完成从失败笔段集到笔画集的第二映射:将每个笔段映射到匹配成功的笔顺。
笔段融合模块用于将第一映射和第二映射合并为第三映射,将第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个待融合笔段集进行笔段融合操作:将每个待融合笔段集中的笔段融合为1个笔段。
笔画融合模块包括以下子模块:
笔段编码子模块:用于以起始点为起点对待融合笔段集中的每个笔段 进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹像素点的方向编码,各个方向编码按遍历操作的遍历顺序构成该笔段的八邻域编码链。
翻转笔段子模块:用于对待融合笔段集中的每个笔段,在所述第三映射中查找该笔段的像,根据该笔段的像在笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在待融合笔段集中。
翻转笔段的方法:若笔段u含有n个笔迹像素点,即u:{p 0,p 1,...,p n-2,p n-1},则翻转该笔段u的结果为u′:{p n-1,p n-2,...,p 1,p 0};
融合笔段子模块:用于任取待融合笔段集中的两个笔段:第一笔段和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;融合失败的笔段为第一笔段和第二笔段中属于失败笔段集的笔段。
融合完成子模块:用于对待融合笔段集重复执行融合笔段子模块中的操作,直至融合为1个笔段。
还原归一模块用于对执行笔段融合操作后的分割图像执行还原归一化操作,得到笔顺标注完成的标注汉字图像。
还原归一化操作为:
(1)求解预处理模块中归一化处理操作中的透视投影矩阵的逆矩阵;
(2)使用逆矩阵将每个笔段中的像素点还原归一化;还原归一化之后的图像大小仍为500*500像素,且所有笔段复原到未经还原归一化之前的 位置;
(3)标注所有笔段的笔顺。
本领域的技术人员容易理解,以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。

Claims (10)

  1. 一种手写汉字图像的笔顺识别方法,其特征在于,包括以下步骤:
    (1)预处理步骤:对原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对所述汉字骨架进行分割操作,得到含有多个笔段的分割图像;所述原始手写汉字图像仅包含1个手写汉字;
    (2)第一次笔顺匹配步骤:通过分支界限法,根据笔画集对所述分割图像中的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集,完成从所述成功笔段集到所述笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对所述失败笔段集执行下述第二次笔顺匹配步骤;
    所述笔画集的获取方法为:在规范汉字字库中查找获得所述原始手写汉字图像中的手写汉字的标准笔画集,简称为笔画集;
    所述规范汉字字库的建立方法为:根据八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,所述规范汉字字库由每个汉字的标准笔画集构成,所述标准笔画集包括每个笔画的笔顺和质心;
    (3)第二次笔顺匹配步骤:对所述失败笔段集中的每个笔段,分别计算该笔段的质心与所述笔画集中每个笔画的质心的距离,并组成距离集;查找所述距离集中的最小距离;查找所述最小距离对应的笔画在所述笔画集中的笔顺,判定该笔顺与该笔段匹配成功;完成从所述失败笔段集到所述笔画集的第二映射:将每个笔段映射到匹配成功的笔顺;
    (4)笔段融合步骤:将所述第一映射和所述第二映射合并为第三映射,将所述第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个所述待融合笔段集进行笔段融合操作:将每个所述待融合笔段集中的笔段融合为1个笔段。
  2. 根据权利要求1所述的手写汉字图像的笔顺识别方法,其特征在 于,
    所述预处理步骤中的汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点;所述预处理步骤中的笔段的起终点在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点;
    所述规范汉字字库中的标准笔画集还包括每个笔画的非法方向编码和合法方向编码;
    所述非法方向编码的规则为:
    若该笔画的主方向编码为0,则非法方向编码为2和6;
    若该笔画的主方向编码为1,则非法方向编码为3和7;
    若该笔画的主方向编码为2,则非法方向编码为0和4;
    若该笔画的主方向编码为3,则非法方向编码为1和5;
    若该笔画的主方向编码为4,则非法方向编码为2和6;
    若该笔画的主方向编码为5,则非法方向编码为3和7;
    若该笔画的主方向编码为6,则非法方向编码为0和4;
    若该笔画的主方向编码为7,则非法方向编码为1和5;
    所述合法方向编码的规则为:
    若该笔画的主方向编码为0,则合法方向编码为0、1和7;
    若该笔画的主方向编码为1,则合法方向编码为0、1和2;
    若该笔画的主方向编码为2,则合法方向编码为1、2和3;
    若该笔画的主方向编码为3,则合法方向编码为2、3和4;
    若该笔画的主方向编码为4,则合法方向编码为3、4和5;
    若该笔画的主方向编码为5,则合法方向编码为4、5和6;
    若该笔画的主方向编码为6,则合法方向编码为5、6和7;
    若该笔画的主方向编码为7,则合法方向编码为0、6和7;
    所述笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方 向编码。
  3. 根据权利要求2所述的手写汉字图像的笔顺识别方法,其特征在于,所述第一次笔顺匹配步骤中的笔段匹配操作包括以下步骤:
    (1)匹配权重计算步骤:计算每个所述笔段的主方向编码,并分别对比所述笔画集中所有笔画的非法方向编码:若所述笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
    所述笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码;
    所述匹配权重为该笔段的质心与该笔画的质心之间的距离;
    (2)匹配笔顺步骤:根据每个所述笔段的所有的匹配权重,通过分支界限法完成所述第一映射。
  4. 根据权利要求2所述的手写汉字图像的笔顺识别方法,其特征在于,
    所述笔段融合步骤中的笔段融合操作包括以下步骤:
    (1)笔段编码步骤:以起始点为起点对所述待融合笔段集中的每个笔段进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹像素点的方向编码,各个所述方向编码按所述遍历操作的遍历顺序构成该笔段的八邻域编码链;
    (2)翻转笔段步骤:对所述待融合笔段集中的每个笔段,在所述所述第三映射中查找该笔段的像,根据该笔段的像在所述笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入所述待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在所述待融合笔段集中;
    (3)融合笔段步骤:任取所述待融合笔段集中的两个笔段:第一笔段 和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入所述待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;所述融合失败的笔段为所述第一笔段和所述第二笔段中属于所述失败笔段集的笔段;
    (4)融合完成步骤:对所述待融合笔段集重复执行所述融合笔段步骤,直至融合为1个笔段。
  5. 一种手写汉字图像的笔顺识别系统,其特征在于,包括:
    笔画集获取模块:用于根据八邻域方向编码规则对国标一级字库中的所有汉字建立规范汉字字库,所述规范汉字字库由每个汉字的标准笔画集构成,所述标准笔画集包括每个笔画的笔顺和质心;在所述规范汉字字库中查找原始手写汉字图像中的手写汉字的标准笔画集,以下简称为笔画集;
    所述原始手写汉字图像仅包含1个手写汉字;
    预处理模块:用于对所述原始手写汉字图像进行汉字骨架提取操作,得到汉字骨架图像;对所述汉字骨架进行分割操作,得到含有多个笔段的分割图像;
    第一次笔顺匹配模块:用于通过分支界限法,根据所述笔画集对所述分割图像中的笔段进行笔顺匹配操作,将匹配成功的笔段组成成功笔段集,完成从所述成功笔段集到所述笔画集的第一映射:将每个笔段映射到匹配成功的笔顺;将匹配失败的笔段组成失败笔段集,对所述失败笔段集执行下述第二次笔顺匹配模块中的操作;
    第二次笔顺匹配模块:用于对所述失败笔段集中的每个笔段,分别计算该笔段的质心与所述笔画集中每个笔画的质心的距离,并组成距离集;查找所述距离集中的最小距离;查找所述最小距离对应的笔画在所述笔画 集中的笔顺,判定该笔顺与该笔段匹配成功;完成从所述失败笔段集到所述笔画集的第二映射:将每个笔段映射到匹配成功的笔顺;
    笔段融合模块:用于将所述第一映射和所述第二映射合并为第三映射,将所述第三映射中映射到同一笔顺的2个以上的笔段组成该笔顺的待融合笔段集;分别对每个所述待融合笔段集进行笔段融合操作:将每个所述待融合笔段集中的笔段融合为1个笔段。
  6. 根据权利要求5所述的手写汉字图像的笔顺识别系统,其特征在于,
    所述预处理模块中的汉字骨架图像的任一笔迹像素点在其八邻域内只存在4个以下的相邻的笔迹像素点;所述预处理模块中的笔段的起终点在其八邻域内只存在1个相邻的笔迹像素点,其他笔迹像素点在其八邻域内只存在2个相邻的笔迹像素点;
    所述笔画集获取模块中的标准笔画集还包括每个笔画的非法方向编码和合法方向编码;
    所述非法方向编码的规则为:
    若该笔画的主方向编码为0,则非法方向编码为2和6;
    若该笔画的主方向编码为1,则非法方向编码为3和7;
    若该笔画的主方向编码为2,则非法方向编码为0和4;
    若该笔画的主方向编码为3,则非法方向编码为1和5;
    若该笔画的主方向编码为4,则非法方向编码为2和6;
    若该笔画的主方向编码为5,则非法方向编码为3和7;
    若该笔画的主方向编码为6,则非法方向编码为0和4;
    若该笔画的主方向编码为7,则非法方向编码为1和5;
    所述合法方向编码的规则为:
    若该笔画的主方向编码为0,则合法方向编码为0、1和7;
    若该笔画的主方向编码为1,则合法方向编码为0、1和2;
    若该笔画的主方向编码为2,则合法方向编码为1、2和3;
    若该笔画的主方向编码为3,则合法方向编码为2、3和4;
    若该笔画的主方向编码为4,则合法方向编码为3、4和5;
    若该笔画的主方向编码为5,则合法方向编码为4、5和6;
    若该笔画的主方向编码为6,则合法方向编码为5、6和7;
    若该笔画的主方向编码为7,则合法方向编码为0、6和7;
    所述笔画的主方向编码为该笔画的八邻域编码链中出现次数最多的方向编码。
  7. 根据权利要求6所述的手写汉字图像的笔顺识别系统,其特征在于,所述第一次笔顺匹配模块包括以下子模块:
    匹配权重计算子模块:用于计算每个所述笔段的主方向编码,并分别对比所述笔画集中所有笔画的非法方向编码:若所述笔段的主方向编码不属于其中一个笔画的非法方向编码,则计算该笔段与该笔画的匹配权重,并继续对比下一个笔画;否则,判定该笔段与该笔画不匹配,并继续对比下一个笔画;直至完成所有笔画的对比;
    所述笔段的主方向编码为该笔段的八邻域编码链中出现次数最多的方向编码;
    所述匹配权重为该笔段的质心与该笔画的质心之间的距离;
    匹配笔顺子模块:用于根据每个所述笔段的所有的匹配权重,通过分支界限法完成所述第一映射。
  8. 根据权利要求6所述的手写汉字图像的笔顺识别系统,其特征在于,所述笔画融合模块包括以下子模块:
    笔段编码子模块:用于以起始点为起点对所述待融合笔段集中的每个笔段进行遍历操作,按照八邻域方向编码规则计算除起点以外的每个笔迹像素点的方向编码,各个所述方向编码按所述遍历操作的遍历顺序构成该笔段的八邻域编码链;
    翻转笔段子模块:用于对所述待融合笔段集中的每个笔段,在所述所述第三映射中查找该笔段的像,根据该笔段的像在所述笔画集中查找对应的笔画的合法方向编码;判断该笔段的八邻域编码链是否包含在该合法方向编码中,若不包含,则翻转该笔段,并将翻转后的笔段放入所述待融合笔段集,删除翻转前的笔段;否则,不翻转该笔段,且该笔段保留在所述待融合笔段集中;
    融合笔段子模块:用于任取所述待融合笔段集中的两个笔段:第一笔段和第二笔段,对第一笔段的起始像素点P1和终止像素点P2,以及第二笔段的起始像素点P3和终止像素点P4,计算距离D1,D2,D3和D4;D1为P1和P3之间的距离,D2为P1和P4之间的距离,D3为P2和P3之间的距离,D4为P2和P4之间的距离;若D1~D4中最小的距离小于设定的阈值,则取P1~P4中距离最近的两点进行融合,并将融合后的笔段放入所述待融合笔段集;否则判定为融合失败,并删除融合失败的笔段;所述融合失败的笔段为所述第一笔段和所述第二笔段中属于所述失败笔段集的笔段;
    融合完成子模块:用于对所述待融合笔段集重复执行所述融合笔段子模块中的操作,直至融合为1个笔段。
  9. 一种手写汉字图像的笔顺识别装置,其特征在于,包括存储器和处理器;所述存储器,用于存储计算机程序;所述处理器,用于当执行所述计算机程序时,实现如权利要求1-4任一项所述的手写汉字图像的笔顺识别方法。
  10. 一种计算机可读存储介质,其特征在于,所述存储介质上存储有计算机程序,当所述计算机程序被处理器执行时,实现如权利要求1-4任一项所述的手写汉字图像的笔顺识别方法。
PCT/CN2021/128101 2021-10-22 2021-11-02 一种手写汉字图像的笔顺识别方法及系统 WO2023065397A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111237628.XA CN113903045A (zh) 2021-10-22 2021-10-22 一种手写汉字图像的笔顺识别方法及系统
CN202111237628.X 2021-10-22

Publications (1)

Publication Number Publication Date
WO2023065397A1 true WO2023065397A1 (zh) 2023-04-27

Family

ID=79026453

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/128101 WO2023065397A1 (zh) 2021-10-22 2021-11-02 一种手写汉字图像的笔顺识别方法及系统

Country Status (2)

Country Link
CN (1) CN113903045A (zh)
WO (1) WO2023065397A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117315666A (zh) * 2023-11-30 2023-12-29 上海又寸科技有限公司 一种原笔迹还原编码信息的方法及系统

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903045A (zh) * 2021-10-22 2022-01-07 华中师范大学 一种手写汉字图像的笔顺识别方法及系统

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1269540A (zh) * 1999-04-02 2000-10-11 黄健 立体方向化编码输入法及装置
CN101290659A (zh) * 2008-05-29 2008-10-22 宁波新然电子信息科技发展有限公司 基于组合分类器的手写识别方法
US20110175916A1 (en) * 2010-01-19 2011-07-21 Disney Enterprises, Inc. Vectorization of line drawings using global topology and storing in hybrid form
CN102542264A (zh) * 2011-12-22 2012-07-04 北京语言大学 基于数字手写设备的汉字书写正误自动评测方法和装置
CN103810506A (zh) * 2014-01-03 2014-05-21 南京师范大学 一种手写汉字笔画识别方法
CN104156721A (zh) * 2014-07-31 2014-11-19 南京师范大学 一种基于模板匹配的脱机汉字笔画提取方法
CN109002803A (zh) * 2018-07-24 2018-12-14 武汉大学 一种基于智能手表的握笔姿势检测和汉字笔顺识别方法
CN111027451A (zh) * 2019-12-05 2020-04-17 上海眼控科技股份有限公司 手写汉字图像恢复书写轨迹的方法及设备
CN112597876A (zh) * 2020-12-20 2021-04-02 湖北工业大学 基于特征融合的书法汉字评判方法
CN113420983A (zh) * 2021-06-23 2021-09-21 科大讯飞股份有限公司 一种书写评价方法、装置、设备及存储介质
CN113903045A (zh) * 2021-10-22 2022-01-07 华中师范大学 一种手写汉字图像的笔顺识别方法及系统

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1269540A (zh) * 1999-04-02 2000-10-11 黄健 立体方向化编码输入法及装置
CN101290659A (zh) * 2008-05-29 2008-10-22 宁波新然电子信息科技发展有限公司 基于组合分类器的手写识别方法
US20110175916A1 (en) * 2010-01-19 2011-07-21 Disney Enterprises, Inc. Vectorization of line drawings using global topology and storing in hybrid form
CN102542264A (zh) * 2011-12-22 2012-07-04 北京语言大学 基于数字手写设备的汉字书写正误自动评测方法和装置
CN103810506A (zh) * 2014-01-03 2014-05-21 南京师范大学 一种手写汉字笔画识别方法
CN104156721A (zh) * 2014-07-31 2014-11-19 南京师范大学 一种基于模板匹配的脱机汉字笔画提取方法
CN109002803A (zh) * 2018-07-24 2018-12-14 武汉大学 一种基于智能手表的握笔姿势检测和汉字笔顺识别方法
CN111027451A (zh) * 2019-12-05 2020-04-17 上海眼控科技股份有限公司 手写汉字图像恢复书写轨迹的方法及设备
CN112597876A (zh) * 2020-12-20 2021-04-02 湖北工业大学 基于特征融合的书法汉字评判方法
CN113420983A (zh) * 2021-06-23 2021-09-21 科大讯飞股份有限公司 一种书写评价方法、装置、设备及存储介质
CN113903045A (zh) * 2021-10-22 2022-01-07 华中师范大学 一种手写汉字图像的笔顺识别方法及系统

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
BAI, XIAODONG ET AL.: "Experiment Research on the for the Stroke of Handwritten Chinese Characters Identification Method Based on Similarity", RESEARCH AND EXPLORATION IN LABORATORY, vol. 34, no. 12, 31 December 2015 (2015-12-31), pages 132 - 136, XP009545733 *
WEI WEI; BO NING: "A Stroke-Density Based Double Elastic Meshing Feature Extraction Method for Chinese Handwritten Character Recognition", 2013 SEVENTH INTERNATIONAL CONFERENCE ON IMAGE AND GRAPHICS, IEEE, 26 July 2013 (2013-07-26), pages 816 - 821, XP032515506, DOI: 10.1109/ICIG.2013.164 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117315666A (zh) * 2023-11-30 2023-12-29 上海又寸科技有限公司 一种原笔迹还原编码信息的方法及系统
CN117315666B (zh) * 2023-11-30 2024-02-20 上海又寸科技有限公司 一种原笔迹还原编码信息的方法及系统

Also Published As

Publication number Publication date
CN113903045A (zh) 2022-01-07

Similar Documents

Publication Publication Date Title
CN106156761B (zh) 面向移动终端拍摄的图像表格检测与识别方法
Liu et al. Identification of fork points on the skeletons of handwritten Chinese characters
WO2023065397A1 (zh) 一种手写汉字图像的笔顺识别方法及系统
CN112712273B (zh) 一种基于骨架相似度的手写体汉字美观度评判方法
CN102194123B (zh) 表格模板定义方法和装置
Brown et al. Handprinted symbol recognition system
JPH08305796A (ja) パターン抽出装置、パターン再認識用テーブル作成装置及びパターン認識装置
CN112308946B (zh) 题目生成方法、装置、电子设备及可读存储介质
CN114419647A (zh) 一种表格信息提取方法及系统
CN112446259A (zh) 图像处理方法、装置、终端和计算机可读存储介质
CN113158895A (zh) 票据识别方法、装置、电子设备及存储介质
JPH07220090A (ja) 物体認識方法
JP2018060389A (ja) プログラム、情報記憶媒体及び文字分割装置
JP5343617B2 (ja) 文字認識プログラム、文字認識方法および文字認識装置
Bhattacharya et al. Understanding contents of filled-in Bangla form images
CN116343237A (zh) 基于深度学习和知识图谱的票据识别方法
CN114511853B (zh) 一种文字图像书写轨迹恢复效果判别方法
JP3558493B2 (ja) 用紙位置合わせ装置、用紙位置合わせ方法及び用紙位置合わせプログラムを記録したコンピュータ読み取り可能な記録媒体
CN115311666A (zh) 图文识别方法、装置、计算机设备及存储介质
CN115147858A (zh) 手写体表单图像数据生成方法、装置、设备及介质
US20190102619A1 (en) Identifying hand drawn tables
CN110826400B (zh) 图片表格用户交互增强识别的方法
JP3798179B2 (ja) パターン抽出装置及び文字切り出し装置
Zhang et al. Writing process restoration of Chinese calligraphy images based on skeleton extraction
Snoussi et al. Text lines segmentation of handwritten Arabic script using outer isothetic cover

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21961138

Country of ref document: EP

Kind code of ref document: A1