A method for controlling printed fonts by gesture input
By collecting the sampling points and breakpoints of gesture input, the similarity between the text image and the font image is calculated, which solves the problems of low recognition accuracy and insufficient font diversity in the prior art, and achieves higher input recognition accuracy and better Rich font output improves user experience.
Patent Information
- Application Number
- CN202210264350.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-03-17
AI Technical Summary
The existing gesture input control methods have problems with low recognition accuracy and insufficient font diversity when identifying and outputting printed fonts, resulting in repeated handwriting input and inability to output the closest printed fonts.
By setting the timer to collect the sampling points input by gestures, judge the breakpoint to form strokes, calculate the similarity between the text image and the images of different fonts, and output the closest font, including preprocessing and position adjustments to improve matching accuracy.
It improves the accuracy of gesture input recognition, reduces repeated handwriting input, increases the diversity of output print fonts, and improves the user experience.
Smart Images

Figure CN114637478B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of gesture recognition, and in particular to a method for controlling printed fonts by gesture input. Background Art
[0002] With the rapid development of electronic display technology and touch screen technology, touch screens have been widely used in interactive computer system devices. In these devices, a handwriting input function is provided to control the output print font through handwriting input.
[0003] Since each person's handwriting gestures and writing strength are different during handwriting input, the handwriting fonts of each person are very different. When recognizing fonts, only one font is selected as the output comparison sample. Due to the limitations of font samples, on the one hand, the handwritten font cannot be recognized and repeated handwriting input is required; on the other hand, the closest printed font cannot be output according to the shape of the handwritten font. Therefore, it is necessary to improve the existing gesture input control method. Summary of the invention
[0004] In view of the defects in the prior art, the present invention provides a method for controlling printed fonts by gesture input, which not only improves the accuracy of input recognition and avoids repeated handwriting input, but also increases the diversity of output printed fonts and improves user experience.
[0005] A method for controlling printed fonts by gesture input, comprising:
[0006] Set the timer, set the collection time, and set the collection interval;
[0007] According to the sampling interval, the sampling point X is obtained. k (1≤k≤n), n is the number of sampling points;
[0008] Record the sampling point coordinates X in chronological order k (x, y), 1≤k≤n, x is the horizontal coordinate of the sampling point, y is the vertical coordinate of the sampling point;
[0009] Determine the breakpoint X that exists in all sampling points d (x, y), 1≤d≤n;
[0010] According to the current breakpoint X d1 (x, y), the next breakpoint X d2 (x, y) and the sampling point X between the current breakpoint and the next breakpoint k (x, y) forms a stroke, d1 is an odd number, and 1≤d1≤n, d2 is an even number, and 1≤d2≤n;
[0011] Form a text image by using multiple strokes within a sampling time;
[0012] Calculate the similarity between the text image and the images of the corresponding characters in different fonts.
[0013] Furthermore, the step of determining the breakpoints existing in all sampling points includes:
[0014] Determine whether the sampling time of two adjacent sampling points is greater than the sampling interval;
[0015] If the sampling time of two adjacent sampling points is greater than the sampling interval, both sampling points are breakpoints;
[0016] The first sampling point within the acquisition time is the breakpoint;
[0017] The last sampling point within the acquisition time is the breakpoint.
[0018] Furthermore, the process of calculating the similarity between the text image and the images of the corresponding characters in different fonts includes:
[0019] Preprocess the text image;
[0020] Sample different fonts of the corresponding characters respectively to obtain sampling point Y k (1≤k≤n), the sampling point coordinate is Y k (x, y), 1≤k≤n;
[0021] Calculate the similarity between text images and different fonts of the corresponding words Among them, X 中心 (x, y) is the coordinate of the center of the text image, Y 中心 (x, y) are the coordinates of the centers of the corresponding characters in different fonts.
[0022] Furthermore, the process of preprocessing the text image includes:
[0023] Determine the location area of the text image;
[0024] The position area of the character image is rotated with reference to the position area of the images of the corresponding characters in different fonts, and the position area of the character image is scaled with reference to the size of the position area of the images of the corresponding characters in different fonts;
[0025] Determine the X coordinate of the center of the text image 中心 (x 1 ,y 1 );
[0026] The position area of the different font images of the corresponding characters is translated to the position area of the text image;
[0027] Determine the Y coordinate of the center of the different font image position areas of the corresponding characters 中心(x 2 ,y 2 ).
[0028] Furthermore, the text image includes text, letters, numbers or symbols.
[0029] It can be seen from the above technical scheme that the beneficial effects of the present invention are: the font forms of different gesture inputs are formed into text images, and the similarity between the text image and different font images of the corresponding characters is calculated to output the font closest to the text image, which not only improves the accuracy of input recognition and avoids repeated handwriting input; but also increases the diversity of output printed fonts and improves user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.
[0031] Figure 1 is a flow chart of the present invention;
[0032] Figure 2 A schematic diagram of the location area of a text image of the present invention;
[0033] Figure 3 It is a schematic diagram of the location area of different font images of corresponding characters of the present invention. DETAILED DESCRIPTION
[0034] The following embodiments of the technical solution of the present invention are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and are therefore only used as examples, and cannot be used to limit the protection scope of the present invention.
[0035] See also Figure 1-Figure 3 As shown, the present embodiment provides a method for controlling a printed font by gesture input, comprising:
[0036] Set the timer, set the collection time, set the collection interval. One collection time contains multiple sampling intervals.
[0037] According to the sampling interval, the sampling point X is obtained. k (1≤k≤n), n is the number of sampling points.
[0038] Record the sampling point coordinates X in chronological order k (x, y), 1≤k≤n, x is the horizontal coordinate of the sampling point, and y is the vertical coordinate of the sampling point.
[0039] Determine the breakpoint X that exists in all sampling points d (x, y), 1≤d≤n, if the number of breakpoints is 1, it is judged as an invalid handwriting input signal, if the number of breakpoints is n, it is judged as an invalid handwriting input signal.
[0040] According to the current breakpoint X d1 (x, y), the next breakpoint X d2 (x, y) and the sampling point X between the current breakpoint and the next breakpoint k (x, y) forms a stroke, d1 is an odd number, and 1≤d1≤n, d2 is an even number, and 1≤d2≤n, that is, when the current breakpoint is 1, the next breakpoint is 2, and the sampling points between the current breakpoint 1 and the next breakpoint 2 form a stroke; when the current breakpoint is 3, the next breakpoint is 4, and the sampling points between the current breakpoint 3 and the next breakpoint 4 form a stroke, ...
[0041] Multiple strokes within a sampling time are formed into a text image.
[0042] The similarity between the text image and the different font images of the corresponding characters is calculated, so as to output the font closest to the text image. This not only improves the accuracy of input recognition and avoids repeated handwriting input, but also increases the diversity of output print fonts and improves the user experience.
[0043] In this embodiment, the step of determining the breakpoints existing in all sampling points includes:
[0044] Determine whether the sampling time between two adjacent sampling points is greater than the sampling interval.
[0045] If the sampling time between two adjacent sampling points is greater than the sampling interval, both sampling points are breakpoints.
[0046] The first sampling point within the acquisition time is the breakpoint.
[0047] The last sampling point within the acquisition time is a breakpoint. If the coordinates of the first sampling point coincide with the coordinates of the last sampling point, the handwriting input signal is a closed text image.
[0048] In this embodiment, the process of calculating the similarity between the text image and the images of the corresponding characters in different fonts includes:
[0049] Preprocess the text image.
[0050] Sample different fonts of the corresponding characters respectively to obtain sampling point Y k (1≤k≤n), the sampling point coordinate is Y k(x, y), 1≤k≤n. The corresponding word is the corresponding word, letter, number or symbol etc. obtained by similarity matching algorithm and the word image. The similarity matching algorithm is a key point matching algorithm or a histogram statistical algorithm.
[0051] Calculate the similarity between text images and different fonts of the corresponding words Among them, X 中心 (x, y) is the coordinate of the center of the text image, Y 中心 (x, y) are the coordinates of the centers of different fonts of the corresponding characters. Each corresponding character corresponds to multiple different fonts. By calculating the similarity between the character image and different fonts, the font with the highest similarity is determined as the final printing font.
[0052] In this embodiment, the process of preprocessing the text image includes:
[0053] Determine the location area of the text image. The location area of the text image is determined based on multiple coordinates of the edge of the text image. For example, when the location area of the text image is set to a rectangle, selecting four vertex coordinates can not only form a rectangular coverage area, but also the coverage area can completely cover the text image. The four vertex coordinates are X a (x a ,y a ),X b (x b ,y b ),X c (x c ,y c ) and X d (x d ,y d ), a, b, c and d represent different vertices, x a 、x b 、x c and x d Represents the horizontal coordinates of vertices a, b, c and d, y a ,y b ,y c and d Represent the ordinates of vertices a, b, c, and d respectively.
[0054] The position area of the text image is rotated with reference to the position area of the different font images of the corresponding characters, so that the inclination state of the text image and the different font images of the corresponding characters are consistent, that is, in the same coordinate system, the inclination angle of the text image is the same as the inclination angle of the different font images of the corresponding characters; the position area of the text image is scaled based on the size of the position area of the different font images of the corresponding characters, so that the position area of the text image is consistent in size with the position area of the different font images of the corresponding characters.
[0055] Determine the X coordinate of the center of the text image 中心 (x 1 ,y 1 ),in, or or
[0056] The position area of the different font images of the corresponding word is translated to the position area of the text image.
[0057] Determine the Y coordinate of the center of the different font image position areas of the corresponding characters 中心 (x 2 ,y 2 ), the four vertices of the different font image position areas of the corresponding characters are a1, b1, c1 and d1, and the corresponding four vertex coordinates are X a1 (x a1 ,y a1 ),X b1 (x b1 ,y b1 ),X c1 (x c1 ,y c1 ) and X d1 (x d1 ,y d1 ), x a1 、x b1 、x c1 and x d1 Represents the horizontal coordinates of vertices a1, b1, c1 and d1, y a1 ,y b1 ,y c1 and d1 Represent the ordinates of vertices a1, b1, c1, and d1, respectively. or or
[0058] In this embodiment, the text image includes text, letters, numbers or symbols.
[0059] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.
Claims
1. A method for controlling printed fonts by gesture input, characterized in that: include: Set the timer, set the collection time, and set the collection interval; According to the sampling interval, the sampling point X is obtained. k (1≤k≤n), n is the number of sampling points; Record the sampling point coordinates X in chronological order k (x, y), 1≤k≤n, x is the horizontal coordinate of the sampling point, y is the vertical coordinate of the sampling point; Determine the breakpoint X that exists in all sampling points d (x, y), 1≤d≤n; According to the current breakpoint X d1 (x, y), the next breakpoint X d2 (x, y) and the sampling point X between the current breakpoint and the next breakpoint k (x, y) forms a stroke, d1 is an odd number, and 1≤d1≤n, d2 is an even number, and 1≤d2≤n; Form a text image by using multiple strokes within a sampling time; Calculate the similarity between the text image and the images of the corresponding characters in different fonts; Outputting a font closest to the text image according to the similarity; The step of determining the breakpoints existing in all sampling points comprises: Determine whether the sampling time of two adjacent sampling points is greater than the sampling interval; If the sampling time of two adjacent sampling points is greater than the sampling interval, both sampling points are breakpoints; The first sampling point within the acquisition time is the breakpoint; The last sampling point within the acquisition time is the breakpoint.
2. The method for controlling printed fonts by gesture input according to claim 1, characterized in that: The process of calculating the similarity between the text image and the images of the corresponding characters in different fonts includes: Preprocess the text image; Sample different fonts of the corresponding characters respectively to obtain sampling point Y k (1≤k≤n), the sampling point coordinate is Y k (x, y), 1≤k≤n; Calculate the similarity between text images and different fonts of the corresponding words Among them, X 中心 (x, y) is the coordinate of the center of the text image, Y 中心 (x, y) are the coordinates of the centers of the corresponding characters in different fonts.
3. The method for controlling printed fonts by gesture input according to claim 2, characterized in that: The process of preprocessing the text image includes: Determine the location area of the text image; The position area of the character image is rotated with reference to the position area of the images of the corresponding characters in different fonts, and the position area of the character image is scaled with reference to the size of the position area of the images of the corresponding characters in different fonts; Determine the X coordinate of the center of the text image 中心 (x1, y1); The position area of the different font images of the corresponding characters is translated to the position area of the text image; Determine the Y coordinate of the center of the different font image position areas of the corresponding characters 中心 (x2, y2).
4. The method for controlling printed fonts by gesture input according to claim 1, characterized in that: The text image includes text, letters, numbers or symbols.
