Touch pen pressure adaptive adjustment method and system
By combining cluster analysis with LSTM networks, the pressure range and global parameters of touch handwriting are dynamically adjusted, which solves the problem of single handwriting effect in existing technologies, realizes the naturalness and personalized expression of touch handwriting, and improves the user experience.
Patent Information
- Application Number
- CN202510907616.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-07-02
AI Technical Summary
Existing touch pen pressure adaptive adjustment technology lacks adaptability and flexibility to the writing habits of different users, resulting in a single handwriting effect that lacks realism and personalization.
A method combining cluster analysis and LSTM network is adopted. By performing cluster analysis on the initial touch feature set, a linear mapping relationship between pressure value and handwriting attributes is generated. The LSTM network is used to predict future pressure characteristics and trend labels, and the pressure range and global parameters are dynamically adjusted to generate a new linear mapping relationship for real-time adjustment of handwriting attributes.
It improves the naturalness and personalized expression of touch handwriting, enhances the interactive experience of touch devices, and realizes the accurate capture and dynamic analysis of user touch characteristics.
Smart Images

Figure CN120406774B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of touch technology, and in particular to a method and system for adaptively adjusting the pressure sensitivity of touch handwriting. Background Art
[0002] With the rapid development of information technology, touchscreen devices have become an indispensable part of people's daily lives. This is particularly true in areas such as mobile office, artistic creation, and online education, where precise touchscreen handwriting and a natural interactive experience are key concerns. Traditional touchscreen handwriting technology often uses fixed parameter settings and cannot adapt to users' actual writing habits and changes in force. This results in a monotonous handwriting effect that lacks realism and personalization.
[0003] To enhance the naturalness and user experience of touch writing, we began exploring adaptive pressure sensitivity technology for touch writing. This technology collects user touch characteristics in real time and uses advanced algorithms to analyze and process these characteristics, dynamically adjusting handwriting attributes such as line thickness and color depth, achieving real-time response to user writing behavior and personalized expression.
[0004] However, existing touch pen pressure adaptive adjustment technologies only adjust pressure based on simple rules or threshold judgments, and lack adaptability and flexibility to different users' writing habits.
[0005] Therefore, it is necessary to provide a touch pen pressure adaptive adjustment method and system to solve the above technical problems. Summary of the Invention
[0006] To solve the above technical problems, the present invention provides a method and system for adaptively adjusting the pressure sensitivity of touch handwriting, which not only improves the naturalness and personalized expression of touch handwriting, but also enhances the interactive experience of touch devices.
[0007] The present invention provides a method for adaptively adjusting the pressure sensitivity of a touch pen, the method comprising the following steps:
[0008] Based on the collected initial touch feature set, cluster analysis is performed on the pressure values to generate a linear mapping relationship between the pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters;
[0009] Based on the real-time touch feature set, the LSTM network is used to predict the pressure features and pressure trend labels within the next predetermined time.
[0010] Dynamically adjusting the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval;
[0011] Dynamically compensating the initial global parameters according to the pressure characteristics to obtain real-time global parameters;
[0012] A new linear mapping relationship is generated by combining the real-time pressure interval and the real-time global parameter, and the handwriting attributes are adjusted in real time based on the new linear mapping relationship.
[0013] Preferably, the cluster analysis of the pressure values based on the collected initial touch feature set to generate a linear mapping relationship between the pressure values and the handwriting attributes includes:
[0014] Performing cluster analysis on the pressure values in the initial touch feature set using a K-means clustering algorithm to generate K pressure cluster centers, where the K value is determined by the elbow rule;
[0015] Calculate the pressure boundary values between the centers of adjacent pressure clusters, merge adjacent clusters that meet the preset conditions based on a preset minimum interval width threshold, and generate multiple initial pressure intervals;
[0016] For each initial pressure interval, pressure and attribute mapping samples are extracted from the preset universal handwriting attribute template library, and the weighted least squares method is used to fit the initial global parameters.
[0017] Preferably, the method of predicting pressure features and pressure trend labels within a predetermined future time based on a real-time touch feature set using an LSTM network includes:
[0018] Obtain a real-time touch feature set within a preset time window, including the coordinate sequence of the current touch point, touch speed, and pressure change rate;
[0019] Inputting the real-time touch feature set into a pre-trained LSTM network to output pressure features within a predetermined future time, wherein the pressure features include a touch speed prediction value and a pressure change rate prediction value corresponding to a preset period within the predetermined future time;
[0020] The pressure trend label is determined based on the hidden state of the LSTM network.
[0021] Preferably, determining the pressure trend label according to the hidden state of the LSTM network includes:
[0022] Extracting preliminary pressure trend features based on the hidden state of the LSTM network, wherein the preliminary pressure trend features include the average of the pressure change rate and the average of the touch speed within a predetermined future time;
[0023] According to the preliminary pressure trend characteristics, a preset pressure trend mapping table is queried to output a pressure trend label, wherein the preset pressure trend mapping table represents the following rules:
[0024] High pressure continuous label: when the average value of the pressure change rate is greater than the preset first threshold, and the average touch speed is less than the preset speed threshold;
[0025] Fluctuation label: when the absolute value of the pressure change rate is greater than the preset second threshold, the average touch speed is greater than or equal to the preset speed threshold, and the preset first threshold is greater than the preset second threshold;
[0026] Stable label: When the above conditions are not met, the pressure trend is determined to be stable.
[0027] Preferably, dynamically adjusting the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval includes:
[0028] If the pressure trend label is continuous high pressure, the target interval with the largest pressure value in the initial pressure interval is split;
[0029] Dividing the target interval into at least two subintervals, wherein the width of each subinterval does not exceed a preset ratio threshold of the width of the original interval;
[0030] Raise the initial global parameter slope of the subinterval to a preset proportional threshold of the original slope;
[0031] If the pressure trend label is fluctuation, a transition zone is added between adjacent initial pressure intervals, and the width of the transition zone is a preset overlap ratio of the widths of adjacent intervals;
[0032] The slope of the mapping parameter in the transition zone is the weighted average of the slopes of adjacent intervals;
[0033] If the pressure trend label is stable, the current initial pressure interval division remains unchanged.
[0034] Preferably, dynamically compensating the initial global parameters according to the pressure characteristics to obtain real-time global parameters includes:
[0035] The dynamic compensation coefficient is calculated based on the average of the pressure change rate and the average of the touch speed, wherein the calculation formula of the dynamic compensation coefficient is:
[0036]
[0037] in, represents the mean touch speed, Indicates the absolute value of the mean pressure change rate, and is the weight coefficient, represents the dynamic compensation coefficient;
[0038] The slope of the initial global parameter is dynamically compensated, wherein the formula of the dynamic compensation is:
[0039] ;
[0040] in, is the slope after dynamic compensation;
[0041] The initial intercept of the initial global parameters is kept unchanged to generate the real-time global parameters.
[0042] Preferably, the determination of the weight coefficient includes:
[0043] Calculate the operating characteristic ratio, which is defined as the ratio of the absolute value of the mean touch velocity to the mean pressure change rate;
[0044] The preset initial weight coefficient is adjusted according to the operating characteristic ratio using the following formula, wherein the adjustment formula of the preset initial weight coefficient is:
[0045]
[0046]
[0047] in, and is the preset adjustment factor, is the reference value of the operating characteristic ratio, and are the initial weight coefficients of touch speed and pressure change rate, is the operating characteristic ratio, and are the adjusted weight coefficients respectively.
[0048] Preferably, generating a new linear mapping relationship by combining the real-time pressure interval and the real-time global parameter, and adjusting the handwriting attributes in real time based on the new linear mapping relationship, includes:
[0049] Bind the slope and intercept in the real-time global parameters to all real-time pressure intervals to generate a global piecewise linear mapping function;
[0050] According to the interval to which the real-time pressure value belongs, calling the global piecewise linear mapping function to calculate the handwriting attribute value;
[0051] The handwriting attribute value is rendered into a visual handwriting in real time by a rendering engine of the touch device.
[0052] The present invention also provides a touch-sensitive handwriting pressure-sensitivity adaptive adjustment system for executing the touch-sensitive handwriting pressure-sensitivity adaptive adjustment method. The system comprises:
[0053] A cluster analysis module, configured to perform cluster analysis on the pressure values based on the collected initial touch feature set to generate a linear mapping relationship between the pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters;
[0054] The prediction module is used to predict the pressure characteristics and pressure trend labels within a predetermined time in the future based on the real-time touch feature set using the LSTM network;
[0055] An interval dynamic adjustment module, configured to dynamically adjust the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval;
[0056] A parameter dynamic compensation module, configured to dynamically compensate the initial global parameters according to the pressure characteristics to obtain real-time global parameters;
[0057] The real-time adjustment module is used to generate a new linear mapping relationship based on the real-time pressure interval and the real-time global parameter, and perform real-time adjustment of the handwriting attributes based on the new linear mapping relationship.
[0058] Compared with related technologies, the method and system for adaptively adjusting the pressure sensitivity of touch handwriting provided by the present invention have the following beneficial effects:
[0059] The present invention combines cluster analysis and long short-term memory (LSTM) networks, which can accurately capture and dynamically analyze user touch features, and then dynamically adjust the pressure interval and global parameters according to the pressure trend label, generate a new linear mapping relationship, and perform real-time adjustment of handwriting attributes based on this mapping relationship. This method not only improves the naturalness and personalized expression of touch handwriting, but also enhances the interactive experience of touch devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flowchart of a method for adaptively adjusting the pressure sensitivity of a touch screen handwriting provided by the present invention;
[0061] Figure 2 This is a module structure diagram of a touch-sensitive handwriting pressure-sensing adaptive adjustment system provided by the present invention. DETAILED DESCRIPTION
[0062] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all of the structures. Furthermore, the embodiments of the present invention and the features of the embodiments may be combined with one another unless there is a conflict.
[0063] It should also be noted that, for ease of description, only portions relevant to the present invention are shown in the accompanying drawings, rather than all of the contents. Before discussing the exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the various operations (or steps) as sequential processes, many of the operations can be performed in parallel, concurrently, or simultaneously. In addition, the order of the various operations can be rearranged. The process can be terminated when its operations are completed, but may also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0064] Example 1
[0065] The present invention provides a touch pen pressure adaptive adjustment method, referring to Figure 1 As shown, the method includes the following steps:
[0066] S1: Based on the collected initial touch feature set, cluster analysis is performed on the pressure values to generate a linear mapping relationship between the pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters.
[0067] Specifically, the process of step S1 includes the following steps:
[0068] S11: performing cluster analysis on the pressure values in the initial touch feature set using a K-means clustering algorithm to generate K pressure cluster centers, where the K value is determined by the elbow rule.
[0069] In this embodiment, during the initial touch feature set acquisition phase, the touch device records the pressure values applied by the user within a preset time period (e.g., the first 50 touch operations), and removes outliers (e.g., noise data where the pressure drops to zero instantaneously). The pressure values are normalized and mapped to a uniform dimension to eliminate device differences. Subsequently, the K-means clustering algorithm is used to perform unsupervised classification of the pressure values. Specifically,
[0070] Determine the number of clusters K: Calculate the intra-cluster sum of squared errors (SSE) for different K values (ranging from 3 to 8) using the elbow rule, plot the SSE-K curve, and select the K value at the inflection point (for example, when K = 5, the rate of decrease of SSE slows down significantly, so K = 5 is selected).
[0071] Iterative optimization of cluster centers: Starting from the randomly initialized cluster centers, the similarity of pressure values is measured by Euclidean distance, and the cluster centers are iteratively updated until convergence (the maximum number of iterations is set to 200, and the tolerance threshold is 0.001).
[0072] Output pressure cluster centers: Finally, K pressure cluster centers are generated (for example, C1=200 units, C2=450 units, C3=700 units, C4=850 units, C5=950 units). Each cluster center represents a typical intensity range of the user's pressure operation.
[0073] S12: Calculate the pressure boundary values between the centers of adjacent pressure clusters, merge adjacent clusters that meet preset conditions based on a preset minimum interval width threshold, and generate multiple initial pressure intervals.
[0074] In this embodiment, the midpoints of adjacent cluster centers are first used as interval boundaries. For example, the midpoint 900 units between cluster centers C4 = 850 units and C5 = 950 units is used as the dividing point between the two, forming initial intervals [850, 900) and [900, 950).
[0075] Next, if the width of the interval after merging adjacent clusters is less than a preset threshold (e.g., 100 units), they are merged into a single interval. For example, the boundary between cluster centers C1 = 200 units and C2 = 450 units is 325 units, and the initial intervals are [200, 325) and [325, 450]. If the merging threshold is set to 150 units, then since 325 - 200 = 125 units > 150 units, the merging condition is not met, and the original interval division is maintained. However, the boundary between cluster centers C3 = 700 units and C4 = 850 units is 775 units, and the interval width is 75 units (850 - 775 = 75 units), which is less than the merging threshold, so they are merged into a single interval [700, 850).
[0076] After merging, the final initial pressure interval set is generated (for example, [200, 325), [325, 450), [450, 700), [700, 950)).
[0077] S13: For each initial pressure interval, extract pressure and attribute mapping samples from a preset universal handwriting attribute template library, and use weighted least squares method to fit the initial global parameters.
[0078] In this embodiment, to establish a linear relationship between pressure value and handwriting attributes (line thickness, transparency), the following operations are performed:
[0079] Sample extraction and weight assignment: Based on the initial pressure interval division, historical data samples of the corresponding interval are matched from the universal handwriting attribute template library (for example, the interval [200, 325] corresponds to the sample set {(220, 0.3), (300, 0.45), …}), and higher weights are assigned to samples in the high-pressure interval (for example, the sample weight of the interval [700, 950) is 1.5, and the samples of other intervals are 1.0).
[0080] Parameter fitting: using weighted least squares method to fit linear equations ,in is the handwriting attribute value, and P is the pressure value. For example, for the interval [200, 325), by minimizing the weighted residual sum of squares , solve for the optimal slope = 0.002 and the intercept =0.1.
[0081] Global parameter integration: The fitting parameters of all intervals are integrated into global parameters, which are applicable to all pressure intervals and serve as the benchmark values for subsequent dynamic compensation.
[0082] S2: Based on the real-time touch feature set, the LSTM network is used to predict the pressure features and pressure trend labels within the future predetermined time.
[0083] Specifically, the process of step S2 includes the following steps:
[0084] S21: Acquire a real-time touch feature set within a preset time window, including a coordinate sequence of a current touch point, touch speed, and pressure change rate.
[0085] In step S21, the real-time touch feature set is collected by the touch device at a sampling rate of 100 Hz, recording the coordinate sequence of the current touch point, the pressure value and its corresponding timestamp, and setting the sliding time window length to 20 sampling points (corresponding to 200ms), covering the time from the current moment The continuous data of 19 points is traced back. The touch speed is calculated based on the coordinate difference of adjacent sampling points. The pressure change rate is obtained by the difference of adjacent pressure values. All feature data are normalized.
[0086] S22: Input the real-time touch feature set into a pre-trained LSTM network, and output pressure features within a predetermined future time, wherein the pressure features include a touch speed prediction value and a pressure change rate prediction value corresponding to a preset period within the predetermined future time.
[0087] In this embodiment, step S22 uses a pre-trained two-layer LSTM network for prediction. The network structure consists of an input layer (accepting a 20×5 matrix), two 64-unit LSTM hidden layers (tanh activation function), and a fully connected output layer. It outputs predicted values for touch velocity and pressure change rate for five time points (50ms) in the future. The model is trained using a historical dataset containing 10,000 time series, split into training and validation sets in an 80:20 ratio. The loss function is mean squared error (MSE). The optimizer uses Adam (learning rate 0.001), a batch size of 32, and 100 epochs with early stopping (termination is terminated if the validation loss does not decrease for five consecutive epochs). During prediction, the real-time feature matrix is input to the network, and the pressure features for the next 50ms are output.
[0088] S23: Determine the pressure trend label based on the hidden state of the LSTM network.
[0089] In step S23, the system extracts pressure trend features by analyzing the hidden state of the LSTM network. The specific process is as follows:
[0090] First, the hidden state of the last time step of the second LSTM layer is analyzed to identify the underlying patterns of pressure changes during the prediction period, including predicted touch speed values and pressure change rate values at multiple future time points. The average of the predicted touch speed values during the prediction period is calculated as the mean touch speed value. The absolute values of the predicted pressure change rate values are also calculated and their average is taken as the mean pressure change rate value. The system then compares these two means according to pre-set judgment rules:
[0091] If the average pressure change rate exceeds a preset first threshold and the average touch speed is lower than a preset speed threshold, it is determined to be a high-pressure continuous label;
[0092] If the average pressure change rate exceeds the preset second threshold and the average touch speed reaches or exceeds the preset speed threshold, it is determined to be a fluctuation tag;
[0093] The rest of the cases are classified as stationary labels.
[0094] To ensure logical consistency, the preset thresholds must satisfy the constraint that the first threshold is greater than the second threshold. For example:
[0095] When the average touch speed exceeds a preset speed threshold and the average pressure change rate exceeds a second threshold, the label is fluctuation;
[0096] If the average pressure change rate exceeds the first threshold but the average touch speed is lower than the speed threshold, it is preferentially determined as continuous high pressure;
[0097] If the mean value of the pressure change rate does not reach any threshold value, or the mean value of the speed does not meet the corresponding conditions, it is determined to be stable.
[0098] The final generated labels will directly guide the dynamic adjustment strategy of the subsequent pressure range, ensuring the generalization ability of the technical solution in different equipment and user operation scenarios.
[0099] S3: Dynamically adjust the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval.
[0100] Specifically, the process of step S3 includes the following steps:
[0101] S31: If the pressure trend label is high pressure persistence, the target interval with the largest pressure value in the initial pressure interval is split:
[0102] Dividing the target interval into at least two subintervals, wherein the width of each subinterval does not exceed a preset ratio threshold of the width of the original interval;
[0103] The initial global parameter slope of the subinterval is increased to a preset proportional threshold of the original slope.
[0104] In this embodiment, when the pressure trend label is high pressure sustained, the target interval with the highest pressure value in the initial pressure interval is dynamically split. First, the original width of the target interval is determined (for example, the width of the interval [700, 950) is 250 units), and the maximum width of the subinterval is limited based on a preset split ratio threshold (for example, 50%). If the original width is 250 units, the width of each subinterval must not exceed 125 units (250×50%). The target interval is split into two subintervals using a uniform division strategy (for example, [700, 825) and [825, 950). Subsequently, the global parameter slope of the subinterval is adjusted: the initial slope of each subinterval is increased to a preset ratio of the original slope (for example, 1.3 times). For example, if the original slope is 0.002, the adjusted subinterval slope is 0.002×1.3=0.0026. This adjustment makes the handwriting attribute response of the high pressure interval more sensitive, adapting to the user's intention to apply continuous pressure.
[0105] S32: If the pressure trend label is fluctuation, a transition zone is added between adjacent initial pressure intervals, and the width of the transition zone is a preset overlap ratio of the widths of adjacent intervals;
[0106] The slope of the mapping parameter in the transition zone is the weighted average of the slopes of adjacent intervals.
[0107] In this embodiment, if the pressure trend label is fluctuating, a transition zone is added between adjacent initial pressure intervals to suppress handwriting jitter. The width of the transition zone is determined by the ratio of the widths of adjacent intervals, with a preset overlap ratio of 20%. For example, if the widths of adjacent intervals [450, 700) and [700, 950) are 250 units and 250 units, respectively, then the transition zone width is 250 × 20% = 50 units, forming a transition zone [675, 725]. The mapping parameter slope of the transition zone is calculated as the weighted average of the slopes of adjacent intervals, with the weight determined by the ratio of the interval widths. For example, the slope of the interval [450, 700) is 0.002, and the slope of the interval [700, 950) is 0.0026. The slope of the transition zone is calculated as (0.002 × 50% + 0.0026 × 50%) = 0.0023. The setting of the transition zone smooths out sudden changes in handwriting attributes at interval boundaries, improving the user experience.
[0108] S33: If the pressure trend label is stable, the current initial pressure interval division is kept unchanged.
[0109] In this embodiment, when the pressure trend label is stable, the system maintains the current initial pressure range divisions and does not perform any parameter adjustments. At this point, all pressure ranges continue to use the initial global parameters (slope and intercept), ensuring that the handwriting attribute response is consistent with user habits. The mapping relationship is only called based on the range to which the real-time pressure value belongs, avoiding unnecessary computational overhead.
[0110] S4: Dynamically compensate the initial global parameters according to the pressure characteristics to obtain real-time global parameters.
[0111] Specifically, the process of step S4 includes the following steps:
[0112] First, determine the weight coefficient, which specifically includes the following steps:
[0113] Step a: Calculate the operation characteristic ratio, which is defined as the ratio of the average touch velocity to the absolute value of the average pressure change rate.
[0114] In this embodiment, an operational characteristic ratio is calculated. This ratio is defined as the ratio of the average touch velocity to the absolute value of the average pressure change rate. The touch velocity values for multiple future time points (e.g., five time points within the next 50ms) are predicted using an LSTM network. These predicted values are then arithmetic averaged to obtain the average touch velocity value. The absolute values of the pressure change rates predicted by the LSTM network for multiple future time points are then taken and the average is calculated.
[0115] Step b: adjusting the preset initial weight coefficient according to the operating characteristic ratio using the following formula, wherein the adjustment formula of the preset initial weight coefficient is:
[0116]
[0117]
[0118] in, and is the preset adjustment factor, which controls the amplitude of weight adjustment (preset value). is the reference value of the operating characteristic ratio, and are the initial weight coefficients of touch speed and pressure change rate, is the operating characteristic ratio, which quantifies the relative strength of velocity and pressure changes, and are the adjusted weight coefficients respectively.
[0119] In the above formula, the weight adjustment for touch speed is: initial weight coefficient On this basis, linear adjustment is performed based on the difference between the operating characteristic ratio and the preset reference value.
[0120] when Greater than : Touch speed weight Increase, pressure change weight reduce.
[0121] when Less than : Touch speed weight Reduce, pressure change weight Increase.
[0122] Next, a dynamic compensation coefficient is calculated based on the average of the pressure change rate and the average of the touch speed, wherein the calculation formula of the dynamic compensation coefficient is:
[0123]
[0124] in, represents the mean touch speed, Indicates the absolute value of the mean pressure change rate, and is the weight coefficient, Indicates the dynamic compensation coefficient, which reflects the influence of the user's current operation mode on the handwriting attributes.
[0125] The average touch speed and the average pressure change rate are combined with the adjusted weight coefficient and , generate dynamic compensation coefficients.
[0126] The slope of the initial global parameter is dynamically compensated, wherein the formula of the dynamic compensation is:
[0127] ;
[0128] in, is the slope after dynamic compensation, is the slope of the initial global parameter;
[0129] The initial intercept of the initial global parameters is kept unchanged to generate the real-time global parameters.
[0130] According to the dynamic compensation coefficient, the slope of the initial global parameter is proportionally enlarged or reduced, thereby adjusting the sensitivity of the handwriting attribute to the pressure value.
[0131] S5: generating a new linear mapping relationship by combining the real-time pressure interval and the real-time global parameter, and adjusting the handwriting attributes in real time based on the new linear mapping relationship.
[0132] Specifically, the process of step S5 includes the following steps:
[0133] S51: Bind the slope and intercept in the real-time global parameters to all real-time pressure intervals to generate a global piecewise linear mapping function.
[0134] In this embodiment, the slope and intercept in the real-time global parameters are bound to all real-time pressure intervals to construct a global piecewise linear mapping function. Each real-time pressure interval corresponds to a linear equation in the form of , where P is the current pressure value, is the handwriting attribute value (line thickness, transparency). For example, the real-time pressure range is [200, 325), [325, 450), [450, 700), [700, 950), and the slope after dynamic compensation is 0.0026 and the intercept is 0.1. Then the mapping function is:
[0135] .
[0136] If there is a transition zone (such as [675, 725)), its slope is calculated by the weighted average of the slopes of adjacent intervals. For example, if the slope of the transition zone is 0.0023, the corresponding interval in the mapping function is adjusted to:
[0137] .
[0138] S52: According to the interval to which the real-time pressure value belongs, calling the global piecewise linear mapping function to calculate the handwriting attribute value.
[0139] In this embodiment, the specific process is as follows:
[0140] Interval matching: traverse the real-time pressure interval list and determine the interval to which the current pressure value P belongs (for example, P=800 belongs to [700, 950)).
[0141] Equation call: Select the mapping equation corresponding to the interval .
[0142] Numerical calculation: Substitute the pressure value to calculate the handwriting properties.
[0143] Then, the Q value is converted into specific line thickness and transparency parameters through a preset handwriting attribute mapping table, wherein the preset handwriting attribute mapping table defines the mapping relationship between the Q value and the handwriting attributes (line thickness, transparency) to facilitate the extraction of the line thickness and transparency values of the corresponding interval.
[0144] S53: Rendering the handwriting attribute value into a visual handwriting in real time through a rendering engine of the touch device.
[0145] In this embodiment, the calculated handwriting attribute values (line thickness, transparency) are converted into rendering parameters. Based on the current touch point coordinates and the historical coordinate sequence, a smooth handwriting path is generated using Bézier curve interpolation. The width and transparency of the path are adjusted according to the attribute values. The device GPU is then used to accelerate rendering, ensuring a frame rate of at least 60 FPS. For example, the handwriting path is updated every 10ms, and double buffering is used to eliminate screen tearing. During touch operations, the handwriting effect is updated instantly as the pressure value changes.
[0146] Example 2
[0147] The present invention also provides a touch pen pressure adaptive adjustment system for executing the touch pen pressure adaptive adjustment method, referring to Figure 2 As shown, the system includes:
[0148] A cluster analysis module 100 is configured to perform cluster analysis on pressure values based on the collected initial touch feature set to generate a linear mapping relationship between pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters;
[0149] Prediction module 200, for predicting pressure features and pressure trend labels within a predetermined time in the future using an LSTM network based on a real-time touch feature set;
[0150] An interval dynamic adjustment module 300 is configured to dynamically adjust the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval;
[0151] A parameter dynamic compensation module 400 is configured to dynamically compensate the initial global parameters according to the pressure characteristics to obtain real-time global parameters;
[0152] The real-time adjustment module 500 is used to generate a new linear mapping relationship based on the real-time pressure interval and the real-time global parameter, and perform real-time adjustment of the handwriting attributes based on the new linear mapping relationship.
[0153] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0154] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM), or other optical disc storage, magnetic disk storage, or magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.
[0155] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
Claims
1. A method for adaptively adjusting the pressure sensitivity of a touch screen handwriting, characterized in that: The method comprises the following steps: Based on the collected initial touch feature set, cluster analysis is performed on the pressure values to generate a linear mapping relationship between the pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters; Based on the real-time touch feature set, the LSTM network is used to predict the pressure features and pressure trend labels within the next predetermined time. This step specifically includes: Get the real-time touch feature set within the preset time window, including the coordinate sequence of the current touch point, touch speed and pressure change rate, Input the real-time touch feature set into a pre-trained LSTM network and output pressure features within a predetermined time in the future, wherein the pressure features include a touch speed prediction value and a pressure change rate prediction value corresponding to a preset period within the predetermined time in the future, Determine the pressure trend label based on the hidden state of the LSTM network; Dynamically adjusting the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval; Dynamically compensating the initial global parameters according to the pressure characteristics to obtain real-time global parameters, specifically includes: The dynamic compensation coefficient is calculated based on the average value of the pressure change rate and the average value of the touch speed, wherein the calculation formula of the dynamic compensation coefficient is: in, represents the mean touch speed, Indicates the absolute value of the mean pressure change rate, and is the weight coefficient, represents the dynamic compensation coefficient, The slope of the initial global parameter is dynamically compensated, wherein the formula of the dynamic compensation is: ; in, is the slope after dynamic compensation, is the slope of the initial global parameter, Keep the initial intercept of the initial global parameters unchanged and generate real-time global parameters; Generating a new linear mapping relationship by combining the real-time pressure interval and the real-time global parameter, and adjusting the handwriting attributes in real time based on the new linear mapping relationship, this step specifically includes: Bind the slope and intercept in the real-time global parameters to all real-time pressure intervals to generate a global piecewise linear mapping function. According to the interval to which the real-time pressure value belongs, the global piecewise linear mapping function is called to calculate the handwriting attribute value. The handwriting attribute value is rendered into a visual handwriting in real time by a rendering engine of the touch device.
2. The method for adaptively adjusting the pressure sensitivity of a touch screen handwriting according to claim 1, characterized in that: The cluster analysis of the pressure values based on the collected initial touch feature set to generate a linear mapping relationship between the pressure values and the handwriting attributes includes: Performing cluster analysis on the pressure values in the initial touch feature set using a K-means clustering algorithm to generate K pressure cluster centers, where the K value is determined by the elbow rule; Calculate the pressure boundary values between the centers of adjacent pressure clusters, merge adjacent clusters that meet the preset conditions based on a preset minimum interval width threshold, and generate multiple initial pressure intervals; For each initial pressure interval, pressure and attribute mapping samples are extracted from the preset universal handwriting attribute template library, and the weighted least squares method is used to fit the initial global parameters.
3. The method for adaptively adjusting the pressure sensitivity of a touch screen handwriting according to claim 2, wherein: Determining the pressure trend label according to the hidden state of the LSTM network includes: Extracting preliminary pressure trend features based on the hidden state of the LSTM network, wherein the preliminary pressure trend features include the average of the pressure change rate and the average of the touch speed within a predetermined future time; According to the preliminary pressure trend characteristics, a preset pressure trend mapping table is queried to output a pressure trend label, wherein the preset pressure trend mapping table represents the following rules: High pressure continuous label: when the average value of the pressure change rate is greater than the preset first threshold, and the average touch speed is less than the preset speed threshold; Fluctuation label: when the absolute value of the pressure change rate is greater than the preset second threshold, the average touch speed is greater than or equal to the preset speed threshold, and the preset first threshold is greater than the preset second threshold; Stable label: When the above conditions are not met, the pressure trend is determined to be stable.
4. The method for adaptively adjusting the pressure sensitivity of a touch screen handwriting according to claim 3, characterized in that: The dynamically adjusting the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval includes: If the pressure trend label is continuous high pressure, the target interval with the largest pressure value in the initial pressure interval is split; Dividing the target interval into at least two subintervals, wherein the width of each subinterval does not exceed a preset ratio threshold of the width of the original interval; Raise the initial global parameter slope of the subinterval to a preset proportional threshold of the original slope; If the pressure trend label is fluctuation, a transition zone is added between adjacent initial pressure intervals, and the width of the transition zone is a preset overlap ratio of the widths of adjacent intervals; The slope of the mapping parameter in the transition zone is the weighted average of the slopes of adjacent intervals; If the pressure trend label is stable, the current initial pressure interval division remains unchanged.
5. The method for adaptively adjusting the pressure sensitivity of a touch screen handwriting according to claim 4, characterized in that: Determining the weight coefficient includes: Calculate the operating characteristic ratio, which is defined as the ratio of the absolute value of the mean touch velocity to the mean pressure change rate; The preset initial weight coefficient is adjusted according to the operating characteristic ratio using the following formula, wherein the adjustment formula of the preset initial weight coefficient is: in, and is the preset adjustment factor, is the reference value of the operating characteristic ratio, and are the initial weight coefficients of touch speed and pressure change rate, is the operating characteristic ratio, and are the adjusted weight coefficients respectively.
6. A touch screen handwriting pressure sensitivity adaptive adjustment system, used to execute the touch screen handwriting pressure sensitivity adaptive adjustment method according to any one of claims 1 to 5, characterized in that: The system comprises: A cluster analysis module, configured to perform cluster analysis on the pressure values based on the collected initial touch feature set to generate a linear mapping relationship between the pressure values and handwriting attributes, wherein the linear mapping relationship includes multiple initial pressure intervals and initial global parameters; The prediction module is used to predict the pressure characteristics and pressure trend labels within a predetermined time in the future based on the real-time touch feature set using the LSTM network; An interval dynamic adjustment module, configured to dynamically adjust the multiple initial pressure intervals based on the pressure trend tag to obtain a real-time pressure interval; A parameter dynamic compensation module, configured to dynamically compensate the initial global parameters according to the pressure characteristics to obtain real-time global parameters; The real-time adjustment module is used to generate a new linear mapping relationship based on the real-time pressure interval and the real-time global parameter, and perform real-time adjustment of the handwriting attributes based on the new linear mapping relationship.
Citation Information
Patent Citations
Handwriting display method and device, electronic equipment and storage medium
CN114253435A
Multi-point pressure safety detection method and device and Internet of Things system
CN118760940A