Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for object recognition based on an infrared touch screen, which enable the infrared touch screen to recognize and display the motion of a regular or irregular object.
Based on the above purpose, the invention provides an object identification method based on an infrared screen, which comprises the following steps:
controlling an infrared transmitting tube and an infrared receiving tube of the infrared touch screen to scan a touch object at intervals to obtain the outline of the touch object at each moment;
and drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line.
Optionally, an infrared transmitting tube is placed on the frame of the infrared touch screen every other at least one infrared receiving tube.
Furthermore, the infrared emission tubes on the infrared touch screen frame emit sector scanning illumination simultaneously or one by one in sequence.
Further, when each infrared transmitting tube scans a touch object, recording a scanning line which is not received by the infrared receiving tube for the first time and a scanning line which is not received by the infrared transmitting tube for the last time; and then intersecting all the scanning lines recorded by the infrared emission tubes, and connecting each intersection point to obtain the outline of the touch object at each moment.
Optionally, before the method for identifying an object based on an infrared screen performs drawing a common tangent line between the outlines of each two adjacent touch objects and filling the area between the outlines of the two touch objects and the common tangent line, the method further includes:
acquiring data on a contact surface of the infrared touch screen, wherein the data comprises the actual speed of a current point and the coordinate position of the current point;
calculating a drawing speed according to the obtained actual speed;
and drawing the outline of the touch object at the current point according to the drawing speed of the current point.
Further, the drawing speed value is calculated according to the actual speed of the current point and the actual speed value of a previous point adjacent to and before the current point, and the calculation formula is as follows:
the velocity ∑ inertia coefficient ∑ actual velocity is plotted.
Further, the inertia coefficient in the calculation formula is a fraction smaller than 1;
the numerator part of the fraction is obtained from a Fibonacci number series, the denominator part is the sum of all the numerators, and the sum of all the inertia coefficients is 1;
the closer to the current point, the larger the value of the inertia coefficient, and the farther from the current point, the smaller the value of the inertia coefficient.
Optionally, before the method for identifying an object based on an infrared screen performs drawing a common tangent line between the outlines of each two adjacent touch objects and filling the area between the outlines of the two touch objects and the common tangent line, the method further includes:
and acquiring data on a contact surface of the infrared touch screen, wherein the data comprises a pressure value of a current point and a coordinate position of the current point, and drawing the outline of the touch object according to the pressure value.
Further, the pressure value and the coordinate position are sampled according to a preset interval value, and the preset interval value is a pixel interval value or a time interval value; the pressure value is directly obtained by a touch screen, and the touch screen has pressure sensing capacity; or the pressure value is provided by a hardware device which is in direct contact with the touch screen.
Optionally, the infrared screen-based object identification method further includes the steps of:
filling an area between the outlines of the two touch objects and a common tangent line to form a line segment with a certain thickness;
performing key point algorithm calculation on the line segment;
judging whether a key point exists or not, and if so, fitting and optimizing line segments on two sides of the key point by taking the key point as a reference; fitting to optimize the already drawn line segment if not present;
solidifying the fitted and optimized line segment;
and displaying the cured line segment.
Further, the key point algorithm calculation comprises the following steps:
selecting a line segment of which the key point needs to be calculated;
connecting two end points of the selected line segment into a straight line;
the vertical distances of all points on the line segment to the straight line are calculated.
Further, the judgment of whether the key point exists is to judge the vertical distance, and a judgment threshold value is M, wherein the threshold value M is more than 0;
if the largest vertical distance in the vertical distances is larger than or equal to the threshold value M, the key point is related; the point with the maximum vertical distance is a key point;
if the largest vertical distance of the vertical distances is less than the threshold M, then there are no keypoints.
Further, when the key points exist, the line segments on two sides of the key points are respectively fitted and optimized by taking the key points as a reference, and the key points are fixed.
Further, after fitting and optimizing line segments on two sides of the key point, judging whether the key point is a new key point: if so, selecting two segments from the starting point to the key point and from the key point to the current point, and respectively calculating the key points of the two segments; if not, the line segment between the optimized key point and the starting point is subjected to curing fitting.
Further, after the line segment from the key point to the starting point is solidified, the key point is used as the starting point of the next drawing process, and the drawing is restarted.
Further, when the key point does not exist, whether the current point reaches a starting point or not is further judged, if yes, a line segment between the current point and the starting point is fitted and optimized, and the fitted and optimized line segment is solidified; if not, fitting and optimizing a line segment between the current point and the starting point, and then restarting to acquire the data.
Further, the second threshold N comprises a time threshold TMAnd/or a distance threshold LM;
The second threshold N is a time threshold TMAnd a distance threshold value LMJudging whether any one of the time or the distance from the current point to the starting point reaches the time threshold T or notMOr a distance threshold LMIf any one is reached, the judgment result is yes; otherwise, i.e. T < TMAnd L is less than LMIf so, judging whether the result is negative;
the second threshold N is a time threshold TMJudging whether the time from the current point to the starting point reaches the time threshold value T or notMIf yes, judging that the result is yes; otherwise, i.e. T < TMIf so, judging whether the result is negative;
the second threshold N is a distance threshold LMWherein the second threshold N is a distance threshold LMJudging whether the distance from the current point to the starting point reaches the preset valueThe distance threshold value LMIf yes, judging that the result is yes; otherwise, i.e. L < LMIf so, judging that the result is negative.
In addition, the invention also provides an object recognition device based on the infrared screen, which comprises:
the touch object outline acquisition unit is used for controlling an infrared transmitting tube and an infrared receiving tube of the infrared touch screen to scan the touch object at intervals to obtain the outline of the touch object at each moment;
a filling unit: and the common tangent line is drawn between the outlines of every two adjacent touch objects and the area between the outlines of the two touch objects and the common tangent line is filled.
Optionally, an infrared transmitting tube is placed on the frame of the infrared touch screen every other at least one infrared receiving tube.
Furthermore, the infrared emission tubes on the infrared touch screen frame emit sector scanning illumination simultaneously or one by one in sequence.
Further, when each infrared transmitting tube scans the touch object, the touch object outline acquisition unit records that the first infrared receiving tube does not receive the scanning line of the infrared transmitting tube and the last infrared receiving tube does not receive the scanning line of the infrared transmitting tube; and then intersecting all the scanning lines recorded by the infrared emission tubes, and connecting each intersection point to obtain the outline of the touch object at each moment.
Optionally, the infrared-screen-based object recognition device further includes a touch object outline drawing unit, one end of which is connected to the touch object outline acquisition unit, and the other end of which is connected to the filling unit;
the touch object outline drawing unit is used for acquiring data on a contact surface of the touch object outline drawing unit and the infrared touch screen, wherein the data comprises the actual speed of a current point and the coordinate position of the current point; calculating a drawing speed according to the obtained actual speed; drawing the outline of the touch object at the current point according to the drawing speed of the current point; or
The touch object outline drawing unit is used for acquiring data on a contact surface of the touch object outline drawing unit and the infrared touch screen, wherein the data comprises a pressure value of a current point and a coordinate position of the current point, and the outline of the touch object is drawn according to the pressure value.
Further, the drawing speed value is calculated according to the actual speed of the current point and the actual speed value of a previous point adjacent to and before the current point, and the calculation formula is as follows:
the velocity ∑ inertia coefficient ∑ actual velocity is plotted.
Further, the inertia coefficient in the calculation formula is a fraction smaller than 1;
the numerator part of the fraction is obtained from a Fibonacci number series, the denominator part is the sum of all the numerators, and the sum of all the inertia coefficients is 1;
the closer to the current point, the larger the value of the inertia coefficient, and the farther from the current point, the smaller the value of the inertia coefficient.
Further, the pressure value and the coordinate position are sampled according to a preset interval value, and the preset interval value is a pixel interval value or a time interval value; the pressure value is directly obtained by a touch screen, and the touch screen has pressure sensing capacity; or the pressure value is provided by a hardware device which is in direct contact with the touch screen.
Optionally, the infrared screen-based object recognition device further comprises an optimization unit, and the optimization unit is connected with the filling unit; the optimization unit is used for filling an area between the outlines of the two touch objects and a common tangent line to form a line segment with a certain thickness; performing key point algorithm calculation on the line segment; judging whether a key point exists or not, and if so, fitting and optimizing line segments on two sides of the key point by taking the key point as a reference; fitting to optimize the already drawn line segment if not present; solidifying the fitted and optimized line segment; and displaying the cured line segment.
Further, the key point algorithm calculation comprises the following steps:
selecting a line segment of which the key point needs to be calculated;
connecting two end points of the selected line segment into a straight line;
the vertical distances of all points on the line segment to the straight line are calculated.
Further, the judgment of whether the key point exists is to judge the vertical distance, and a judgment threshold value is M, wherein the threshold value M is more than 0;
if the largest vertical distance in the vertical distances is larger than or equal to the threshold value M, the key point is related; the point with the maximum vertical distance is a key point;
if the largest vertical distance of the vertical distances is less than the threshold M, then there are no keypoints.
Further, when the key points exist, the line segments on two sides of the key points are respectively fitted and optimized by taking the key points as a reference, and the key points are fixed.
Further, after fitting and optimizing line segments on two sides of the key point, judging whether the key point is a new key point: if so, selecting two segments from the starting point to the key point and from the key point to the current point, and respectively calculating the key points of the two segments; if not, the line segment between the optimized key point and the starting point is subjected to curing fitting.
Further, when the key point does not exist, whether the current point reaches a starting point or not is further judged, if yes, a line segment between the current point and the starting point is fitted and optimized, and the fitted and optimized line segment is solidified; if not, fitting and optimizing a line segment between the current point and the starting point, and then restarting to acquire the data.
Further, the second threshold N comprises a time threshold TMAnd/or a distance threshold LM;
The second threshold N is a time threshold TMAnd a distance threshold value LMJudging whether any one of the time or the distance from the current point to the starting point reaches the time threshold T or notMOr a distance threshold LMIf it reachesIf any one of the judgment results is yes; otherwise, i.e. T < TMAnd L is less than LMIf so, judging whether the result is negative;
the second threshold N is a time threshold TMJudging whether the time from the current point to the starting point reaches the time threshold value T or notMIf yes, judging that the result is yes; otherwise, i.e. T < TMIf so, judging whether the result is negative;
the second threshold N is a distance threshold LMWherein the second threshold N is a distance threshold LMJudging whether the distance from the current point to the starting point reaches the distance threshold value LMIf yes, judging that the result is yes; otherwise, i.e. L < LMIf so, judging that the result is negative.
From the above, the method and the device for identifying an object based on an infrared screen provided by the invention can scan a touch object by controlling the infrared transmitting tube and the infrared receiving tube of the infrared touch screen at intervals to obtain the outline of the touch object at each moment; and drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line. Therefore, the method and the device based on the infrared screen object recognition not only can accurately recognize and display the outer contour of the touch object, but also can display the motion process of the touch object.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to specific embodiments and the accompanying drawings.
Referring to fig. 1, a schematic flow chart of an infrared-screen-based object identification method according to an embodiment of the present invention is shown, where the infrared-screen-based object identification method includes:
step 101, controlling an infrared transmitting tube and an infrared receiving tube of an infrared touch screen to scan a touch object at intervals to obtain the outline of the touch object at each moment.
And 102, drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line.
As an embodiment of the present invention, an infrared transmitting tube is disposed on the frame of the infrared touch screen every other at least one infrared receiving tube. Preferably, the infrared touch screen has four frames, and an infrared transmitting tube is arranged on each frame every three infrared receiving tubes. Preferably, the infrared emission tubes on the four frames can emit the scanned illumination simultaneously or sequentially one by one. It is worth mentioning that, in one embodiment of the present invention, the scanning illumination emitted by the infrared emission tube is fan-shaped.
As another embodiment of the present invention, a method of obtaining an outer contour of the touch object includes:
the first step is as follows: when an infrared transmitting tube arranged on each frame of the infrared touch screen scans a touch object, recording the scanning lines of the infrared transmitting tube which are not received by the infrared receiving tube for the first time and the scanning lines of the infrared transmitting tube which are not received by the infrared receiving tube for the last time. Finally, two scanning lines recorded when all the infrared emission tubes are scanned can be obtained.
And secondly, intersecting all the scanning lines recorded by the infrared emission tubes to obtain an intersection point.
And thirdly, smoothly connecting each intersection point to obtain the outline of the touch object at each moment.
In another embodiment of the present invention, as shown in fig. 2, the infrared screen-based object recognition method includes:
step 201, controlling an infrared transmitting tube and an infrared receiving tube of the infrared touch screen to scan the touch object at intervals to obtain the outline of the touch object at each moment.
Step 202, drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line to form a line segment with a certain thickness.
And step 203, performing key point algorithm calculation on the line segment.
Preferably, the method for calculating the key point algorithm for the line segment may include:
the first step is as follows: and selecting a line segment (the line segment is not necessarily a straight line, and can also be a curve, a broken line and the like) needing to calculate the key point. Preferably, the line segment for selecting the key point to be calculated is a line segment between the current point and the starting point.
The second step is that: the two end points (the starting point and the end point) of the selected line segment are connected into a straight line.
The third step: the vertical distances of all points on the line segment to the straight line are calculated. Preferably, the vertical distance calculation does not include the vertical distance of the two end points of the line segment to the straight line. Since the two end points of the line segment coincide with the two end points of the straight line, the distance is 0.
Suppose that line segment A is selectedDASCalculation is performed, starting point ASCurrent point AD,ASAnd ADTwo points are two end points of the line segment, ASTo ADConnecting into a straight line, calculating the vertical distance between all points on the straight line and the straight line, excluding ASAnd ADTwo points.
Step 204, judging whether a key point exists, if so, fitting and optimizing line segments on two sides of the key point by taking the key point as a reference; if not, fitting optimizes the already drawn line segment.
Preferably, all the vertical distance calculation results are judged, and a judgment threshold value is M, where M is greater than 0. If the maximum vertical distance L is among them⊥Greater than or equal to a predetermined threshold value M, i.e. L⊥Judging that a key point exists when the vertical distance is more than or equal to M, and taking the point with the maximum vertical distance as the key point AKAnd fitting and optimizing line segments on two sides of the key point. Specifically, the key point is fixed, the position of the key point is taken as a boundary, the line segment is divided into two segments, namely, a segment from the starting point to the key point and a segment from the key point to the current point, and the two segments are respectively subjected to fitting optimization. Assume the current point ADAnd the starting point ASThe line segment between is ASAD,AKFor the key points on the line segment, from key point AKBy dividing the line into two sections, i.e. line ASAKAnd line segment AKADCuring Key Point AKFitting the optimized line segment ASAKAnd line segment AKAD。
If the maximum vertical distance L⊥Less than threshold M, i.e. L⊥If the current point reaches the starting point, judging whether a key point does not exist on the line segment, and further judging whether the current point reaches a second threshold value N. If the judgment result is yes, the line segment between the current point and the starting point is fitted and optimized when the second threshold value N is reached. And if the judgment result is negative, namely the second threshold value N is not reached, fitting and optimizing the line segment between the current point and the starting point. Wherein preferably, the second threshold value N may comprise a time threshold value TMAnd/or a distance threshold LM。
If the second threshold value N is the time threshold value TMAnd a distance threshold value LMFurther judging whether any one of the time or the distance from the current point to the starting point reaches the time threshold TMOr a distance threshold LMIf any one is reached, the judgment result is yes; otherwise, i.e. T < TMAnd L is less than LMIf so, judging that the result is negative.
If the second threshold value N is the time threshold value TMThen go forwardJudging whether the time from the current point to the starting point reaches the time threshold value T or not in one stepMIf yes, judging that the result is yes; otherwise T is less than TMIf so, judging that the result is negative.
If the second threshold value N is the distance threshold value LMFurther judging whether the distance from the current point to the starting point reaches the distance threshold value LMIf yes, judging that the result is yes; otherwise L < LMIf so, judging that the result is negative.
And step 205, solidifying the fitted and optimized line segment.
And step 206, displaying the cured line segment.
Preferably, the fitting optimization mode is obtained according to Bezier curve algorithm fitting optimization. The Bezier curve has the advantages that the simulation degree is higher, and burrs and sharp inflection points with high distortion degree generated by shaking in the drawing process can be effectively removed. The line segment after fitting optimization is solidified, so that the excessively low operation speed caused by excessively long operation time in a complicated calculation process can be shortened. The mode of sectional drawing, calculation, fitting optimization and curing of the line segment is an incremental storage mode, and the storage mode greatly improves the operation speed.
In another embodiment of the present invention, in order to display the motion process of the soft touch object, the infrared screen-based object recognition method includes (as shown in fig. 3):
step 301, controlling an infrared transmitting tube and an infrared receiving tube of the infrared touch screen to scan the touch object at intervals to obtain the outline of the touch object at each moment.
Step 302, acquiring data on a contact surface of the infrared touch screen, wherein the data comprises the actual speed of a current point and the coordinate position of the current point, and the first point is a starting point.
As an embodiment of the invention, the hardware device in contact with the touch screen is a stylus pen, the pen point of the stylus pen is provided with two sensing points, and the midpoint position of a connecting line of the two sensing points is the coordinate position of the current point. As an embodiment, the coordinate position is a dynamic value, and each pixel point on the screen corresponds to a unique coordinate position.
As an embodiment of the present invention, in order to avoid that the sampling points influence the calculation speed too much, in the data acquisition process, the actual speed and the coordinate position are sampled according to a preset interval value, for example, data is acquired every two pixel values, or data is acquired every interval, for example, every 40 ms.
In step 303, a rendering speed is calculated from the acquired actual speed.
Preferably, the plotting speed value is calculated according to the actual speed of the current point and the actual speed value of a previous point adjacent to and before the current point, and the calculation formula is as follows:
the velocity ∑ inertia coefficient ∑ actual velocity is plotted.
As an example, the inertia coefficient in the formula is a fraction less than 1, the numerator portion of the fraction is taken from the fibonacci number series, and the denominator portion is the sum of all the numerators. The sum of all the inertia coefficients is 1.
As an example, the closer to the current point, the larger the value of the inertia coefficient, and the farther from the current point, the smaller the value of the inertia coefficient.
Assuming that the rendering speed of the current point is calculated from the current point to a third point before the current point, the calculation formula is
V′
DFor the rendering speed of the current point, V
DIs the actual speed, V, of the current point
D-1Actual speed, V, of a point preceding the current point
D-2Actual speed, V, of a second point before the current point
D-3The actual speed of the third point before the current point is the inertia coefficients corresponding to the four points respectively. In this way, it is calculated to avoid distortion of drawing due to abrupt velocity change during drawing.
And step 304, drawing the outline of the touch object at the current point according to the drawing speed of the current point.
And 305, drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line.
In another embodiment of the present invention, in order to display the motion process of the soft touch object, the infrared screen-based object recognition method includes (as shown in fig. 4):
step 401, controlling an infrared transmitting tube and an infrared receiving tube of the infrared touch screen to scan the touch object at intervals to obtain the outline of the touch object at each moment.
And 402, acquiring data on a contact surface of the infrared touch screen, wherein the data comprises a pressure value of a current point and a coordinate position of the current point.
According to one embodiment of the invention, the hardware device in contact with the touch screen is an electromagnetic pen, the pen point of the electromagnetic pen is provided with an elastic device, pressure data is divided into 512 gears, each gear corresponds to one elasticity of the elastic device, and a pressure value is obtained according to the elasticity of the elastic device. Alternatively, the pressure data may be divided into 255 steps, or 1024 steps. As an embodiment, for a touch screen with pressure sensing capability, the pressure value can be directly obtained by the touch screen, and the pressure value can be obtained by other types of pens or fingers without the help of an electromagnetic pen.
Each pixel point on the screen corresponds to a unique coordinate position. The coordinate position is a dynamic value, and the current coordinate position is obtained according to the current point A contacted by the pen point and the touch screenDThe location of the same.
As an embodiment of the present invention, in order to avoid that the excessive sampling points affect the calculation speed, in the drawing process, the pressure values and the coordinate positions are sampled according to preset interval values, for example, data is acquired every two pixel values, or data is acquired every interval, for example, every 40 ms.
And step 403, drawing the outline of the touch object according to the pressure value, wherein the first point is a starting point.
Preferably, the outline of the touch object is drawn according to the pressure value in a proportional relation.
And step 404, drawing a common tangent line between the outlines of every two adjacent touch objects, and filling the area between the outlines of the two touch objects and the common tangent line.
Referring to fig. 5, a schematic structural diagram of an infrared-screen-based object recognition device according to an embodiment of the present invention is shown, where the infrared-screen-based object recognition device includes:
the touch object outline acquisition unit 501 is configured to control an infrared transmitting tube and an infrared receiving tube of the infrared touch screen at intervals to scan a touch object, so as to obtain an outline of the touch object at each moment.
As an embodiment of the present invention, an infrared transmitting tube is disposed on the frame of the infrared touch screen every other at least one infrared receiving tube. Preferably, the infrared touch screen has four frames, and an infrared transmitting tube is arranged on each frame every three infrared receiving tubes. Preferably, the infrared emission tubes on the four frames can emit the scanned illumination simultaneously or sequentially one by one. It is worth mentioning that, in one embodiment of the present invention, the scanning illumination emitted by the infrared emission tube is fan-shaped.
As another embodiment of the present invention, a method of obtaining an outer contour of the touch object includes:
the first step is as follows: when an infrared transmitting tube arranged on each frame of the infrared touch screen scans a touch object, recording the scanning lines of the infrared transmitting tube which are not received by the infrared receiving tube for the first time and the scanning lines of the infrared transmitting tube which are not received by the infrared receiving tube for the last time. Finally, two scanning lines recorded when all the infrared emission tubes are scanned can be obtained.
And secondly, intersecting all the scanning lines recorded by the infrared emission tubes to obtain an intersection point.
And thirdly, smoothly connecting each intersection point to obtain the outline of the touch object at each moment.
A touch object outline drawing unit 502 having one end connected to the touch object outline acquisition unit 501 and the other end connected to the filling unit 503; the infrared touch screen is used for acquiring data on a contact surface with the infrared touch screen, the data comprises the actual speed of a current point and the coordinate position of the current point, and the first point is a starting point; calculating a drawing speed according to the obtained actual speed; and drawing the outline of the touch object at the current point according to the drawing speed of the current point. As an embodiment of the invention, the hardware device in contact with the touch screen is a stylus pen, the pen point of the stylus pen is provided with two sensing points, and the midpoint position of a connecting line of the two sensing points is the coordinate position of the current point. As an embodiment, the coordinate position is a dynamic value, and each pixel point on the screen corresponds to a unique coordinate position.
As an embodiment of the present invention, in order to avoid that the sampling points influence the calculation speed too much, in the data acquisition process, the actual speed and the coordinate position are sampled according to a preset interval value, for example, data is acquired every two pixel values, or data is acquired every interval, for example, every 40 ms.
Preferably, the plotting speed value is calculated according to the actual speed of the current point and the actual speed value of a previous point adjacent to and before the current point, and the calculation formula is as follows:
the velocity ∑ inertia coefficient ∑ actual velocity is plotted.
As an example, the inertia coefficient in the formula is a fraction less than 1, the numerator portion of the fraction is taken from the fibonacci number series, and the denominator portion is the sum of all the numerators. The sum of all the inertia coefficients is 1.
As an example, the closer to the current point, the larger the value of the inertia coefficient, and the farther from the current point, the smaller the value of the inertia coefficient.
Assuming that the rendering speed of the current point is calculated from the current point to a third point before the current point, the calculation formula is
V′
DFor the rendering speed of the current point, V
DIs the actual speed, V, of the current point
D-1Actual speed, V, of a point preceding the current point
D-2Actual speed, V, of a second point before the current point
D-3The actual speed of the third point before the current point is the inertia coefficients corresponding to the four points respectively. In this way, it is calculated to avoid distortion of drawing due to abrupt velocity change during drawing.
Or the touch object outline drawing unit is used for acquiring data on a contact surface of the touch object outline drawing unit and the infrared touch screen, the data comprises a pressure value of a current point and a coordinate position of the current point, the outline of the touch object is drawn according to the pressure value, and the first point is a starting point.
According to one embodiment of the invention, the hardware device in contact with the touch screen is an electromagnetic pen, the pen point of the electromagnetic pen is provided with an elastic device, pressure data is divided into 512 gears, each gear corresponds to one elasticity of the elastic device, and a pressure value is obtained according to the elasticity of the elastic device. Alternatively, the pressure data may be divided into 255 steps, or 1024 steps. As an embodiment, for a touch screen with pressure sensing capability, the pressure value can be directly obtained by the touch screen, and the pressure value can be obtained by other types of pens or fingers without the help of an electromagnetic pen.
Each pixel point on the screen corresponds to a unique coordinate position. The coordinate position is a dynamic value, and the current coordinate position is obtained according to the current point A contacted by the pen point and the touch screenDThe location of the same.
As an embodiment of the present invention, in order to avoid that the excessive sampling points affect the calculation speed, in the drawing process, the pressure values and the coordinate positions are sampled according to preset interval values, for example, data is acquired every two pixel values, or data is acquired every interval, for example, every 40 ms.
Preferably, the outline of the touch object is drawn according to the pressure value in a proportional relation.
And a filling unit 503, configured to draw a common tangent line between the outlines of every two adjacent touch objects, and fill an area between the outlines of the two touch objects and the common tangent line.
The optimizing unit 504 is connected with the filling unit 503 and is used for filling an area between the outlines of the two touch objects and the common tangent line to form a line segment with a certain thickness; performing key point algorithm calculation on the line segment; judging whether a key point exists or not, and if so, fitting and optimizing line segments on two sides of the key point by taking the key point as a reference; fitting to optimize the already drawn line segment if not present; solidifying the fitted and optimized line segment; and displaying the cured line segment.
Preferably, the method for calculating the key point algorithm for the line segment may include:
the first step is as follows: and selecting a line segment (the line segment is not necessarily a straight line, and can also be a curve, a broken line and the like) needing to calculate the key point. Preferably, the line segment for selecting the key point to be calculated is a line segment between the current point and the starting point.
The second step is that: the two end points (the starting point and the end point) of the selected line segment are connected into a straight line.
The third step: the vertical distances of all points on the line segment to the straight line are calculated. Preferably, the vertical distance calculation does not include the vertical distance of the two end points of the line segment to the straight line. Since the two end points of the line segment coincide with the two end points of the straight line, the distance is 0.
Suppose that line segment A is selectedDASCalculation is performed, starting point ASCurrent point AD,ASAnd ADTwo points are two end points of the line segment, ASTo ADConnecting into a straight line, calculating the vertical distance between all points on the straight line and the straight line, excluding ASAnd ADTwo points.
Preferably, all the vertical distance calculation results are judged, and a judgment threshold value is M, where M is greater than 0. If the maximum vertical distance L is among them⊥Greater than or equal to a predetermined threshold value M, i.e. L⊥Judging when the value is more than or equal to MThere is a key point, and the point with the largest vertical distance is the key point AKAnd fitting and optimizing line segments on two sides of the key point. Specifically, the key point is fixed, the position of the key point is taken as a boundary, the line segment is divided into two segments, namely, a segment from the starting point to the key point and a segment from the key point to the current point, and the two segments are respectively subjected to fitting optimization. Assume the current point ADAnd the starting point ASThe line segment between is ASAD,AKFor the key points on the line segment, from key point AKBy dividing the line into two sections, i.e. line ASAKAnd line segment AKADCuring Key Point AKFitting the optimized line segment ASAKAnd line segment AKAD。
If the maximum vertical distance L⊥Less than threshold M, i.e. L⊥If the current point reaches the starting point, judging whether a key point does not exist on the line segment, and further judging whether the current point reaches a second threshold value N. If the judgment result is yes, the line segment between the current point and the starting point is fitted and optimized when the second threshold value N is reached. And if the judgment result is negative, namely the second threshold value N is not reached, fitting and optimizing the line segment between the current point and the starting point. Wherein preferably, the second threshold value N may comprise a time threshold value TMAnd/or a distance threshold LM。
If the second threshold value N is the time threshold value TMAnd a distance threshold value LMFurther judging whether any one of the time or the distance from the current point to the starting point reaches the time threshold TMOr a distance threshold LMIf any one is reached, the judgment result is yes; otherwise, i.e. T < TMAnd L is less than LMIf so, judging that the result is negative.
If the second threshold value N is the time threshold value TMFurther judging whether the time from the current point to the starting point reaches the time threshold value T or notMIf yes, judging that the result is yes; otherwise T is less than TMIf so, judging that the result is negative.
If the second threshold value N is the distance threshold value LMThen further judgeWhether the distance from the current point to the starting point reaches the distance threshold value L or notMIf yes, judging that the result is yes; otherwise L < LMIf so, judging that the result is negative.
Preferably, the fitting optimization mode is obtained according to Bezier curve algorithm fitting optimization. The Bezier curve has the advantages that the simulation degree is higher, and burrs and sharp inflection points with high distortion degree generated by shaking in the drawing process can be effectively removed. The line segment after fitting optimization is solidified, so that the excessively low operation speed caused by excessively long operation time in a complicated calculation process can be shortened. The mode of sectional drawing, calculation, fitting optimization and curing of the line segment is an incremental storage mode, and the storage mode greatly improves the operation speed.
In summary, the method and the device for identifying an object based on an infrared screen provided by the invention creatively provide that the outline of a touch object is obtained by controlling the infrared transmitting tube and the infrared receiving tube at each moment, and the infrared screen can accurately display the outline of the object; connecting the outlines of the touch objects at each moment, so that the dynamic objects with the accurate outlines can be displayed on an infrared screen; moreover, the method also provides that the identification result of the object outline or/and motion process is optimized, so that the identification result is more accurate and effective; meanwhile, the invention creatively provides a specific implementation mode aiming at the dynamic motion process of the soft touch object; therefore, the infrared screen-based object identification method and device can be suitable for any soft or hard touch object; finally, the whole object identification method and device based on the infrared screen are simple, convenient and compact and are easy to realize.
Those of ordinary skill in the art will understand that: the invention is not to be considered as limited to the specific embodiments thereof, but is to be understood as being modified in all respects, all changes and equivalents that come within the spirit and scope of the invention.