CN102103762A - Method for realizing original handwriting - Google Patents

Method for realizing original handwriting Download PDF

Info

Publication number
CN102103762A
CN102103762A CN 201110033959 CN201110033959A CN102103762A CN 102103762 A CN102103762 A CN 102103762A CN 201110033959 CN201110033959 CN 201110033959 CN 201110033959 A CN201110033959 A CN 201110033959A CN 102103762 A CN102103762 A CN 102103762A
Authority
CN
China
Prior art keywords
point
stroke
line
sampling
width
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 201110033959
Other languages
Chinese (zh)
Other versions
CN102103762B (en
Inventor
周佳
邹学平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Eren Eben Information Technology Co Ltd
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN 201110033959 priority Critical patent/CN102103762B/en
Publication of CN102103762A publication Critical patent/CN102103762A/en
Priority to US13/982,749 priority patent/US9183428B2/en
Priority to JP2013550749A priority patent/JP5706001B2/en
Priority to PCT/CN2012/070693 priority patent/WO2012103794A1/en
Priority to KR1020137020108A priority patent/KR101516339B1/en
Priority to TW101102811A priority patent/TW201237775A/en
Application granted granted Critical
Publication of CN102103762B publication Critical patent/CN102103762B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • User Interface Of Digital Computer (AREA)
  • Processing Or Creating Images (AREA)
  • Position Input By Displaying (AREA)

Abstract

The invention provides a method for realizing original handwriting. The method comprises the following steps of: sampling a contact in real time and acquiring the position information and practical pen width of a sampling point; obtaining the central line of a stroke determined by adjacent sampling points and the position information and longitudinal pen width of each point on the central line according to the position information and practical pen width of the sampling point; obtaining the filling gray value of a corresponding pixel point at an intersection point through the position information of each point on the central line of intersecting strokes, a longitudinal pen width, the trends of intersecting strokes and the slope relation between respective central lines; and filling corresponding pixel points to display handwriting with a style of writing. By adopting the method, handwriting is configured into a bitmap and the bitmap is transmitted to a bottom layer pattern module for displaying by directly operating the bottom layer pattern module without drawing any complex curve, so that pattern processing of a system is avoided, the processing speed of style of writing is increased, and smooth writing experience is brought to a user.

Description

Method for realizing original handwriting
Technical Field
The invention relates to a handwriting input technology, in particular to a method for realizing original handwriting.
Background
With the continuous progress of technology development, many electronic devices with handwriting input systems are beginning to enter the market, such as mobile phones, electronic books, tablet computers, etc. with handwriting functions.
Taking a handwriting tablet personal computer as an example, the handwriting tablet personal computer is integrated with a handwriting input system, replaces the traditional keyboard input, and is easier to meet the mobile office requirements in all directions; when the handwriting input system is used, after a user inputs characters or graphs on the handwriting input system through the handwriting pen, the input characters or graphs are directly displayed on the display interface of the tablet computer.
However, the handwriting processing methods adopted by the handwriting input system of the tablet computer in the current market mainly include the following two methods:
firstly, connecting points passed by a handwriting pen into lines to form handwriting input handwriting, wherein the handwriting obtained by the processing is not smooth enough and lacks the real effect of the front of the handwriting pen;
and secondly, the method is realized by curve fitting, namely a smooth curve closest to all sampling points is calculated, then the curve is drawn by using the curve drawing function of the graphic system, and when the curve is drawn, although the graphic system has strong functions, the drawing speed and effect of the curve are not ideal due to no pertinence, so that a user obviously feels that the display speed of handwriting lags behind the writing speed of the user when using the handwriting pen, and the user experience is greatly reduced.
Disclosure of Invention
The invention provides a method for realizing original handwriting, which ensures that the handwriting written by a user has a writing style as the handwriting written on traditional paper, ensures that the display speed of the handwriting follows the writing speed of the user and brings smooth writing experience to the user.
In order to solve the technical problem, the invention provides a method for realizing original handwriting, which comprises the following steps of:
determining the pen width: continuously sampling the handwriting, determining adjacent sampling points according to the sampling time sequence, taking the former sampling point as a sampling starting point and the latter sampling point as a sampling end point, detecting the pressure value and the position information of the corresponding sampling point, and determining the actual pen width of each sampling point according to the pressure value of each sampling point;
main line setting: taking a connecting line of the sampling starting point and the sampling end point as a central line of strokes between the two points, acquiring position information of each point on the central line and corresponding longitudinal stroke width, and setting one of two intersected stroke central lines as a main line in the x-axis direction;
judging and processing: calculating filling gray values of corresponding pixel points at the intersection points of the two intersecting strokes according to the position information and the longitudinal stroke width of each point on the central lines of the two intersecting strokes, the slope of the central lines of the two intersecting strokes and the trends of the two intersecting strokes;
displaying: and filling and displaying corresponding pixel points according to the filling gray values.
In an embodiment of the present invention, the main line setting step includes: the two intersected strokes are divided into a first stroke and a second stroke according to the time sequence, and the central line of the first stroke is set as a main line in the x-axis direction.
In an embodiment of the present invention, the determining process includes: judging whether the absolute value of the slope of the center line of the second stroke is smaller than a preset slope value A, if so, further judging whether the trend of the second stroke is the same as the trend of the first stroke, and if so, calculating the longitudinal stroke width w corresponding to the intersection point of the center lines corresponding to the two intersected strokes in the first stroke and the second strokejAnd wj', and obtaining an absolute value n ═ w of the difference thereofj-wj' |, according to the value of n and wjAnd wjThe size relationship of the' is to perform smooth transition processing on the intersection point of the central lines, and then calculate the filling gray value of the corresponding pixel point at the intersection point of the two intersection strokes.
In an embodiment of the present invention, the determining process includes: judging whether the absolute value of the slope of the center line of the second stroke is larger than or equal to a preset slope value A, if so, taking the intersection point of the center lines of the two intersected strokes as the center of a circle and the actual pen width d corresponding to the intersection point of the center lines at the intersection point of the two intersected strokesjTwo semi-circles are determined for the radius, wherein the starting point and the end point of one semi-circle are both in the longitudinal stroke width w of the first strokejThe starting point and the end point of the other semicircle are both in the longitudinal stroke width w of the second strokej' above, the filling gray values of the pixel points determined by the semi-circles are then calculated respectively.
In an embodiment of the present invention, the determining process includes: if the absolute value of the slope of the center line of the second stroke is judged to be smaller than a preset slope value A, but the trend of the second stroke is different from the trend of the first stroke, the slope of the center line of the first stroke and the slope of the center line of the second stroke are further judged, and at the intersection point of the two intersected strokes, the intersection point of the center lines of the two intersected strokes is taken as the center of a circle, and the actual pen width d corresponding to the intersection point of the center lines is taken as the center of a circlejDetermining a semicircle for the radius, wherein the starting point and the end point of the semicircle are both on the longitudinal stroke width of the stroke with the large slope at the intersection point, and then calculating the filling gray value of the pixel point determined by the semicircle.
In one embodiment of the present invention, the value of n is determined according to the value of wjAnd wj' performing a smooth transition process at the intersection, the smooth transition process comprising the following steps:
judging whether the n value is 0, if so, not processing the intersection point, otherwise, rounding the n value, and if 0 < n < 1, taking the n value as 1, and taking the unit step length on the y axis as
Figure BDA0000046424020000031
Using the point corresponding to the intersection point of the central lines on the x axis as a midpoint and using the first point close to one side of the first stroke
Figure BDA0000046424020000032
Or
Figure BDA0000046424020000033
A point as a starting point, with the first stroke adjacent to one side of the second stroke
Figure BDA0000046424020000034
OrTaking the point as a terminal point;
with wjAs an initial value, the stroke width w of the corresponding point on the central line is moved by one unit length from the starting point to the end point on the x-axisr+1The longitudinal stroke width w of the previous pointrRespectively adding or subtracting unit step length on the upper side and the lower side of the central line
Figure BDA0000046424020000036
In an embodiment of the present invention, the formula for calculating the filling gray value of the corresponding pixel point at the intersection of the two intersecting strokes is a linear filling formula: max (0, min (1.0, 0.5 Xw)r-er+0.5)), wherein wrA longitudinal stroke width of a corresponding point r on the center line, erThe distance from the corresponding pixel point to the point r.
In an embodiment of the present invention, calculating the filling gray value of the pixel point determined by the semicircle includes:
judging whether the stroke end with semicircle drawn by corresponding stroke is the left end point or the right end point of the stroke, further judging whether the slope of the center line of the stroke is more than or equal to 0 or less than 0, if the stroke end is the left end point of the stroke and the slope of the center line of the stroke is more than or equal to 0, the intersection point of the semicircle and the center line is in the boundary area of the longitudinal stroke width in the stroke above the center line of the stroke, wherein the intersection point of the semicircle and the center line is in the boundary area of the longitudinal stroke width in the strokeThe pixel filling gray value is calculated by a linear filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal to
Figure BDA0000046424020000041
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,rounding up, w longitudinal stroke width of the centerline intersection in the stroke, d actual stroke width of the centerline intersection in the stroke, wzThe longitudinal width of the center line corresponding to each point on the extension line of the end, ezThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+0.5)) in which e is presentjThe distance of the corresponding pixel point to the intersection point, djThe actual pen width of the center intersection point is taken as the actual pen width of the center intersection point;
if the stroke end is the left end point of the stroke and the slope of the center line of the stroke is less than 0, in a boundary area of the longitudinal stroke width w below the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with gray values through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal toThe line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure BDA0000046424020000044
rounding upwards; at the semi-circle centerAnd the filling gray values of the pixel points in other areas in the determined pixel points are determined through a semicircle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
In an embodiment of the present invention, calculating the filling gray value of the pixel point determined by the semicircle further includes:
if the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, in a boundary area of the longitudinal stroke width w below the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal toThe line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5));
if the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, in a boundary area of the longitudinal stroke width w above the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal to
Figure BDA0000046424020000053
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
In an embodiment of the present invention, when a certain pixel point has a plurality of filling gray values, a maximum value of the plurality of filling gray values is taken.
The present invention also provides an electronic device, comprising:
a handwriting screen: the handwriting display is used for providing a writing interface and displaying writing;
a sampling detector: the handwriting input device is used for sampling the touch points of the handwriting to obtain the position information and the actual pen width of the sampling points;
the microprocessor: the microprocessor comprises a handwriting original handwriting realization module, and the handwriting original handwriting realization module realizes the display of the handwriting original handwriting with the stroke through the realization method as claimed in any one of claims 1-10.
The invention has the beneficial effects that: the method for realizing the original handwriting comprises the steps of sampling a contact in real time, acquiring the position information and the actual pen width of a sampling point, acquiring the central line of strokes between adjacent sampling points according to the position information and the actual pen width of the sampling point, and acquiring the position information and the longitudinal pen width of each point on the central line, acquiring the filling gray value of a corresponding pixel point at an intersection point according to the position information and the longitudinal pen width of each point on the central line of the intersected strokes and the slope relation between the trend of the intersected strokes and the central line of the intersected strokes, and filling the corresponding pixel point, thereby displaying the original handwriting with the pen point.
In addition, the method provided by the invention does not need to carry out complex curve drawing, avoids the graphic processing of the system, directly operates the bottom layer graphic module, constructs the handwriting into a bitmap and delivers the bitmap to the bottom layer graphic module for display, improves the processing speed of the original handwriting, brings smooth writing experience to users, is simplified, and greatly reduces the system overhead.
Drawings
FIG. 1 is a diagram illustrating the processing of a single stroke that is not intersected by other strokes in one embodiment of the invention;
FIG. 2 is a schematic diagram illustrating a filling effect of stroke lines and stroke widths according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating intersection processing for two intersecting strokes according to an embodiment of the present invention.
Detailed Description
Aiming at the problems that the handwriting processing method adopted by the existing handwriting input system, such as a tablet computer, cannot display the front of a user writing characters, and the display speed of the handwriting is lagged behind the writing speed of the user greatly when the front of the handwriting is processed, the invention provides a new original handwriting realization method, which directly operates a bottom layer graphic module without complex curve drawing and constructs the handwriting into a bitmap to be displayed by the bottom layer graphic module, thereby avoiding the graphic processing of the system, improving the processing speed of the front of the handwriting and bringing smooth writing experience to the user.
The present invention will be described in further detail with reference to the following detailed description and accompanying drawings.
In the process of writing different strokes, different pressures are usually applied in the process of writing different strokes, such as heavier at the pen-down position and lighter at the pen-up position, and the thickness of the written strokes can be changed through the change of the pressures, so that the stroke effect is displayed. In this example, the implementation of the stroke front is explained by using a tablet computer as a carrier, all characters are broken into single strokes, and the relationship between the strokes is divided into the following two types: 1. a single stroke exists alone; 2. one stroke intersects another stroke. The strokes proposed by the embodiment refer to single strokes determined by adjacent sampling points, are not strokes referred to in Chinese character writing, and even Chinese character strokes such as bends, hooks and the like are also decomposed into a plurality of continuous single strokes determined by sampling starting points and sampling end points.
In view of the above situation, when a single stroke exists alone, the width of the stroke changing in real time and two stroke end points of the stroke need to be processed, and when the strokes intersect, the intersection point of the intersecting strokes, i.e. the inflection point, also needs to be processed. The method comprises the following specific steps:
in the computer storage device, the corresponding relation between the pressure value and the pen width is stored in advance, and the corresponding pen width can be obtained according to the detected pressure value, wherein the pen width is the actual pen width; if the pressure is divided into 1024 levels, the corresponding relation between the pressure values and the pen width is established one by one, the expression form can be a function or a table, and then the corresponding actual pen width can be obtained according to the detected pressure values. For higher accuracy, the pressure may also be set to a higher level, such as 2048.
Then, the sampling frequency is set according to actual conditions, for example, when a regular script is written, because the writing speed is relatively slow, the lower sampling frequency can be selected to meet the requirement, for example, when the regular script or cursive script is written, the writing speed is fast, and the higher sampling frequency can be selected correspondingly to ensure the handwriting writing effect. The sampling frequency in this example is preferably 120 times per second to ensure the handwriting effect.
Sampling is carried out on a contact point when a user writes according to a selected sampling frequency, a stroke is determined at adjacent sampling points, the former sampling point can be determined as a sampling starting point according to a time sequence, the latter sampling point is determined as a sampling end point, if the sampling points acquired according to the time sequence are respectively 1, 2 and 3, the sampling points 1 and 2 are adjacent sampling points, when the stroke is determined, the sampling point 1 is the sampling starting point, the sampling point 2 is the sampling end point, the sampling points 2 and 3 are also adjacent sampling points, when the stroke is determined, the sampling point 2 is the sampling starting point, the sampling point 3 is the sampling end point, and so on. And then, obtaining the actual pen width d of the sampling point according to the pressure value of the sampling point, wherein in the example, the direction of the actual pen width d of the sampling point is defaulted to be vertical to the central line of the stroke determined by the sampling point. Obtaining the central line of the stroke determined by the adjacent sampling points, the position information of each point on the central line and the longitudinal stroke width according to the position information (such as coordinate information) of the sampling points and the actual stroke width d, wherein the longitudinal stroke width of the sampling points is the value corresponding to the y axis converted from the actual stroke width of the sampling points, and obtaining the filling gray value of each pixel point in the stroke according to the position information of each point on the central line and the longitudinal stroke width corresponding to each point on the central line; in this example, sampling points 1 and 2 are selected as examples for further explanation.
Referring to FIG. 1, the actual widths of sampling points 1 and 2 are d1And d2The coordinate values are respectively (x)1,y1) And (x)n,yn) The method comprises the steps of obtaining a central line L according to coordinate information of sampling points 1 and 2, dividing the central line L into an x main line or a y main line according to the slope of the L, dividing the L into the x main line when the slope of the L is smaller than or equal to 1, otherwise, dividing the L into the y main line, and switching an x axis and a y axis when the L is the y main line, namely converting the L into the x main line. Therefore, the present embodiment converts L into x main line without distinguishing x main line or y main line, please refer to fig. 1, and then according to the actual pen width d1And d2The longitudinal stroke width w of the sampling starting point 1 and the sampling end point 2 in the y-axis direction can be obtained1And w2According to (x)1,y1) And (x)n,yn) Coordinate information of each point on the central line can be obtained through a DDA algorithm, and in the DDA algorithm, the unit length of movement on the x axis can be one pixel point. Then, the longitudinal stroke width corresponding to each point on the central line is calculated as follows:
in fig. 1, the vertical stroke width of the sampling start point 1 is w1Longitudinal stroke width w of sampling end point 22Is set as wnW is to be1And wnIs compared with the difference (x) of the x-coordinates of the sampling start point 1 and the sampling end point 21-xn) Comparing to obtain unit step length
Figure BDA0000046424020000081
Then taking the point corresponding to the sampling start point 1 on the x axis as a starting point, taking the point corresponding to the sampling end point 2 on the x axis as an end point, and taking w on the y axis1As an initial value, the vertical stroke width w of a corresponding point on the center line for every unit length of movement toward the end point on the x-axisi+1The longitudinal stroke width w of the previous pointiPlus unit step size
Figure BDA0000046424020000082
The unit length of movement on the x-axis when the longitudinal stroke width corresponding to each point on the center line is obtained is the same as the unit length of movement when the position information of each point on the center line is obtained, and is also a pixel point. Accordingly, when the unit step size is obtained as
Figure BDA0000046424020000091
When the pen is moved to the end point by one unit length on the x-axis, the pen width w of the corresponding point on the central linei+1The longitudinal stroke width w of the previous pointiAdding
The method comprises the following specific steps: taking the sampling starting point 1 as a starting point and the longitudinal stroke width w1For the initial value, the vertical stroke width w corresponding to the corresponding point on the central line is moved by one unit in the x-axis toward the sampling end point 2i+1W of the previous pointiPlus unit step sizeFor example, a vertical line of a point next to the sampling start point 1 with one pixel point as a unit on the x-axisThe width of the pen is as follows:
Figure BDA0000046424020000094
and sequentially moving a pixel point downwards on the x axis according to the method until the sampling end point 2 is at the corresponding end point on the x axis, so as to obtain the longitudinal stroke width corresponding to each point on the central line.
When determining the filling gray value of the corresponding pixel point according to the obtained position information of each point on the center line and the corresponding longitudinal stroke width, first, the distance from the corresponding pixel point to the corresponding point on the center line needs to be determined, because in this example, when obtaining the position information of each point on the center line and the longitudinal stroke width, the unit of movement on the x-axis is one pixel point, and each point on the corresponding center line corresponds to a corresponding row of pixel points, therefore, the distance e from the center point of the pixel point to the corresponding point on the center lineiThe difference value between the coordinate value of the central point on the y axis and the coordinate value of the corresponding point on the central line is obtained, and therefore, the distance e from the central point of the pixel point to the corresponding point on the central line is obtainediIn the process, only simple addition and subtraction operation is needed, operations such as multiplication, division or root division are not needed, the calculation amount is greatly reduced, the calculation time and the system overhead are saved, the processing speed is increased, and the user experience is improved.
Calculating the distance e from the pixel point to the corresponding point i on the central lineiThen, max (0, min (1.0, 0.5 xw) is filled according to the straight line filling formulai-ei+0.5)) to obtain the corresponding filling gray value, where wiIs the longitudinal distance of the corresponding point i on the centerline. For example, when 0.5 xwi-eiWhen the value of (3) is 0.3, the obtained filling gray value of the pixel point is 0.8, when the value is 0.5 xwi-eiWhen the value of (a) is-0.5, the filling gray value of the pixel point is 0, when the value of (b) is 0.5 xwi-eiWhen the value of (1) is greater than the predetermined value, the filling gray value of the pixel point is 1, and the filling effect of the stroke line width is shown in fig. 2.
In this example, the position information of a certain point on the central line, the vertical stroke width and the gray filling value of the pixel point corresponding to the point are calculatedSimultaneously, such as: obtaining the value y of a certain point on the central line on the y axis through the DDA algorithmiAccording to
Figure BDA0000046424020000101
The vertical stroke width of the dot can be obtained, and then the linear filling formula max (0, min (1.0, 0.5 xw) is usedi-ei+0.5)) to obtain the gray filling value of the pixel point corresponding to the point, and then sequentially calculating the position information of the points above and below the center line, the vertical stroke width and the gray filling value of the corresponding pixel point in the above manner.
When processing the stroke, it needs to process the stroke end point of the stroke, when processing the stroke end point, firstly, it needs to judge and determine whether two sampling points of the stroke are the stroke end points of the stroke, i.e. judge whether the sampling points of the stroke intersect with other stroke, if not, the sampling points are the stroke end points of the stroke, then judge whether the slope of the center line of the stroke is greater than or equal to 0 or less than 0, and further judge whether the stroke end point is the left end point or the right end point of the stroke, then the center line end point k corresponding to the stroke end point is used as the center of a circle, and the actual pen width d corresponding to the center line end point k is used as the center of a circlekDetermining a semicircle for the radius, wherein the starting point and the end point of the semicircle are both at the longitudinal stroke width w corresponding to the endpoint k of the central linekThen, the filling gray value of the pixel point determined by the semicircle is calculated, which specifically includes the following steps:
if the stroke end point is the left end point and the slope of the center line of the stroke is greater than or equal to 0, the longitudinal stroke width w corresponding to the semicircle and the center line end point k is above the center linekThe pixel filling gray value of the boundary area is determined by a straight line filling formula: max (0, min (1.0, 0.5 Xw)s-es+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal to
Figure BDA0000046424020000102
In which the line segment ofThe area corresponding to the upper side of the extension line of the center line; wherein,rounding upwards, e.g. when
Figure BDA0000046424020000104
When the value is 1.2, the value is 2, wsThe longitudinal width of the center line corresponding to each point on the extension line of the end, esThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; in this example, the position information of each point on the extended line of the center line can be obtained by the DDA algorithm used in determining the position information of each point on the center line, and the width of each point on the extended line of the center line in the longitudinal direction is w in this examplesAre all taken as wkAnd the filling gray values of the other pixel points at the left end point, namely the pixel points in other areas in the pixel points determined by the semi-circle, pass through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)k-ek+0.5)) in which e is presentkIs a calculation formula for calculating the distance between two points. Due to ekIs usually relatively small, so in this example, e in the semicircle filling formulakThe operation speed can be optimized by establishing a direct value taking table which is calculated in advance.
If the stroke end point is the left end point and the slope of the center line of the stroke is less than 0, the longitudinal stroke width w corresponding to the semicircle and the center line end point k is below the center linekThe pixel filling gray value of the boundary area is determined by a straight line filling formula: max (0, min (1.0, 0.5 Xw)s-es+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal to
Figure BDA0000046424020000111
The line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure BDA0000046424020000112
rounding up, wsThe longitudinal width of the center line corresponding to each point on the extension line of the end, esThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; the filling gray values of the pixel points in other areas of the pixel points determined by the semicircle at the other pixel points at the left end point are determined by a semicircle filling formula: max (0, min (1.0, 0.5 xd)k-ek+0.5)) in which e is presentkIs a calculation formula for calculating the distance between two points.
If the end point of the stroke is the right end point and the slope of the center line of the stroke is greater than or equal to 0, the determined semicircle and the longitudinal stroke width w corresponding to the end point are positioned below the center linekThe filling gray value of the pixel point of the boundary area is determined by the linear filling formula: max (0, min (1.0, 0.5 Xw)s-es+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the right side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal to
Figure BDA0000046424020000113
The line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure BDA0000046424020000114
rounding up, wsThe longitudinal width of the center line corresponding to each point on the extension line of the end, esThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; the filling gray values of other pixel points at the right end point are calculated by a semicircle filling formula: max (0, min (1.0, 0.5 xd)k-ek+ 0.5)).
If the stroke end point is the right end point and the slope of the center line of the stroke is less than 0, the stroke end point is above the center line, i.e. the determined semicircle and the longitudinal stroke width w corresponding to the end pointkThe filling gray value of the pixel point of the boundary area is determined by the linear filling formula: max (0, min (1.0, 0.5 Xw)s-es+0.5)) to obtainThe boundary area is on the x-axis, the sampling point corresponding to the end point is on the right side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is taken as the length
Figure BDA0000046424020000121
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,
Figure BDA0000046424020000122
rounding up, wsThe longitudinal width of the center line corresponding to each point on the extension line of the end, esThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; the filling gray values of other pixel points at the right end point are calculated by a semicircle filling formula: max (0, min (1.0, 0.5 xd)k-ek+ 0.5)).
For example, assuming that both ends of the stroke determined by sample 1 and sample 2 in fig. 1 are stroke end points, and the slope of the center line L of the stroke is greater than 0, when processing the left end point, the center of the stroke is taken as the center of the circle at sample 1, and d is taken as the center of the circle1The radius is made into a semicircle which is respectively connected with w1Are intersected at both ends of the semicircle1The filling gray value of the upper boundary region is determined by a straight line filling formula: max (0, min (1.0, 0.5 Xw)s-es+0.5)) is obtained, as shown in fig. 1, the intersection region is the point x corresponding to the sampling point 1 on the x-axis1Left side of (1), in x1Is a terminal point, and has a length of
Figure BDA0000046424020000123
Line segment L of1Pixel point corresponding to upper side of extension line of the end center line, and L1The position information of each point on the extension line of the corresponding central line L is obtained by the DDA algorithm adopted when the position information of each point on the central line L is obtained, and the longitudinal stroke width of each point is taken as w1And the filling gray values of the pixel points in other areas of the left end point can be obtained through a semicircle filling formula: max (0, min (1.0, 0.5 xd)1-e1+ 0.5)); when processing the right end point at sampling point 2, the processing mode and the left endThe treatment of the dots is reversed, i.e. in the semicircle and w2The filling gray value of the lower boundary region of (1) is represented by the linear filling formula max (0, min (1.0, 0.5 xw)s-es+ 0.5)); as shown in FIG. 1, the boundary region is a point x corresponding to the sampling point 2 on the x-axis2To the right side of (1), in x2As a starting point, has a length ofLine segment L of2The pixel points in the region corresponding to the lower side of the extension line of the end center line are the same as L2The position information of each point on the extension line of the corresponding central line L is obtained by the DDA algorithm adopted when the position information of each point on the central line L is obtained, and the longitudinal stroke width of each point is taken as w2The filling gray values of the pixel points in other areas are filled by a semicircle filling formula max (0, min (1.0, 0.5 × d)2-e2+ 0.5)).
It should be noted that when the slope of the center line L of the stroke is equal to 0, the actual stroke width d of the sampling point coincides with the longitudinal stroke width w, and d is equal to w, and at this time, the boundary area is 0, that is, no pixel point falls in the boundary area. At this time, the endpoint is processed only by using a semicircle processing filling formula.
When the strokes intersect with each other, the intersection point (i.e. inflection point) of the two intersecting strokes is also processed, and when the intersection point is processed, the actual stroke width, the longitudinal stroke width and the position information and the longitudinal stroke width of each point on the center line of the sampling point are detected through the steps, the method further comprises the following steps:
main line setting: taking a connecting line of a sampling starting point and a sampling end point as a central line of the stroke between the two points, and setting one of the central lines of the two intersected strokes as a main line in the x-axis direction;
judging and processing: calculating filling gray values of corresponding pixel points at the intersection points of the two intersecting strokes according to the position information and the longitudinal stroke width of each point on the central line of the two intersecting strokes, the slope of the central line of the two intersecting strokes and the trend of the two intersecting strokes;
displaying: and filling and displaying corresponding pixel points according to the obtained filling gray values.
In this example, the main line may be set by determining two intersected strokes as a first stroke and a second stroke respectively in time sequence, and setting the center line of the first stroke as the main line in the x-axis direction.
After the main line is set, it is determined whether the slope of the center line of the second stroke is smaller than a preset slope value a, where a is a compensation value, and a is 0 to 0.5, that is, the value range of a is greater than or equal to 1 and less than or equal to 1.5, and it is understood that the specific value of a may be selected according to the thickness of the stroke and the requirement of the processing speed, and in this example, considering that the processing speed of the stroke is increased as much as possible, the value of a is preferably 1.5, and if the slope of the center line of the second stroke is less than 1.5, it is further determined whether the trend of the second stroke is the same as the trend of the first stroke, and if so, the longitudinal stroke width w corresponding to the intersection point of the center lines corresponding to the two intersecting strokes in the first stroke and the second stroke is calculatedjAnd wj', and obtaining an absolute value n ═ w of the difference thereofj-wj' |, according to the value of n and wjAnd wjThe size relationship of' performs smooth transition processing on the intersection point of the center lines, and then calculates the filling gray value of the corresponding pixel point at the intersection point of the center lines, in this example, the trend of the two intersecting strokes is whether the directions from the starting point to the end point of the two intersecting strokes point to the positive direction or the negative direction of the x axis, which is specifically as follows:
calculating the longitudinal stroke width w of the intersection point of the central lines of the first stroke and the second stroke in the first stroke and the second strokejAnd wj' and then calculates the absolute value n ═ w of the differencej-wj'I', judging whether the n value is 0, if so, not processing the intersection point drawn by the two intersecting pens, otherwise, rounding the n value upwards, if 0 < n < 1, taking the n value as 1, and then obtaining the unit step length on the y axis as
Figure BDA0000046424020000131
Then taking corresponding points as a starting point and an end point on the x axis according to wjAnd wjThe magnitude relation of' carries out smooth transition processing on the intersection point of two intersecting strokes, which is concretely as follows:
determining a starting point and an end point: using the point corresponding to the intersection point of the central lines on the x axis as the midpoint, and using the first stroke on the side close to the first stroke
Figure BDA0000046424020000141
Or
Figure BDA0000046424020000142
The point is a starting point, with the first side near the second strokeOr
Figure BDA0000046424020000144
Taking the point as a terminal point; when the value of n is an odd value, the second of the two sides is selected respectively
Figure BDA0000046424020000145
The points are a starting point and an end point, and when the value of n is an even value, the first points on two sides are respectively selected
Figure BDA0000046424020000146
The points are a start point and an end point.
Smoothing: judgment of wjAnd wj' size, in wjIs an initial value, starting from a starting point on the x-axis when wj<wjWhen the stroke length is equal to the stroke length, the stroke length w of the corresponding point on the central line is equal to the stroke length w of the corresponding point on the central liner+1The longitudinal stroke width w of the previous pointrAdding unit step length on the upper and lower sides of the central line
Figure BDA0000046424020000147
When w isj>wjWhen, each time moves one to the end pointUnit length, longitudinal stroke width w of corresponding point on central liner+1The longitudinal stroke width w of the previous pointrRespectively reducing unit step length on the upper and lower sides of the central line
Figure BDA0000046424020000148
When w isj=wj', unit step size
Figure BDA0000046424020000149
Is 0.
Obtaining and filling the gray value of the corresponding pixel: obtaining the corresponding pixel point of the stroke width at the intersection point through the smooth transition processing, and filling the formula max (0, min (1.0, 0.5 xw) according to the straight liner-er+0.5)) to obtain the filling gray value of the corresponding pixel point, and then filling and displaying the corresponding pixel point according to the filling gray value, wherein wrA longitudinal stroke width of a corresponding point r on the center line, erAnd obtaining the position information of each point on the stroke central line when the position information of each point on the stroke central line is obtained for the distance from the corresponding pixel point to the point r.
If the slope of the center lines of the first stroke and the second stroke does not meet the condition or the slope of the center lines of the first stroke and the second stroke meets the condition, but the trends of the first stroke and the second stroke are different, at the intersection point of the two intersecting strokes, the intersection point of the center lines of the first stroke and the second stroke is taken as the center of a circle, and the actual pen width d of the intersection point of the center lines is taken as the actual pen width djDetermining a semicircle for the radius, and then calculating the filling gray value of the pixel point determined by the semicircle, wherein the filling gray value is as follows:
judging whether the absolute value of the slope of the center line of the second stroke is greater than or equal to a preset slope value A, wherein A is 1.5, if so, at the intersection point of the two intersecting strokes, taking the intersection point of the center lines of the two intersecting strokes as the center of a circle, and taking the actual pen width d corresponding to the intersection point of the center lines as the center of a circlejDetermining two semicircles for the radius in the direction of the outer end of the corresponding stroke and the direction of the extension line of the center line of the end, wherein the starting point and the end point of one semicircle are both in the longitudinal direction of the first strokeWidth wjThe starting point and the end point of the other semicircle are both in the longitudinal stroke width w of the second strokejAnd then, respectively calculating the filling gray values of the pixel points determined by the semi-circles.
In this example, if a certain pixel has a plurality of filling gray values, the maximum value of the gray values is selected to fill the certain pixel.
If the absolute value of the slope of the center line of the second stroke is judged to be smaller than a preset slope value A, namely smaller than 1.5, but the trend of the second stroke is different from the trend of the first stroke, the slope of the center line of the first stroke and the slope of the center line of the second stroke are further judged, and at the intersection point of the two intersected strokes, the intersection point of the center lines of the two intersected strokes is taken as the center of a circle, and the actual pen width d corresponding to the intersection point of the center lines is taken as the center of a circlejAnd determining a semicircle for the radius, wherein the starting point and the end point of the semicircle are both on the longitudinal stroke width of the stroke with the large slope at the intersection point, and then calculating the filling gray value of the pixel point determined by the semicircle.
The filling gray value of the pixel point determined by calculating the semicircle is specifically as follows: judging whether the stroke end with a semicircle drawn by the corresponding stroke is the left end point or the right end point of the stroke, further judging whether the slope of the center line of the stroke is more than or equal to 0 or less than 0, if the stroke end is the left end point of the stroke and the slope of the center line of the stroke is more than or equal to 0, then above the center line of the stroke, the intersection point of the semicircle and the center line is in the boundary area of the longitudinal stroke width in the stroke, and the pixel point filling gray value passes through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is the length
Figure BDA0000046424020000151
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,
Figure BDA0000046424020000152
rounding up, w longitudinal stroke width of the centerline intersection in the stroke, d actual stroke width of the centerline intersection in the stroke, wzThe longitudinal width of the center line corresponding to each point on the extension line of the end is w in the examplez=w,ezThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; filling gray values of pixel points in other areas in the pixel points determined by the semicircle are determined through a semicircle filling formula: max (0, min (1.0, 0.5 xd)j-ej+0.5)) in which e is presentjThe distance of the corresponding pixel point to the intersection point, djThe actual pen width of the center point of intersection.
If the stroke end is the left end point of the stroke and the slope of the center line of the stroke is less than 0, the pixel point of the intersection area of the longitudinal stroke width w of the intersection point of the semicircle and the center line below the center line of the stroke is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal toThe line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure BDA0000046424020000162
rounding upwards; filling gray values of pixel points in other areas in the pixel points determined by the semicircle are determined through a semicircle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
If the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, in a boundary area of the longitudinal stroke width w below the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point is filled with a gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), said junction region being on the x-axisThe sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is taken as
Figure BDA0000046424020000163
The line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure BDA0000046424020000164
rounding upwards; filling gray values of pixel points in other areas in the pixel points determined by the semicircle are determined through a semicircle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
If the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, the pixel point of the intersection area of the semicircle and the center line and the longitudinal stroke width w above the center line of the stroke is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal to
Figure BDA0000046424020000165
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
This is further illustrated in the case of fig. 3: the slope of the first stroke determined by the sampling points 1 and 2 is less than 1, the absolute value of the slope of the center line of the second stroke intersecting with the first stroke determined by the sampling points 1 and 2 is also less than 1, but the direction of the second stroke is different from the direction of the first stroke, therefore, it needs to further judge which of the absolute values of the slopes of the center lines of the first stroke and the second stroke is the largest, it can be known from fig. 3 that the slope of the center line of the first stroke is larger than the slope of the center line of the second stroke, and because the end of the sampling point 2 is the right end point of the first stroke, and the slope of the center line of the first stroke is larger than 0, therefore, the processing procedure of the intersection point, i.e. the inflection point, of the:
using sampling point 2 (i.e. central line intersection point 2) as the center of circle and d2Drawing a semicircle for the radius, the starting point and the end point of the semicircle are both at w2And then calculating the filling gray value of the pixel point determined by the semicircle, wherein the lower side L of the central line2The filling gray value of the pixel points in the corresponding interface region passes through a linear filling formula max (0, min (1.0, 0.5 xw)z-ez+0.5)) in which wz=w2,L2The corresponding boundary area is the point x corresponding to the sampling point 2 on the x-axis2To the right side of (1), in x2As a starting point, has a length of
Figure BDA0000046424020000171
Line segment L of2Pixel points in the region corresponding to the lower side of the extension line of the end center line, and L2The position information of each point on the extension line of the corresponding central line L is obtained according to a DDA algorithm adopted when the position information of each point on the central line L is obtained, and the filling gray value of pixel points in other areas in the pixel points determined by the semicircle is obtained through a semicircle filling formula: max (0, min (1.0, 0.5 xd)2-e2+ 0.5)).
The present invention also provides an electronic device, comprising:
a handwriting screen: the handwriting display interface is used for providing a writing interface and displaying writing;
a sampling detector: the handwriting input device is used for sampling the touch points of the handwriting to obtain the position information and the actual pen width of the sampling points; in the method, the sampling frequency of a sampling detector is set to be 120 times per second so as to ensure the handwriting effect, and then the sampling detector obtains the actual pen width of a sampling point according to the detected pressure value of the sampling point;
the microprocessor: the microprocessor comprises a handwritten original handwriting realization module, wherein the handwritten original handwriting realization module is used for processing strokes determined by sampling points according to the position information of the sampling points and the actual stroke width according to the method, the processing of the strokes comprises the steps of processing the linear stroke width of the strokes, the end points of the strokes and the intersection points of two intersected strokes in the method, then obtaining the filling gray values of corresponding pixel points according to the linear filling formula and the semicircular filling formula, in the example, when a certain pixel point has a plurality of filling gray values, the largest filling gray value is selected, finally, the corresponding pixel points are filled according to the obtained filling gray values, and the filling gray values are displayed by a handwriting screen.
The method provided by the invention converts the actual stroke width into one direction, and when the filling gray value of the corresponding pixel point is obtained, the distance from the corresponding pixel point to each point on the central line can be obtained only by simple addition and subtraction operation, so that the method greatly reduces the overhead of the system, improves the processing speed of the system and brings smooth writing experience to users while realizing the original handwriting with stroke front.
In addition, the method provided by the invention further determines the corresponding pixel points by drawing semi-circles on the end points and the intersection points of the strokes, divides the corresponding pixel points according to different actual conditions, and obtains the filling gray values of the corresponding pixel points at the end points and the intersection points through different filling formulas, so that the end points and the inflection points of the strokes are smooth and have no saw teeth, and the displayed stroke front has better and smoother effect.
Particularly, the electronic device related to the invention is a handwriting tablet computer, and handwriting input is performed through a handwriting pen.
The foregoing is a more detailed description of the invention that is presented in conjunction with specific embodiments, and the specific embodiments of the invention are not to be considered limited to these descriptions; therefore, for those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all should be considered as belonging to the protection scope of the invention.

