Method for judging correctness of position relation of strokes of handwritten Chinese character based on template matching
A template matching and correctness technology, which is applied in character and pattern recognition, instruments, computer parts, etc., can solve the problem of inability to realize the correctness judgment of Chinese character writing stroke position relationship, structural rationality judgment, overall writing quality evaluation, and inaccurate Judging whether the writing is correct, etc.
Inactive Publication Date: 2014-12-03
NANJING NORMAL UNIVERSITY
6 Cites 15 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0007] Although the above methods can evaluate the spatial structure of handwritten Chinese characters and the layout relationship between strokes in some aspects, these methods cannot accurately judge whether the relative positional relationship between the user's handwritten Chinese charact...
Abstract
The invention discloses a method for judging the correctness of the position relation of strokes of a handwritten Chinese character based on template matching. The method comprises the specific steps of building a whole character feature set and a part feature set of a standard Chinese character; recording handwriting of the Chinese character handwritten by a user to obtain stroke features of the Chinese character; carrying out matching comparison on whole character features of the user Chinese character and whole character features of the standard Chinese character, building the one-to-one correspondence relation between the strokes of the user Chinese character and strokes of the standard Chinese character, confirming the attribute of each stroke of the user Chinese character, and distributing the strokes of the user Chinese character into parts to which the strokes belong; carrying out matching comparison on part features of the user Chinese character and part features of the standard Chinese character, judging whether the relative azimuth relation and the distance relation between the strokes in the parts of the user Chinese character are correct, and judging whether the relative azimuth relation and the distance relation between the parts of the user Chinese character are correct. The method can be used for judging whether the position relation between the strokes of the Chinese character handwritten by the user is correct and whether the position relation between the parts of the Chinese character handwritten by the user is correct and has important value in applications of judging the writing quality of the handwritten Chinese character and the like.
Application Domain
Character and pattern recognition
Technology Topic
Template matchingFeature set +5
Image
Examples
- Experimental program(1)
Example Embodiment
[0057] The present invention will be described in detail below with reference to the accompanying drawings.
[0058] like figure 1 , a method for confirming the stroke position relationship of handwritten Chinese characters based on template matching, comprising the following steps:
[0059] 1. Establish the whole character feature set and component feature set of standard Chinese characters.
[0060] Construct a standard Chinese character feature set, which includes a whole character feature set and a component feature set. The whole character feature set includes four features: the type of each stroke in the Chinese character, the absolute positional relationship, the relative positional relationship, and the intersecting relationship between strokes; component features The set includes five features: the topology relationship between strokes in the part, the relative orientation relationship between the strokes in the part, the distance relationship between the strokes in the part, the relative orientation relationship between the parts, and the distance relationship between the parts; The relationship includes four kinds of intersection, connection, adjacent, and non-adjacent, such as figure 2 Shown, adjacent means that two strokes do not intersect, are not connected and there is no stroke in the middle to pass through, if there are other strokes in the two strokes to pass through, it is non-adjacent; the relative azimuth relationship between the strokes in the part includes left and right , upper and lower; the relative orientation relationship between components includes upper, lower, left, right, upper left, upper right, upper left half, lower left half, upper right half, lower right half, upper lower half, lower The upper half of the bag, the left half of the right half, the full surround, etc.
[0061] 2. Record the handwriting of the user's handwritten Chinese characters, and obtain their stroke characteristics.
[0062] Record the handwriting of the user's handwritten Chinese characters, obtain the handwritten Chinese character point set according to the handwriting movement of the user's handwritten Chinese characters on the platform, and define the point set formed by the user's writing process from the start of the pen to the start of a stroke as a stroke; traverse the stroke point set , the original point set is denoised, and the denoised strokes are classified redundantly.
[0063] 3. Establish a one-to-one correspondence between the strokes of handwritten Chinese characters and standard Chinese characters, and assign the strokes of the user's Chinese characters to their respective components.
[0064] (1) With the standard Chinese character whole character feature set, the following judgments are performed on handwritten Chinese characters in turn:
[0065] A. Judgment of stroke type uniqueness: separate unique strokes in handwritten Chinese characters and match them with standard Chinese character stroke characteristics;
[0066] B. Judgment of absolute position uniqueness: establish an outer frame of handwritten Chinese characters, divide the outer frame into several equal parts, determine the position of each stroke, and match with the absolute position feature of standard Chinese characters;
[0067] C. Judgment of the uniqueness of the intersection feature: extract the strokes in the handwritten Chinese characters that have the intersecting feature with the determined corresponding strokes, and match with the standard Chinese characters according to the uniqueness of the correlation;
[0068] D. Judgment of relative position similarity: the strokes that have not been matched are clustered by stroke type, the relative positions of each stroke in the same stroke and the outer frame vertex are calculated, and the standard Chinese characters are matched according to the relative positional relationship;
[0069] E, the user's handwritten Chinese character strokes that have not yet completed the corresponding relationship establishment through steps A-D, calculate respectively the stroke type similarity, absolute positional relationship similarity, relative positional relationship similarity with the strokes that have not completed the corresponding relationship establishment in standard Chinese characters, The three similarities are comprehensively processed, and the corresponding relationship between the user's handwritten Chinese character strokes and the standard Chinese character strokes is established according to the comprehensive similarity;
[0070] (2) according to the correspondence between the handwritten Chinese character and the standard Chinese character stroke and the division of the component class in the standard Chinese character, the corresponding strokes of the user Chinese character are distributed in different parts, obtain the component feature set of the user Chinese character, the method is as follows:
[0071] Traverse the feature set of component classes in standard Chinese characters C={c 1 (s 1 ,s 2 ,...,s i ),c 2 (s i+1 ,s i+2 ,...,s k ),...,c j (s k+1 ,s k+2 ,...,s n )}, where s i are the strokes in standard Chinese characters, n, j are the stroke order of standard Chinese characters and the number of parts, respectively, according to the feature set C defined in the standard Chinese characters
[0072] S'={s 1 '(p 1 ', p 2 ',...,p i '), s 2 '(p 1 ', p 2 ',...,p i '), ..., s j '(p 1 ', p 2 ',...,p i '} Partition the feature set of the end-user Chinese character class
[0073] C'={c 1 '(s 1 ', s 2 ',...,s i '), c 2 '(s i+1 ', s i+2 ',...,p k '), ..., c j '(s k+1 ', s k+2 ',...,s n ′},
[0074] Among them, j is the number of user Chinese character parts, and n is the stroke order of user Chinese character strokes.
[0075] 4. Traverse the topological relationship between the strokes, the relative azimuth relationship between the strokes, and the distance relationship feature set between the strokes defined in the standard Chinese characters, establish the corresponding feature set of the user Chinese character and compare and process, and judge the component according to the comparison result. Whether the positional relationship between the inner strokes is written correctly, the method is as follows:
[0076] (1) Comparison of the topological relationship between the strokes in the component: Traverse the topological relationship feature set T={t between the strokes in the relevant components defined in the standard Chinese characters 1 , t 2 , ..., t i}, where t i =1,2,3,4, t i The value represents the relationship of intersecting, adjoining, adjacent, non-adjacent respectively, judge the topological relationship between the corresponding strokes in the user Chinese character part, and the method of judgment is as follows: set the stroke S in the user Chinese character S ' h The point set of ' is stroke S k ' The point set is First find S h ', S k ' to the closest point to the original coordinates by: cyclic comparison value, whichever is the smallest, the corresponding coordinates at this time and is the stroke s' h with stroke s' k the closest point. exist Take a point on each side of : and The straight line y=ax+b that has done these two points, then take point on both sides and Substitute these two points into y=ax+b to judge whether they are on both sides of the straight line. The method used is to judge and or and Whether it is established at the same time, if it is established that the two strokes intersect, otherwise they do not intersect; if the two strokes are not intersecting, then judge the distance of the closest point Is it true, if true, then s' h and s' k connected, where L dis is the experience value; if s' h and s' k are not connected, then judge s' h and s' k Whether it is adjacent or not, the judgment is based on: if s' h and s' k adjacent, no other strokes pass through their closest points, by setting: s l '≠s' h , s l '≠s' k , take s l ' endpoints and turning points Pass and Make a straight line y=ax+b, and judge in turn Whether i=1,2,...,s-1 is on both sides of the line, if it is on both sides of the line, it means s' h and s' k Separate; if there is no case on both sides of the line, then s' h and s' k adjacent. According to the above method, the topological relationship feature set T'={t between strokes in the user's Chinese character components 1 ', t 2 ',...,t i '}, compare the topological relationship between the strokes in the standard Chinese character and the user's Chinese character part, judge whether the topological relationship between the strokes in the user's Chinese character part is written correctly according to the comparison result, and the concrete comparison process is: if t i =t 1 If '=1 is established, it is considered that the writing of the intersection relation is correct, otherwise the writing is wrong; if t i = 2 or t i =3 and t i '=1 and t i If '=4 is established at the same time, it is considered that the connection or adjacent relationship is written correctly, otherwise the writing is wrong; if t i =t 1 If '=4 is established, it is considered that the writing of the separation relation is correct, otherwise the writing is wrong;
[0077] (2) the comparison of the relative orientation relation between the strokes in the part: according to the stroke s in the standard Chinese character part h relative to stroke s k The orientation relationship of , judge the stroke s in the user's Chinese character component h ' relative to stroke s k ' azimuth relationship, traversing the stroke s h '' feature point set s h ′={p 1 h , p 2 h ,...,p m h}, compare strokes s h The size of the X and Y coordinates of each point in ', the maximum and minimum values of the x and y coordinates in the stroke point set are obtained x jmin ', x jmax ', y jmin ', y jmax ’ and the strokes j 'The x and y coordinates of the center point x jcenter ', y jcenter ',in x jcenter ′ = x j min ′ + x j max ′ 2 , y jcenter ′ = y j min ′ + y j max ′ 2 ; Similarly, strokes can be obtained i 'The maximum and minimum values of x and y coordinates in the point set x imin ', x imax ', y imin ', y imax ’ and the strokes i ' the x and y coordinates of the center point x icenter ', y icenter ',in x icenter ′ = x i min ′ + x i max ′ 2 , y icenter ′ = y i min ′ + y i max ′ 2 ; The method for judging the azimuth relationship between strokes is as follows:
[0078] 1) Left and right orientation relationship: assume the stroke s j 'in strokes i ' to the right, judge x jmin '-x imax ′>0 and ((ε 1 is a certain threshold) is established at the same time, and the stroke s is considered to be established at the same time j 'in strokes i The orientation relationship of ' is written correctly, otherwise it is written incorrectly;
[0079] 2) The relationship between the upper and lower orientation: suppose the stroke s j 'in strokes i ', judge y jmin '-y imax ′>0 and ((ε 1 is a certain threshold) is established at the same time, and the stroke s is considered to be established at the same time j 'in strokes i The azimuth relationship of ' is written correctly, otherwise it is wrongly written. Through the above method, a feature set of the relative orientation relationship between the strokes in the user Chinese character component can be obtained, and the relative orientation relationship between the standard Chinese character and the corresponding stroke in the user Chinese character component can be compared to see if the relative orientation relationship is the same. The orientation relationship is written correctly, otherwise it is considered a writing error;
[0080] (3) Comparison of the distance relationship between strokes in the component: calculate stroke s in standard Chinese characters h and strokes k The distance of , the calculation method is: set the stroke S in the standard Chinese character S h The set of points is s h ={p 1 h , p 2 h ,...,p m h}, stroke S k The set of points is s k ={p 1 k , p 2 k ,...,p n k}. First find S h , S k The closest point to the original coordinates of , by: value, whichever is the smallest, the corresponding coordinates at this time and is the stroke S h with stroke S k The closest point in , the minimum value is the distance between the two strokes Similarly, the corresponding stroke s in the user's Chinese characters can be obtained k ' and strokes h The coordinates of the closest point in ' (p i h′ (x), p i h′ (y)) and (p j k′ (x), p j k′ (y)), the distance between the two approaching points d ′ = ( p h h ′ ( x ) - p j k ′ ( x ) ) 2 + ( p i h ′ ( y ) - p j k ′ ( y ) ) 2 , Judgment |d-d′| 2 (ε 2 is a certain threshold) is established, if so, it is considered that the user's Chinese character stroke s j ' and strokes i The distance relationship between ' is correctly written, otherwise the writing is considered wrong; according to the topological relationship feature set between the strokes in the standard Chinese character component, the above steps are executed cyclically to determine whether the writing of the distance relationship between the strokes without intersecting relationship in the user Chinese character component is correct.
[0081] 5. Traverse the relative azimuth relationship between the components and the distance relationship feature set between the components defined in the standard Chinese characters, establish the user component feature set and perform comparison processing, and judge whether the positional relationship between the components is written correctly and standardized according to the comparison result. Method as follows:
[0082] (1) Comparison of relative orientation relationships between components: according to component c in standard Chinese characters j relative to part c i The orientation relationship of , determine the part c in the user's Chinese characters j ' with respect to part c i ' azimuth relationship, traverse component c j '' feature point set c j ′={s 1 '(p 1 ',...,p n '), ..., s k '(p 1 ',...,p m ')}, compare the size of the XY coordinate values of each point in the component point set, and obtain the maximum and minimum x and y coordinates of the component point set x jmin ', x jmax ', y jmin ', y jmax ' and part c j 'The x and y coordinates of the center point x jcenter ', y jcenter ',in x jcenter ′ = x j min ′ + x j max ′ 2 , y jcenter ′ = y j min ′ + y j max ′ 2 ; In the same way, the component c can be obtained i 'The maximum and minimum values of x and y coordinates in the point set x imin ', x imax ', y imin ', y imax ' and part c i ' the x and y coordinates of the center point x icenter ', y icenter ',in x icenter ′ = x i min ′ + x i max ′ 2 , y icenter ′ = y i min ′ + y i max ′ 2 ; The parties to the relationship are judged as follows:
[0083] 1) The relationship between the upper and lower orientation: Assume that the component c j ' in part c i ', judge y jmin '-y imax ′>0 and ((ε 3 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The orientation relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (a);
[0084] 2) Left and right orientation relationship: Assume component c j ' in part c i ' to the right, judge x jmin '-x imax ′>0 and ((ε 3 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (b);
[0085] 3) Upper left orientation relationship: Assume component c j ' in part c i ' to the lower left, judge y jmin '-y imax ′>-ε 4 , x imax '-x jmax ′>ε 4 and x imin '-x jmin ′>ε 4 ((ε 4is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (c);
[0086] 4) Upper right orientation relationship: Assume component c j ' in part c i ' to the lower right, judge y jmin '-y imax ′>-ε 4 , x jmax '-x imax ′>ε 4 and x jmin '-x imin ′>ε 4 ((ε 4 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (d);
[0087] 5) Surrounding azimuth relationship in the upper left half: assuming component c j The left and upper sides of ' are covered by component c i 'semi-enclosed, judge y imax '-y jcenter ′>ε 4 , x imax '-x jcenter ′>ε 4 ((ε 4 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (e);
[0088] 6) The azimuth relationship surrounding the lower left half: Assume component c j The left and lower sides of ' are covered by component c i 'semi-enclosed, judge y jcenter -'y imin ′>ε 4 , x imax '-x jcenter ′>ε 4 ((ε 4 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (f);
[0089] 7) Surrounding azimuth relationship in the upper right half: Assume component c j The right and upper sides of ' are covered by component c i 'semi-enclosed, judge y imax '-y jcenter ′>ε 4 , x jcenter '-x imin ′>ε 4 ((ε 4 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (g);
[0090] 8) The azimuth relationship surrounding the lower right half: assuming component c j The right and lower sides of ' are covered by component c i 'semi-enclosed, judge y jcenter '-y imin ′>ε 4 , x jcenter '-x imin ′>ε 4 ((ε 4 is a certain threshold) is established at the same time, and the component c is considered to be established at the same time j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (h);
[0091] 9) Semi-enclosed azimuth relationship under the upper package: Assume component c j 'The left and right sides and the upper side are covered by part c i 'semi-enclosed, judge y imax '-y jcenter ′>ε 4 ((ε 4 is a certain threshold), x imin ' jmin ' and x imax′x jmax 'Whether it is established at the same time, at the same time, it is considered that the component c j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (i) shown;
[0092] 10) Semi-enclosed azimuth relationship on the lower package: Assume part c j 'The left and right sides and the lower side are covered by part c i 'semi-enclosed, judge y jcenter '-y imin ′>ε 4 ((ε 4 is a certain threshold), x imin ' jmin ' and x imax ′>x jmax 'Whether it is established at the same time, at the same time, it is considered that the component c j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (j);
[0093] 11) The semi-enclosed azimuth relationship between the left and the right: Suppose the component c j The upper and lower sides and the left side of ' are covered by part c i 'semi-enclosed, judge x imax '-x jcenter ′>ε 4 ((ε 4 is a certain threshold), y imin ′ jmin ' and y imax ′>y jmax 'Whether it is established at the same time, at the same time, it is considered that the component c j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (k);
[0094] 12) All-encompassing azimuth relationship: Suppose component c j ' is part c i 'Fully surrounded, judge x imin ' jmin ' and x imax ′>x jmax ', y imin ′ jmin ' and y imax ′>y jmax 'Whether it is established at the same time, at the same time, it is considered that the component c j ' and part c i The azimuth relationship between ' is written correctly, otherwise the writing is wrong, such as image 3 (i) shown;
[0095] Through the above method, a feature set of relative orientation relationship between user Chinese character components can be obtained, and the relative orientation relationship between the standard Chinese character component and the corresponding component in the user Chinese character can be compared. If the orientation relationship is the same, it is considered that the relative orientation relationship between the two components in the user Chinese character. The writing is correct, otherwise it is considered a writing error;
[0096] (2) Comparison of the distance relationship between components: Calculate component c in standard Chinese characters j and part c i The distance is calculated as: traverse the component c j The feature point set c of j ={s 1 (p 1 ,...,p n ),...,s k (p 1 ,...,p m )}, compare the size of the XY coordinate values of each point in the component, and get the maximum and minimum x and y coordinates of the component point set x jmin , x jmax , y jmin , y jmax , in the same way, the component c can be obtained i The maximum and minimum x and y coordinates of the point set x imin , x imax , y imin , y imax; According to the relative azimuth relationship between the parts in the standard Chinese characters, judge whether the distance relationship between the parts of the user's Chinese characters is written correctly, and the judgment method is:
[0097] 1) Left and right orientation relationship: Assume component c j in part c i the right side of the component c j and part c i The distance is d=x imin -x imax;
[0098] 2) The relationship between the upper and lower orientation: Assume that the component c j in part c i above, the component c j and part c i The distance is d=y imin -y jmax;
[0099] 3) Upper left orientation relationship: Assume component c j in part c i bottom left, if x iminx jmax , then the component c j and part c i The distance is otherwise part c j and part c i The distance is d=y jmin -y imax;
[0100] 4) Upper right orientation relationship: Assume component c j in part c i bottom right, if x jminx imax , then the component c j and part c i The distance is otherwise part c j and part c i The distance is d=y jmin -y imax; Utilize the above-mentioned method to calculate the corresponding part c in the user's Chinese characters j ' and part c i ' distance d', judge |d-d'| 5 (ε 5 is a certain threshold) whether it is established, if it is established, it is considered that the user Chinese character part c j relative to part c i The distance relationship between them is written correctly, otherwise it is considered a writing error; in the same way, it can be judged whether the distance relationship between other components is written correctly.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.