Touch screen position smoothing filter method and system
By using the centroid algorithm and distance threshold judgment to dynamically select the smoothing filtering method, the problems of large computational load and poor smoothing effect are solved, and efficient touch screen positioning smoothing filtering is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- RET EQUIP INC
- Filing Date
- 2022-12-15
- Publication Date
- 2026-07-10
AI Technical Summary
Existing technologies, while improving the positioning accuracy of touch screens, involve a large amount of computation and have poor smoothing filtering effects.
The centroid algorithm is used to calculate the predicted coordinates of the touch point. The target distance is determined by setting the maximum and minimum distance thresholds. An appropriate smoothing filter is selected, and the predicted coordinates of the touch point are dynamically stored in a queue for mean calculation to reduce the amount of computation.
While reducing the amount of computation, it improves the smoothing filtering effect, eliminates the jagged error of finger-drawn lines, and the smoothing filtering result closely matches the actual line shape.
Smart Images

Figure CN115993915B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of touch screen testing technology, and specifically to a touch screen positioning smoothing filtering method and system. Background Technology
[0002] Touchscreens are widely used in electronic devices across various fields due to their ease of use, durability, fast response, and space-saving features. The use of touchscreens greatly simplifies the operation of electronic devices, allowing even those who know nothing about them to operate them, thus solving problems that electronic devices in the public information market cannot address.
[0003] Currently, touchscreens are mainly divided into three categories: resistive touchscreens, surface acoustic wave (SAW) touchscreens, and capacitive touchscreens. Each type of touchscreen has its own advantages and disadvantages. The main component of a resistive touchscreen is a resistive film screen that closely matches the display surface. A resistive film screen is a multi-layered composite film. It uses a glass or hard plastic plate as a base layer, coated with a transparent metal oxide (ITO, indium oxide, a transparent conductive resistor) conductive layer. On top of this is a hardened, smooth, and scratch-resistant plastic layer. The inner surface of the plastic layer is also coated with an ITO conductive layer. Numerous tiny (less than 1 / 1000 inch) transparent insulating dots separate the two conductive layers. The basic principle of a resistive touchscreen is that when a finger touches the screen, the two conductive layers make contact at the touch point. The controller detects this contact, calculates the position coordinates (X, Y), and then operates in a manner similar to a mouse.
[0004] Since its introduction to the market, resistive touchscreens have captured a large share due to their stable quality, reliable performance, and high environmental adaptability. Especially in the industrial control field, the high environmental and conditional requirements further highlight the uniqueness of resistive touchscreens, resulting in a 90% market share among similar touchscreen products, making them the mainstream product. Like other types of touchscreens, achieving more accurate touch point positioning is a key challenge for resistive touchscreens. This can generally be addressed through single-point positioning and linear smoothing filtering. For example, Chinese invention patent application CN101639896A discloses a data filtering and smoothing method for touchscreens, which includes the following steps: establishing stable data and filtering and caching effective data sampled during touch; filtering abnormal data sampled during touch; and smoothing the data converted to display coordinates during pen strokes. Chinese invention patent application CN107506077A discloses a method for calibrating a resistive touchscreen. The method employs a region-based calibration approach, with the following steps: 1) Setting calibration point positions for a specific area of the touchscreen; 2) Coordinate reading: Determining if the touchscreen is effectively pressed; continuously reading 24 frames of AD sampling data; sorting the sampling data, removing the high 4 frames and low 4 frames, and averaging the remaining data; 3) Setting calibration coefficients: sequentially reading the coordinates of the touch calibration points; calculating the calibration coefficient for the region: obtaining the touch coordinates of the coordinate points (the display coordinates are pre-set by the program and are known data); dividing the difference between the two collected touch coordinates by the difference between the two displayed coordinates to obtain the linear coefficient at that position; 4) Conversion between touch coordinates and display coordinates: reading the touch coordinates; calculating the corresponding region based on the coordinate values; converting the touch coordinates to display coordinates based on the calibration coefficients for different regions; multiplying the obtained touch coordinates and the calibration coefficients to obtain the display coordinates of the touch point.
[0005] In the patent document with publication number CN101639896A, the establishment of stable touch point sampling data requires sampling the same frame of data multiple times and comparing several sets of differences to determine the final valid data of the touch point in the current frame. This solution does not require this step of prior determination; this determination will be included in the distance threshold determination later. In addition, the processing of the calculated valid value involves four calculations, which is relatively complex.
[0006] The solution disclosed in patent document CN107506077A involves multi-frame smoothing filtering, but the parameters used in the calculation require removing the maximum and minimum values from 4 frames out of 24, meaning 16 frames of data are used in the calculation. This involves comparing and calculating the maximum and minimum values, and the final amount of data involved in the calculation is relatively large. Furthermore, the conversion between touch coordinates and display coordinates requires dividing the area for conversion, which also increases the computational load. Summary of the Invention
[0007] The technical problem to be solved by this invention is how to reduce the amount of computation while improving smoothing accuracy.
[0008] The present invention solves the above-mentioned technical problems through the following technical means:
[0009] This invention proposes a touchscreen positioning smoothing filtering method, the method comprising the following steps:
[0010] Collect a set of touch drawing data containing multiple frames;
[0011] For each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch points in each frame;
[0012] Starting from the second frame of data, the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame is calculated as the target distance;
[0013] Determine whether the target distance is between the minimum distance threshold and the maximum distance threshold;
[0014] If so, the predicted coordinates of the current frame touch point are put into the queue, and the average of the predicted coordinates of each frame touch point stored in the queue is used as the smoothed and filtered coordinates of the current frame touch point.
[0015] If not, the predicted coordinates of the touch point in the previous frame or the touch point in the current frame will be used as the smoothed coordinates.
[0016] This invention calculates the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame by setting a maximum distance threshold and a minimum distance threshold. The distance threshold is then used to select the appropriate smoothing filter method for the current frame. The computational load is so low that it is acceptable to a microcontroller, and the smoothing effect is excellent. It can not only smooth the line shape drawn by the finger, thus basically eliminating the jagged error, but also identify whether the predicted coordinates of the current frame have changed too little or too much compared to the previous frame. Based on the actual situation of too little or too much change, the appropriate calculation method is selected, so that the smoothing filter result can closely match the actual line shape of the finger drawing.
[0017] Furthermore, the acquisition of a set of touch drawing data containing F frames includes:
[0018] The touchscreen is uniformly divided into an M*N grid, where M and N are both positive integers;
[0019] Collect a set of touch drawing data containing F frames. Each frame contains an M*N matrix of data composed of the ADC readings of each grid on the screen at the current moment, where F is a positive integer.
[0020] Furthermore, each frame of data contains an M*N matrix of data composed of the ADC readings of each grid on the screen at the current moment. For each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame, including:
[0021] Determine the effective region data for each frame of data, wherein the effective region data contains the grid with the largest ADC read value in that frame of data;
[0022] Using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame.
[0023] Further, determining the valid region data for each frame of data includes:
[0024] For each frame of data, which contains an M*N matrix of ADC readings from each grid on the screen, the grid with the largest ADC reading is selected.
[0025] Centered on the grid with the largest ADC reading, select J grids, where J is a positive integer;
[0026] The reading values of J grids and their corresponding grid coordinates are stored as the effective area data.
[0027] Furthermore, when the grid with the largest ADC reading is located at the edge or corner of the touchscreen, the method further includes:
[0028] Then, the grid portion that extends beyond the screen is discarded, and the effective region data is constructed based on the grid data located within the screen portion.
[0029] Furthermore, the centroid coordinates are calculated using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight. The predicted coordinates of the touch point in each frame are calculated using the centroid algorithm, as expressed by the formula:
[0030]
[0031]
[0032] In the formula: (x pre y pre (X) represents the predicted coordinates of a touch point in a given frame. j Y j ) represents the coordinates of the j-th grid in the effective region data, A j Let a be the weight of the j-th grid, where a = A / 2, b = B / 2, A is the horizontal width of a single grid, and B is the vertical length.
[0033] Furthermore, the queue includes a first sub-queue and a second sub-queue. The first sub-queue is used to store the horizontal coordinate of the predicted touch point coordinates, and the second sub-queue is used to store the vertical coordinate of the predicted touch point coordinates. The length of both the first sub-queue and the second sub-queue is 3.
[0034] Furthermore, when the target distance is greater than or equal to the maximum distance threshold, the method further includes:
[0035] Clear the queue and add the predicted coordinates of the current frame touch point as the first set of coordinates to the queue.
[0036] Furthermore, when the number of predicted touch point coordinates stored in the queue exceeds the queue length, the method further includes:
[0037] Following the first-in, first-out (FIFO) principle, delete the predicted coordinates of touch points that exceed the queue length.
[0038] Furthermore, this invention also proposes a touchscreen positioning smoothing filtering system, the system comprising:
[0039] The acquisition module is used to acquire a set of touch drawing data containing multiple frames;
[0040] The coordinate calculation module is used to calculate the predicted coordinates of the touch points in each frame of data using the centroid algorithm.
[0041] The distance calculation module is used to calculate the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame, starting from the second frame of data, as the target distance.
[0042] The judgment module is used to determine whether the target distance is between the minimum distance threshold and the maximum distance threshold;
[0043] The smoothing filter module is used to, when the output result of the judgment module is yes, put the predicted coordinates of the current frame touch point into a queue and use the average value of the predicted coordinates of each frame touch point stored in the queue as the smoothed and filtered coordinates of the current frame touch point; and to, when the output result of the judgment module is no, use the predicted coordinates of the previous frame touch point or the current frame touch point as the smoothed and filtered coordinates.
[0044] The advantages of this invention are:
[0045] (1) This invention calculates the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame by setting a maximum distance threshold and a minimum distance threshold, and compares them with the maximum distance threshold and the minimum distance threshold. The distance threshold can be used to select which smoothing filtering method should be used for the current frame. The required amount of calculation is low enough to be acceptable to a microcontroller, and the smoothing effect is excellent. It can not only smooth the line shape of the finger drawing, so that the jagged error is basically eliminated, but also identify whether the predicted coordinates of the current frame have changed too little or too much compared with the previous frame, and select the appropriate calculation method according to the actual situation of too little or too much, so that the smoothing filtering result can closely match the actual line shape of the finger drawing.
[0046] (2) This invention stores the predicted coordinates of touch points in a queue and uses the predicted coordinates of the latest up to 3 frames of touch points for smoothing by setting the queue length. This ensures that the amount of calculation is not too large or too complex, and uses the least amount of raw data and the simplest calculation to achieve smoothing filtering.
[0047] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating the touchscreen positioning smoothing filtering method proposed in Embodiment 1 of the present invention.
[0049] Figure 2 This is a schematic diagram of the sensor grid of the resistive touch screen in this invention;
[0050] Figure 3 This is a schematic diagram of the overall process of the touch screen positioning smoothing filtering method proposed in Embodiment 1 of the present invention;
[0051] Figure 4 This is a schematic diagram of the touch screen positioning smoothing filter system proposed in Embodiment 2 of the present invention. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] like Figure 1 As shown, the first embodiment of the present invention proposes a touchscreen positioning smoothing filtering method, the method comprising the following steps:
[0054] S10. Collect a set of touch drawing data containing multiple frames;
[0055] S20. For each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame;
[0056] S30. Starting from the second frame of data, calculate the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame as the target distance.
[0057] S40. Determine whether the target distance is between the minimum distance threshold and the maximum distance threshold. If yes, proceed to step S50; otherwise, proceed to step S60.
[0058] It should be noted that the minimum distance threshold and the maximum distance threshold described in this embodiment are empirical values obtained by those skilled in the art through a large number of experiments for comparison with the target distance.
[0059] S50. Add the predicted coordinates of the touch point in the current frame to the queue, and use the average of the predicted coordinates of the touch points in each frame stored in the queue as the smoothed and filtered coordinates of the touch point in the current frame.
[0060] S60. Use the predicted coordinates of the touch point in the previous frame or the touch point in the current frame as the smoothed and filtered coordinates.
[0061] This embodiment calculates the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame by setting a maximum distance threshold and a minimum distance threshold. The distance threshold can be used to flexibly select which smoothing filtering method should be used for the current frame. When the target distance is not between the minimum distance threshold and the maximum distance threshold, there is no need to perform smoothing filtering on the predicted coordinates of the touch point in the current frame. The required computation is low enough to be acceptable to a microcontroller, and the smoothing effect is excellent. It can not only smooth the line shape of the finger drawing, making the jagged error basically eliminated, but also identify whether the predicted coordinates of the current frame have changed too little or too much compared with the previous frame. Based on the actual situation of too little or too much change, the appropriate calculation method is selected so that the smoothing filtering result can closely match the actual line shape of the finger drawing.
[0062] Furthermore, compared with related technologies, this embodiment only requires one mean calculation per calculation, which greatly reduces the amount of computation while ensuring filtering performance, and there is no need to divide regions for conversion, which greatly reduces the amount of computation.
[0063] In one embodiment, step S10: acquiring a set of touch drawing data containing F frames specifically includes the following steps:
[0064] S11. Divide the touch screen into an M*N grid, where M and N are both positive integers;
[0065] S12. Collect a set of touch drawing data containing F frames. Each frame of data contains an M*N matrix of data composed of the ADC reading values of each grid on the screen at the current moment, where F is a positive integer.
[0066] It should be noted that, Figure 2 A schematic diagram of the sensor grid of a resistive touchscreen is shown. The sensor has the following characteristics: when pressure is applied to the sensor, the resistance of the X-line (horizontal) and Y-line (vertical) at the pressure point changes with the pressure. The greater the pressure, the smaller the resistance value. When there is no pressure, the resistance of the X-line and Y-line is close to infinite.
[0067] Assuming the screen dimensions are 69.5mm*130mm, and it is evenly divided into a 15*32 grid by X and Y lines, with each grid having a G... p It can be determined by grid coordinates (X) pm Y pn The formula () indicates that 1 ≤ m ≤ 15, 1 ≤ n ≤ 32, and 1 ≤ p ≤ 480. The dimensions are approximately 4.63 * 4.75. Each grid cell will have a real-time ADC reading. When there is no touch, all grid readings are 0; when touch pressure is felt, the grid readings near the touch point become positive, with an upper limit of 4095. The greater the pressure value, the larger the reading value; that is, the ADC reading value can indirectly represent the degree of pressure applied.
[0068] This embodiment records a set of data on a finger drawing a line at a constant speed. The touchscreen samples the touch position at the current moment at a sampling frequency of 50 frames / s. Each frame of data contains a 15*32 matrix data, which reflects the ADC reading values of each grid on the screen at the current moment. Assuming a total of F frames of data are collected, for any given frame, there is exactly one touch point. The touchscreen will generate non-zero ADC readings in the grids near the touch point. Let the q grids that generate readings be G1 to G2. q .
[0069] In one embodiment, step S20: For each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame, specifically including the following steps:
[0070] S21. Determine the effective region data for each frame of data, wherein the effective region data includes the grid with the largest ADC reading value in that frame of data;
[0071] It should be noted that, based on physical characteristics, the ADC reading value of the grid closer to the center of the touch point should be larger. In order to reduce the interference of the readings at the edge of the touch point, this embodiment delineates a certain area as the effective area among the many grids that generate non-zero readings, thereby determining the effective area data of each frame of data.
[0072] S22. Using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame.
[0073] In one embodiment, step S21, determining the valid region data for each frame of data, specifically includes the following steps:
[0074] For each frame of data, which contains an M*N matrix of ADC readings from each grid on the screen, the grid with the largest ADC reading is selected.
[0075] Centered on the grid with the largest ADC reading, select J grids, where J is a positive integer;
[0076] The reading values of J grids and their corresponding grid coordinates are stored as the effective area data.
[0077] It should be noted that, based on physical characteristics, the ADC reading value of the grid closer to the center of the touch point should be larger. Therefore, in this embodiment, the grid G with the largest ADC reading value is selected. MAX Its coordinates are (X MAX Y MAX Using this as the center, a 3*3 grid area is selected as the effective grid area, i.e., J=9. The readings of these 9 grids and their corresponding grid coordinates are stored as the effective area data, and the effective area ADC reading is denoted as A. j The effective grid coordinates of its location are (X... j Y j ), where 1≤j≤J.
[0078] It should be understood that the selection of a 3*3 grid area as the effective grid area in this embodiment is only for illustrative purposes. Those skilled in the art can select a specific number of grids as the effective grid area, centered on the grid with the largest ADC reading value, according to the actual size of the resistive touch screen.
[0079] In one embodiment, when the grid with the largest ADC read value is located at the edge or corner of the touchscreen, the method further includes:
[0080] Then, the grid portion that extends beyond the screen is discarded, and the effective region data is constructed based on the grid data located within the screen portion.
[0081] It should be noted that, generally, the effective area grid is a 3x3 nine-square grid. It is important to note that if G... MAX If the data is located at the edge or corner of the screen, the portion that extends beyond the screen is discarded, and only the actual and valid screen portion of the grid data is retained as the valid area data.
[0082] In one embodiment, since the magnitude of the ADC reading reflects the force of the touch point, specifically the pressure applied by the finger on that grid in an actual finger touch event, for valid area data, the center coordinates of each grid can be considered as centroid coordinates, and the ADC reading corresponding to that grid can be considered as a weight. This weight indirectly represents the force of the finger touch on that grid. Therefore, a centroid algorithm can be used to initially calculate the predicted coordinates of the touch point in that frame. The centroid method is used to calculate the predicted coordinate position. The horizontal and vertical coordinates.
[0083] Specifically, step S22: using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame, expressed by the formula:
[0084]
[0085]
[0086] In the formula: (x pre y pre (X) represents the predicted coordinates of a touch point in a given frame. j Y j ) represents the coordinates of the j-th grid in the effective region data, A j Let a be the weight of the j-th grid, where a = A / 2, b = B / 2, A is the horizontal width of a single grid, and B is the vertical length.
[0087] It should be noted that the values of a and b are defined according to the grid specifications, and they should represent the horizontal and vertical coordinates of the center point of a single grid.
[0088] It should be noted that for a rectangle with a length and width of 4.75 and 4.63 respectively, its center points are obviously b = 2.375 and a = 2.3165. (2*X) j -1)*a and (2*Y j -1)*b represents the coordinates (X) j Y j The x and y coordinates of the center point of the grid.
[0089] In one embodiment, the queue includes a first sub-queue and a second sub-queue. The first sub-queue is used to store the horizontal coordinates of the predicted touch point coordinates, and the second sub-queue is used to store the vertical coordinates of the predicted touch point coordinates. The length of both the first sub-queue and the second sub-queue is 3.
[0090] It should be noted that the length of both the first sub-queue and the second sub-queue in this embodiment is 3 only for illustrative purposes. Those skilled in the art can set the length of the first sub-queue and the second sub-queue according to the actual situation. This embodiment does not impose any specific limitations.
[0091] In this embodiment, to ensure the smoothness of the filtered line shape, the queue length should be as large as possible. However, the larger the queue length, the greater the difference between the filtered line shape and the original line shape, and the greater the computational load. Extensive experiments have shown that a length of 3 achieves a balance in all aspects of performance.
[0092] In one embodiment, when the target distance is greater than or equal to the maximum distance threshold, the method further includes:
[0093] Clear the queue and add the predicted coordinates of the current frame touch point as the first set of coordinates to the queue.
[0094] In one embodiment, when the predicted coordinates of touch points stored in the queue exceed the queue length, the method further includes:
[0095] Following the first-in, first-out (FIFO) principle, delete the predicted coordinates of touch points that exceed the queue length.
[0096] Specifically, such as Figure 3 As shown, let D be the distance between the centroid prediction points of the current frame and the previous frame. cur D may appear cur When the distance approaches 0 or is too large, simply applying mean filtering will produce abnormal results that do not meet the expected smoothing effect. Therefore, it is necessary to set a minimum distance threshold D based on experience. min and maximum distance threshold D max This determines which filtering method to use: when D min ≥D cur When this happens, it is assumed that the touch point in the current frame has not moved, and the smoothed filter coordinates of the previous frame should be used. Used as the smoothing filter coordinates for this frame There's no need to push the data into a queue or calculate mean smoothing; the predicted coordinates can be directly input. As smoothing filter coordinates When D cur ≥D max If the interval between the current frame and the previous frame is too large, mean filtering will cause the smoothed touch point to differ too much from the actual position, which does not meet expectations. Therefore, the predicted coordinates are directly used instead. As smoothing filter coordinates And clear queue Q x Q y ,Will As the first set of coordinates, it is pushed into the queue; when D min <Dcur <D max Only then will the push-in to queue operation and smoothing filtering operation be performed normally, and the first sub-queue Q be calculated. x Mean of valid data As the smoothed x-coordinate after smoothing filtering, calculate the second sub-queue Q. y Mean of valid data As the smoothed ordinate after smoothing, the smoothed coordinates of the touch point in the current frame can be obtained.
[0097] It should be noted that when the distance between the predicted coordinates of the touch point in frame i and the predicted coordinates of the touch point in frame (i-1) is between the minimum and maximum distance thresholds, as long as the first sub-queue Q... x Second subqueue Q y There is valid data in queue Q, regardless of whether queue Q is in queue Q. x Q y Is it full? Calculate Q. x Mean of valid data As the smoothed x-coordinate after smoothing filtering, calculate Q. y Mean of valid data As the smoothed ordinate after smoothing filtering.
[0098] Furthermore, the queue stores the horizontal and vertical coordinates of the points in the latest i-th frame, and guarantees the following conditions: when there are more than two coordinate values in the queue, the straight-line distance between the coordinates of the sampling points of two adjacent frames should be between the minimum distance threshold and the maximum distance threshold, and i is at most 3.
[0099] It should be noted that in this embodiment, the first sub-queue Q is used... x Second subqueue Q y The length of Q is set to 3, ensuring that Q is always... x Q y The system always stores the latest predicted coordinates, and at most 3 sets. x Q y The data stored in the system will be used to calculate the mean filter value, thereby achieving the function of dynamically selecting the number of frames.
[0100] It should be noted that this embodiment can determine which smoothing filtering method to use for the current frame by using the minimum and maximum distance thresholds. The required computation is low enough to be acceptable to a microcontroller, and the smoothing effect is excellent. It can not only smooth the line shape drawn by the finger, thus basically eliminating the jagged error, but also identify whether the predicted coordinates of the current frame have changed too little or too much compared to the previous frame. Based on the actual situation of being too little or too much, it selects an appropriate calculation method so that the smoothing filtering result can closely match the actual line shape of the finger drawing. Moreover, it only dynamically uses the predicted coordinates of the touch point in the latest and at most 3 frames for smoothing. With its characteristics of low computation, high smoothness and flexible selection of appropriate smoothing filtering methods, the smoothing of touch point predicted coordinates and line shape has been tested and found to be effective, achieving excellent results in both smoothing accuracy and computation.
[0101] like Figure 4 As shown, the second embodiment of the present invention also proposes a touch screen positioning smoothing filtering system, the system comprising:
[0102] The acquisition module 10 is used to acquire a set of touch drawing data containing multiple frames;
[0103] The coordinate calculation module 20 is used to calculate the predicted coordinates of the touch point for each frame of data using the centroid algorithm.
[0104] The distance calculation module 30 is used to calculate the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame, starting from the second frame of data, as the target distance.
[0105] The judgment module 40 is used to determine whether the target distance is between the minimum distance threshold and the maximum distance threshold;
[0106] The smoothing filter module 50 is used to, when the output result of the judgment module is yes, put the predicted coordinates of the current frame touch point into a queue and use the average value of the predicted coordinates of each frame touch point stored in the queue as the smoothed and filtered coordinates of the current frame touch point; and to, when the output result of the judgment module is no, use the predicted coordinates of the previous frame touch point or the current frame touch point as the smoothed and filtered coordinates.
[0107] This embodiment calculates the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame by setting a maximum distance threshold and a minimum distance threshold. The distance threshold can be used to flexibly select which smoothing filtering method should be used for the current frame. When the target distance is not between the minimum distance threshold and the maximum distance threshold, there is no need to perform smoothing filtering on the predicted coordinates of the touch point in the current frame. The required computation is low enough to be acceptable to a microcontroller, and the smoothing effect is excellent. It can not only smooth the line shape of the finger drawing, making the jagged error basically eliminated, but also identify whether the predicted coordinates of the current frame have changed too little or too much compared with the previous frame. Based on the actual situation of too little or too much change, the appropriate calculation method is selected so that the smoothing filtering result can closely match the actual line shape of the finger drawing.
[0108] In one embodiment, the acquisition module 10 includes:
[0109] The grid division unit is used to uniformly divide the touch screen into an M*N grid, where M and N are both positive integers;
[0110] The touch drawing data acquisition unit is used to acquire a set of touch drawing data containing F frames. Each frame of data contains an M*N matrix of data composed of the ADC reading values of each grid on the screen at the current moment, where F is a positive integer.
[0111] In one embodiment, the coordinate calculation module 20 includes:
[0112] The effective region data determination unit is used to determine the effective region data for each frame of data, wherein the effective region data includes the grid with the largest ADC reading value in that frame of data.
[0113] It should be noted that, based on physical characteristics, the ADC reading value of the grid closer to the center of the touch point should be larger. In order to reduce the interference of the readings at the edge of the touch point, this embodiment delineates a certain area as the effective area among the many grids that generate non-zero readings, thereby determining the effective area data of each frame of data.
[0114] The prediction coordinate calculation unit is used to calculate the predicted coordinates of the touch point in each frame by taking the center coordinates of each grid in the effective area data of each frame as the centroid coordinates and the ADC reading value corresponding to each grid as the weight.
[0115] In one embodiment, the effective area data determination unit is specifically used to perform the following steps:
[0116] For each frame of data, which contains an M*N matrix of ADC readings from each grid on the screen, the grid with the largest ADC reading is selected.
[0117] Centered on the grid with the largest ADC reading, select J grids, where J is a positive integer;
[0118] The reading values of J grids and their corresponding grid coordinates are stored as the effective area data.
[0119] In one embodiment, the predicted coordinate calculation unit is specifically used to calculate the predicted coordinates using the following formula:
[0120]
[0121]
[0122] In the formula: (x pre y pre (X) represents the predicted coordinates of a touch point in a given frame. j Y j ) represents the coordinates of the j-th grid in the effective region data, A j Let a be the weight of the j-th grid, where a = A / 2, b = B / 2, A is the horizontal width of a single grid, and B is the vertical length.
[0123] It should be noted that for a rectangle with a length and width of 4.75 and 4.63 respectively, its center points are obviously 2.375 and 2.3165. (2*X) j -1)*2.3165 and (2*Y j -1)*2.375 represents the coordinates (X) j Y j The x and y coordinates of the center point of the grid.
[0124] In one embodiment, the queue includes a first sub-queue and a second sub-queue. The first sub-queue is used to store the horizontal coordinates of the predicted touch point coordinates, and the second sub-queue is used to store the vertical coordinates of the predicted touch point coordinates. The length of both the first sub-queue and the second sub-queue is 3.
[0125] In one embodiment, the system further includes a queue clearing module, used to clear the queue when the target distance is greater than or equal to the maximum distance threshold, and to put the predicted coordinates of the current frame touch point into the queue as the first set of coordinates.
[0126] In one embodiment, the system further includes a predicted coordinate deletion module, used to delete the portion of the predicted touch point coordinates exceeding the queue length according to the first-in-first-out principle when the predicted touch point coordinates stored in the queue exceed the queue length.
[0127] It should be noted that other embodiments or implementation methods of the touch screen positioning smoothing filtering system described in this invention can refer to the above method embodiments, and will not be repeated here.
[0128] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0129] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0130] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A touchscreen positioning smoothing filtering method, characterized in that, The method includes: Collect a set of touch drawing data containing multiple frames; For each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch points in each frame; Starting from the second frame of data, the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame is calculated as the target distance; Determine whether the target distance is between the minimum distance threshold and the maximum distance threshold; If so, the predicted coordinates of the current frame touch point are put into the queue, and the average of the predicted coordinates of each frame touch point stored in the queue is used as the smoothed and filtered coordinates of the current frame touch point. If not, the predicted coordinates of the touch point in the previous frame or the touch point in the current frame are used as the smoothed coordinates, including: when the target distance is less than or equal to the minimum distance threshold, the predicted coordinates of the touch point in the previous frame are used as the smoothed coordinates of the touch point in the current frame; when the target distance is greater than or equal to the maximum distance threshold, the predicted coordinates of the touch point in the current frame are used as the smoothed coordinates, the queue is cleared, and the predicted coordinates of the touch point in the current frame are pushed into the queue as the first set of coordinates. Specifically, by setting the queue length, the predicted coordinates of the latest and at most 3 frames of touch points are dynamically used for smoothing, and according to the first-in-first-out principle, the predicted coordinates of touch points exceeding the queue length are deleted.
2. The touchscreen positioning smoothing filtering method as described in claim 1, characterized in that, The acquisition of a set of touch drawing data containing multiple frames includes: Divide the touchscreen evenly into M N The grid, in which, M , N All are positive integers; Collect a set of data containing F The touch drawing data for each frame consists of ADC readings of each grid on the screen at the current moment. M N Matrix data, F It is a positive integer.
3. The touchscreen positioning smoothing filtering method as described in claim 2, characterized in that, Each frame of data consists of the ADC readings of each grid on the screen at the current moment. M N The matrix data, wherein for each frame of data, the centroid algorithm is used to calculate the predicted coordinates of the touch points in each frame, including: Determine the effective region data for each frame of data, wherein the effective region data contains the grid with the largest ADC read value in that frame of data; Using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight, the centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame.
4. The touchscreen positioning smoothing filtering method as described in claim 3, characterized in that, The determination of the valid region data for each frame of data includes: The data for each frame consists of ADC readings from each grid on the screen. M N From the matrix data, select the grid with the largest ADC reading; Centered on the grid with the largest ADC reading, select J One grid, J It is a positive integer; Will J The reading values of each grid and their corresponding grid coordinates are stored as the effective area data.
5. The touchscreen positioning smoothing filtering method as described in claim 4, characterized in that, When the grid with the largest ADC reading is located at the edge or corner of the touchscreen, the method further includes: Then, the grid portion that extends beyond the screen is discarded, and the effective region data is constructed based on the grid data located within the screen portion.
6. The touchscreen positioning smoothing filtering method as described in claim 3, characterized in that, The centroid coordinates are calculated using the center coordinates of each grid in the effective area data of each frame as the centroid coordinates, and the ADC reading value corresponding to each grid as the weight. The centroid algorithm is used to calculate the predicted coordinates of the touch point in each frame, as expressed by the formula: In the formula: ( , ( ) represents the predicted coordinates of a touch point in a given frame. The first in the effective region data j The coordinates of each grid, For the first j The weights of each grid, where =A / 2, =B / 2, where A is the horizontal width of a single grid and B is the vertical length.
7. The touchscreen positioning smoothing filtering method as described in claim 1, characterized in that, The queue includes a first sub-queue and a second sub-queue. The first sub-queue is used to store the horizontal coordinates of the predicted touch point coordinates, and the second sub-queue is used to store the vertical coordinates of the predicted touch point coordinates. The length of both the first sub-queue and the second sub-queue is 3.
8. A touchscreen positioning smoothing filtering system, characterized in that, The system includes: The acquisition module is used to acquire a set of touch drawing data containing multiple frames; The coordinate calculation module is used to calculate the predicted coordinates of the touch points in each frame of data using the centroid algorithm. The distance calculation module is used to calculate the distance between the predicted coordinates of the touch point in the current frame and the predicted coordinates of the touch point in the previous frame, starting from the second frame of data, as the target distance. The judgment module is used to determine whether the target distance is between the minimum distance threshold and the maximum distance threshold; The smoothing filtering module is used to, when the output result of the judgment module is yes, put the predicted coordinates of the current frame touch point into a queue and use the average of the predicted coordinates of the touch points of each frame stored in the queue as the smoothed and filtered coordinates of the current frame touch point; and to, when the output result of the judgment module is no, use the predicted coordinates of the previous frame touch point or the current frame touch point as the smoothed and filtered coordinates, including when the target distance is less than or equal to the minimum distance threshold, using the predicted coordinates of the previous frame touch point as the smoothed and filtered coordinates of the current frame touch point; when the target distance is greater than or equal to the maximum distance threshold, using the predicted coordinates of the current frame touch point as the smoothed and filtered coordinates, clearing the queue, and pushing the predicted coordinates of the current frame touch point as the first set of coordinates into the queue; Specifically, by setting the queue length, the predicted coordinates of the latest and at most 3 frames of touch points are dynamically used for smoothing, and according to the first-in-first-out principle, the predicted coordinates of touch points exceeding the queue length are deleted.