Claims (11)

1. A method for realizing original handwriting is characterized by comprising the following processing steps of processing the intersection point of two intersected strokes:
determining the pen width: continuously sampling the handwriting, determining adjacent sampling points according to the sampling time sequence, taking the former sampling point as a sampling starting point and the latter sampling point as a sampling end point, detecting the pressure value and the position information of the corresponding sampling point, and determining the actual pen width of each sampling point according to the pressure value of each sampling point;
main line setting: taking a connecting line of the sampling starting point and the sampling end point as a central line of strokes between the two points, acquiring position information of each point on the central line and corresponding longitudinal stroke width, and setting one of two intersected stroke central lines as a main line in the x-axis direction;
judging and processing: calculating filling gray values of corresponding pixel points at the intersection points of the two intersecting strokes according to the position information and the longitudinal stroke width of each point on the central lines of the two intersecting strokes, the slope of the central lines of the two intersecting strokes and the trends of the two intersecting strokes;
displaying: and filling and displaying corresponding pixel points according to the filling gray values.
2. The method of claim 1, wherein the main line setting step comprises: the two intersected strokes are divided into a first stroke and a second stroke according to the time sequence, and the central line of the first stroke is set as a main line in the x-axis direction.
3. The method of claim 2, wherein the determining step comprises: judging whether the absolute value of the slope of the center line of the second stroke is smaller than a preset slope value A, if so, further judging whether the trend of the second stroke is the same as the trend of the first stroke, and if so, calculating the longitudinal stroke width w corresponding to the intersection point of the center lines corresponding to the two intersected strokes in the first stroke and the second strokejAnd wj', and obtaining an absolute value n ═ w of the difference thereofj-wj' |, according to the value of n and wjAnd wjThe size relationship of the' is to perform smooth transition processing on the intersection point of the central lines, and then calculate the filling gray value of the corresponding pixel point at the intersection point of the two intersection strokes.
4. The method of claim 2, wherein the determining step comprises: judging whether the absolute value of the slope of the center line of the second stroke is greater than or equal to a preset slope value A or not, if so, using the two strokes at the intersection point of the two intersecting strokesThe intersection point of the central lines of the intersected strokes is taken as the circle center, and the actual stroke width d corresponding to the intersection point of the central lines is taken as the circle centerjTwo semi-circles are determined for the radius, wherein the starting point and the end point of one semi-circle are both in the longitudinal stroke width w of the first strokejThe starting point and the end point of the other semicircle are both in the longitudinal stroke width w of the second strokej' above, the filling gray values of the pixel points determined by the semi-circles are then calculated respectively.
5. The method of claim 2, wherein the determining step comprises: if the absolute value of the slope of the center line of the second stroke is judged to be smaller than a preset slope value A, but the trend of the second stroke is different from the trend of the first stroke, the slope of the center line of the first stroke and the slope of the center line of the second stroke are further judged, and at the intersection point of the two intersected strokes, the intersection point of the center lines of the two intersected strokes is taken as the center of a circle, and the actual pen width d corresponding to the intersection point of the center lines is taken as the center of a circlejDetermining a semicircle for the radius, wherein the starting point and the end point of the semicircle are both on the longitudinal stroke width of the stroke with the large slope at the intersection point, and then calculating the filling gray value of the pixel point determined by the semicircle.
6. The method of claim 3, wherein w is based on a value of n and the value of njAnd wj' performing a smooth transition process at the intersection, the smooth transition process comprising the following steps:
judging whether the n value is 0, if so, not processing the intersection point, otherwise, rounding the n value, and if 0 < n < 1, taking the n value as 1, and taking the unit step length on the y axis as
Figure FDA0000046424010000021
Using the point corresponding to the intersection point of the central lines on the x axis as a midpoint and using the first point close to one side of the first stroke
Figure FDA0000046424010000022
Or
Figure FDA0000046424010000023
A point as a starting point, with the first stroke adjacent to one side of the second stroke
Figure FDA0000046424010000024
Or
Figure FDA0000046424010000025
Taking the point as a terminal point;
with wjAs an initial value, the stroke width w of the corresponding point on the central line is moved by one unit length from the starting point to the end point on the x-axisr+1The longitudinal stroke width w of the previous pointrRespectively adding or subtracting unit step length on the upper side and the lower side of the central line
7. The method of claim 6, wherein the formula for calculating the filling gray value of the corresponding pixel point at the intersection of the two intersecting strokes is a straight line filling formula: max (0, min (1.0, 0.5 Xw)r-er+0.5)), wherein wrA longitudinal stroke width of a corresponding point r on the center line, erThe distance from the corresponding pixel point to the point r.
8. The method of any of claims 4 or 5, wherein calculating a fill gray value for the pixel points determined by the semi-circle comprises:
judging whether the stroke end with semicircle drawn by corresponding stroke is the left end point or the right end point of the stroke, further judging whether the slope of the center line of the stroke is more than or equal to 0 or less than 0, if the stroke end is the left end point of the stroke and the slope of the center line of the stroke is more than or equal to 0, the intersection point of the semicircle and the center line in the stroke is above the center line of the strokeIn the boundary area with the vertical stroke width, the filling gray value of the pixel points is determined by a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal to
Figure FDA0000046424010000031
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,
Figure FDA0000046424010000032
rounding up, w longitudinal stroke width of the centerline intersection in the stroke, d actual stroke width of the centerline intersection in the stroke, wzThe longitudinal width of the center line corresponding to each point on the extension line of the end, ezThe distance from the corresponding pixel point to the corresponding point on the extension line of the end of the central line; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+0.5)) in which e is presentjThe distance of the corresponding pixel point to the intersection point, djThe actual pen width of the center intersection point is taken as the actual pen width of the center intersection point;
if the stroke end is the left end point of the stroke and the slope of the center line of the stroke is less than 0, in a boundary area of the longitudinal stroke width w below the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with gray values through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the end point, and the length is equal to
Figure FDA0000046424010000033
The line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,
Figure FDA0000046424010000034
rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
9. The method of claim 8, wherein calculating a fill gray value for the pixel points determined by the semicircle further comprises:
if the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, in a boundary area of the longitudinal stroke width w below the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal to
Figure FDA0000046424010000041
The line segment of (a) corresponds to the lower side of the extension line of the central line; wherein,rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5));
if the stroke end is the right end point of the stroke and the slope of the center line of the stroke is greater than or equal to 0, in a boundary area of the longitudinal stroke width w above the center line of the stroke and at the intersection point of the semicircle and the center line, the pixel point of the boundary area is filled with the gray value through a straight line filling formula: max (0, min (1.0, 0.5 Xw)z-ez+0.5)), the boundary area is on the x-axis, the sampling point corresponding to the end point is on the left side of the point corresponding to the x-axis, the point is taken as the starting point, and the length is equal to
Figure FDA0000046424010000043
The line segment of (a) corresponds to the upper side of the extension line of the central line; wherein,
Figure FDA0000046424010000044
rounding upwards; and filling gray values of pixel points in other areas in the pixel points determined by the semi-circle are determined through a semi-circle filling formula: max (0, min (1.0, 0.5 xd)j-ej+ 0.5)).
10. The method of claim 8, wherein when a pixel has a plurality of fill-in gray values, the maximum value of the plurality of fill-in gray values is taken.
11. An electronic device, comprising:
a handwriting screen: the handwriting display is used for providing a writing interface and displaying writing;
a sampling detector: the handwriting input device is used for sampling the touch points of the handwriting to obtain the position information and the actual pen width of the sampling points;
the microprocessor: the microprocessor comprises a handwriting original handwriting realization module, and the handwriting original handwriting realization module realizes the display of the handwriting original handwriting with the stroke through the realization method as claimed in any one of claims 1-10.
CN 201110033959 2011-01-31 2011-01-31 Method for realizing original handwriting Active CN102103762B (en)

Priority Applications (6)

Application Number Priority Date Filing Date Title
CN 201110033959 CN102103762B (en) 2011-01-31 2011-01-31 Method for realizing original handwriting
US13/982,749 US9183428B2 (en) 2011-01-31 2012-01-21 Method and device for implementing original handwriting trace, and electronic device
JP2013550749A JP5706001B2 (en) 2011-01-31 2012-01-21 Method and apparatus for realizing handwritten original handwriting and electronic apparatus
PCT/CN2012/070693 WO2012103794A1 (en) 2011-01-31 2012-01-21 Method and device for implementing original handwriting, and electronic device
KR1020137020108A KR101516339B1 (en) 2011-01-31 2012-01-21 Method and device for implementing original handwriting and electronic device
TW101102811A TW201237775A (en) 2011-01-31 2012-01-30 Method and device for implementing original handwriting, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110033959 CN102103762B (en) 2011-01-31 2011-01-31 Method for realizing original handwriting

Publications (2)

Publication Number Publication Date
CN102103762A true CN102103762A (en) 2011-06-22
CN102103762B CN102103762B (en) 2012-11-28

Family

ID=44156503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110033959 Active CN102103762B (en) 2011-01-31 2011-01-31 Method for realizing original handwriting

Country Status (1)

Country Link
CN (1) CN102103762B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012103794A1 (en) * 2011-01-31 2012-08-09 北京壹人壹本信息科技有限公司 Method and device for implementing original handwriting, and electronic device
CN104346091A (en) * 2013-07-31 2015-02-11 北京壹人壹本信息科技有限公司 Handwriting displaying method and device
CN106527940A (en) * 2016-11-03 2017-03-22 青岛海信电器股份有限公司 Handwriting determination method and apparatus
CN114924658A (en) * 2022-05-31 2022-08-19 青岛海信移动通信技术股份有限公司 Terminal equipment and handwriting generation method
CN117896705A (en) * 2024-03-15 2024-04-16 荣耀终端有限公司 Interaction method, electronic device, and computer-readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5347589A (en) * 1991-10-28 1994-09-13 Meeks Associates, Inc. System and method for displaying handwriting parameters for handwriting verification
JPH0997311A (en) * 1995-10-02 1997-04-08 Matsushita Electric Ind Co Ltd Handwriting pattern recognition device
CN1870052A (en) * 2005-07-08 2006-11-29 天津大学 Three-D Chinese brush model and emulation method based on pressure pen device
CN101373539A (en) * 2008-10-07 2009-02-25 广东威创视讯科技股份有限公司 Method and device for writing Chinese writing brush script

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5347589A (en) * 1991-10-28 1994-09-13 Meeks Associates, Inc. System and method for displaying handwriting parameters for handwriting verification
JPH0997311A (en) * 1995-10-02 1997-04-08 Matsushita Electric Ind Co Ltd Handwriting pattern recognition device
CN1870052A (en) * 2005-07-08 2006-11-29 天津大学 Three-D Chinese brush model and emulation method based on pressure pen device
CN101373539A (en) * 2008-10-07 2009-02-25 广东威创视讯科技股份有限公司 Method and device for writing Chinese writing brush script

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012103794A1 (en) * 2011-01-31 2012-08-09 北京壹人壹本信息科技有限公司 Method and device for implementing original handwriting, and electronic device
US9183428B2 (en) 2011-01-31 2015-11-10 Beijing Ereneben Information Technology Co., Ltd. Method and device for implementing original handwriting trace, and electronic device
CN104346091A (en) * 2013-07-31 2015-02-11 北京壹人壹本信息科技有限公司 Handwriting displaying method and device
CN106527940A (en) * 2016-11-03 2017-03-22 青岛海信电器股份有限公司 Handwriting determination method and apparatus
CN106527940B (en) * 2016-11-03 2019-12-10 青岛海信电器股份有限公司 Handwriting determining method and device
CN114924658A (en) * 2022-05-31 2022-08-19 青岛海信移动通信技术股份有限公司 Terminal equipment and handwriting generation method
CN117896705A (en) * 2024-03-15 2024-04-16 荣耀终端有限公司 Interaction method, electronic device, and computer-readable storage medium
CN117896705B (en) * 2024-03-15 2024-07-09 荣耀终端有限公司 Interaction method, electronic device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN102103762B (en) 2012-11-28

Similar Documents

Publication Publication Date Title
CN102103761B (en) Method for realizing original handwriting
US9134821B2 (en) Method and device for implemeting original calligraphy of handwriting
JP5706001B2 (en) Method and apparatus for realizing handwritten original handwriting and electronic apparatus
CN110531875B (en) Writing stroke generation method, terminal equipment and storage medium
KR102412021B1 (en) Wet ink predictor
CN102103762B (en) Method for realizing original handwriting
TWI497402B (en) Apparatus and method for processing handwriting input
KR20130060145A (en) Processoing method and apparatus for beautifying handwritten input
US20150035778A1 (en) Display control device, display control method, and computer program product
CN102902407B (en) A kind of touch-screen output display touches the method and apparatus of person&#39;s handwriting
US9280524B2 (en) Combining a handwritten marking with a rendered symbol to modify the rendered symbol
KR20130066511A (en) Method and apparatus for calligraphic beautification of handwritten characters
CN105224222A (en) A kind of method for deleting, erasing apparatus and electronic equipment
CN103218167B (en) A kind of car-mounted terminal single-point touch gesture pattern recognition
TWI511030B (en) Method for user interface display and electronic device using the same
CN106201314A (en) A kind of display packing realizing handwriting input on touch screen and display device
CN106951166B (en) Person&#39;s handwriting method for drafting and device
Posner et al. A single camera based floating virtual keyboard with improved touch detection
CN106610748B (en) Information input method and device of touch screen
CN112183318A (en) Writing method and device, storage medium and electronic whiteboard
CN111665931A (en) Gesture recognition method and gesture recognition device
US11676313B2 (en) Generating vector graphics by processing raster graphics
TWI502521B (en) Stroke display method
CN117252952A (en) Writing front drawing method and device, electronic equipment and storage medium
US20180225848A1 (en) Reshaping objects on a canvas in a user interface

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: BEIJING ERENEBEN INFORMATION TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: ZHOU JIA

Effective date: 20120928

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 518001 SHENZHEN, GUANGDONG PROVINCE TO: 100022 TONGZHOU, BEIJING

TA01 Transfer of patent application right

Effective date of registration: 20120928

Address after: 100022 Beijing Tongzhou District Yongle Economic Development Zone A Sunny Street No. 1271

Applicant after: Beijing Eren Eben Information Technology Co., Ltd.

Address before: 15, building 518001, block A, hung long century center, 3001 Heping Road, Shenzhen, Guangdong, Luohu District

Applicant before: Zhou Jia

C14 Grant of patent or utility model
GR01 Patent grant