Method for detecting upper contact of infrared touch screen
Technical Field
The invention relates to the field of infrared touch screens, in particular to a method for detecting a contact on an infrared touch screen.
Background
Touch technology has been widely used in recent years as an intuitive, fast and convenient man-machine interaction mode. The infrared touch screen becomes the first choice for designing a large-size touch screen due to the advantages of low cost, long service life and the like. However, in large-size applications, a large number of infrared transceiving sensors are used, and each transmitting sensor can transmit light in multiple directions, which causes an excessive calculation amount, and if the infrared transceiving sensors are sparsely arranged to reduce the calculation amount, the edge contact detection accuracy is insufficient. In consideration of the two difficulties, the invention designs a new array arrangement mode of the infrared transceiving sensors, provides a claw-shaped algorithm for contact detection, and ensures higher precision of edge contact detection while reducing the calculated amount.
Disclosure of Invention
The invention aims to provide a novel method for detecting contacts on an infrared touch screen, which reduces the calculated amount and ensures higher edge contact detection precision.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a method for detecting a contact on an infrared touch screen is characterized by comprising the following steps:
(1) transmitting and receiving sensor array arranged around infrared touch screen
Emitting sensor is placed on two adjacent limits on the infrared touch screen, and corresponding receiving sensor is placed on two other adjacent limits, and a set of receiving and dispatching sensor sequence includes an infrared emitting sensor and a set of infrared receiving sensor, and a set of infrared receiving sensor's number N is 5 ~ 8 (N increases along with the increase of the infrared touch screen size of using), arranges according to certain rule interval: one infrared receiving sensor is over against the infrared transmitting sensor in the group, the other infrared receiving sensors are arranged at intervals, and the interval angle theta satisfies the following formula:
wherein L is the length of the sensor, W is the length of the short side of the infrared touch screen, L is the length of the long side of the infrared touch screen, and the number N' of the sensors at intervals in a group of receiving sensor sequences is calculated according to the angle theta;
(2) the receiving and transmitting sensor array scans the contact to acquire state information;
(3) the method adopts a claw type algorithm to process the received state information and comprises the following steps:
1) checking the infrared light receiving state of a group of infrared receiving sensors in each group of transceiving sensor sequence, recording the number of the infrared receiving sensors in the state of not receiving infrared light and the number of the infrared transmitting sensors corresponding to the infrared receiving sensors in the group in pairs, and calculating an equation of a connecting line between the infrared receiving sensors and the infrared transmitting sensors;
2) selecting a connecting line in the vertical direction and the horizontal direction, calculating an initial region boundary line, and calculating a cross region formed by the initial region boundary line as an initial region where a contact may exist;
3) selecting connecting lines except the horizontal connecting line in the left and right directions, namely transverse inclined connecting lines, sequentially comparing the connecting lines with each initial region, if the connecting lines are intersected with each other, adding 1 to the transverse zone bit of the initial region, and accumulating the transverse zone bits of the initial region after the comparison is finished;
4) selecting connecting lines except the vertical connecting line in the vertical direction, namely longitudinal inclined connecting lines, sequentially comparing the connecting lines with each initial area, if the connecting lines are intersected with each other, adding 1 to the longitudinal zone bit of the initial area, and accumulating the longitudinal zone bits of the initial area after the comparison is finished;
5) and calculating the number of the touch points, judging whether the initial area is true or not according to the size of the zone bit of the initial area, and solving the centroid coordinate of the true area as the coordinate of the touch points.
The method for detecting the upper contact of the infrared touch screen is characterized in that in the step (3), the method for judging the boundary line of the initial area comprises the following steps:
1) one contact may intercept a vertical or horizontal connecting line corresponding to a single emission sensor, and a vertical or horizontal line corresponding to coordinates at two ends of the infrared emission sensor is taken as an initial region boundary line;
2) one contact point can also cut off a vertical or horizontal connecting line corresponding to two continuous infrared emission sensors, and a vertical or horizontal line corresponding to the midpoint coordinates of the two infrared emission sensors is taken as an initial area boundary line.
The method for detecting the touch point on the infrared touch screen is characterized in that in the step (3), the fact that the initial area is true means that the initial area is the area where the touch point is located, when n touch points are arranged on the infrared touch screen, the number of the initial areas obtained through calculation by a claw type algorithm is n, and the initial areas are arranged in n rows and n columns, so that the number of the touch points can be obtained by squaring the obtained number of the initial areas, whether the initial areas are true or not is judged according to the number of the touch points and the transverse and longitudinal mark bits corresponding to each initial area, and a calculation formula of the mark bit threshold is as follows:
flag1=2,flag2=N-1
if the horizontal flag bit and the vertical flag bit of an initial area both reach a threshold value flag2, the initial area is directly judged to be true; if both the horizontal flag bit and the vertical flag bit of an initial area do not reach the threshold value flag1, the initial area is directly judged to be false; and judging whether the rest initial regions are true or not according to the number of the contacts and the initial region condition judged as true: if the row or column in which the device is positioned has a 'true' initial region, the device is judged to be 'false'; if the sum of the horizontal flag bit and the vertical flag bit in the row and the column where the flag bit is located is maximum, the flag bit is judged to be true.
The invention has the following advantages:
compared with the traditional contact detection method with the continuously arranged receiving sensors, the method disclosed by the invention can greatly reduce the calculated amount while ensuring the detection precision in the aspect of large-size application, and meets the requirement of real-time high-precision infrared multi-point touch application.
Drawings
Fig. 1 shows the arrangement of the infrared transceiver sensor array according to the present invention.
Fig. 2 is a schematic diagram of an arrangement of a group of ir transceiving sensor sequences according to the present invention (N-5).
FIG. 3-1 is a schematic diagram of a method for determining an initial zone boundary line when a contact cuts off a corresponding connection line of an infrared emission sensor.
Fig. 3-2 is a schematic diagram of a method for judging the boundary line of the initial region when the contact cuts off the corresponding connecting line of the two emission sensors.
Fig. 4 is a schematic view of an initial region for forming contacts according to the present invention (the number of contacts n is 3).
Fig. 5 is a schematic overall flow chart of a method for detecting a touch point on an infrared touch screen according to the present invention.
The attached drawings indicate the following: the touch screen comprises an infrared touch screen a, an infrared emission sensor b, an infrared receiving sensor c, an initial region boundary line d, a contact point e and an initial region f.
Detailed Description
A method for detecting a contact on an infrared touch screen comprises the following steps:
(1) transmitting and receiving sensor array arranged around infrared touch screen
As shown in fig. 1, two adjacent sides on the infrared touch screen a place the transmitting sensor, and two adjacent sides place the corresponding receiving sensor, and a set of transceiver sensor sequence includes an infrared transmitting sensor b and a set of infrared receiving sensor c, and the number N of a set of infrared receiving sensor c is 5 ~ 8 (N increases along with the increase of the infrared touch screen size of using), arranges according to certain regular interval: one infrared receiving sensor c is over against the infrared transmitting sensor b in the group, the other infrared receiving sensors c are arranged at intervals, and the interval angle theta satisfies the following formula:
wherein L is the length of the sensor, W is the length of the short side of the infrared touch screen, L is the length of the long side of the infrared touch screen, and the number N' of the sensors at intervals in a group of receiving sensor sequences is calculated according to the angle theta; fig. 2 shows an arrangement of a group of infrared transceiving sensor sequences with N ═ 5 on a 21-inch infrared touch screen, where N ═ 4;
(2) the receiving and transmitting sensor array scans the contact to acquire state information;
(3) the received status information is processed by using a claw-type algorithm, as shown in fig. 5, and the processing is performed by the following steps:
1) checking the state that a group of infrared receiving sensors c in each group of transceiving sensor sequences receive infrared light, recording the number of the infrared receiving sensors c in the state that the infrared light is not received and the number of the infrared transmitting sensors b corresponding to the infrared receiving sensors c in the group in pairs, and calculating an equation of a connecting line between the infrared receiving sensors c and the infrared transmitting sensors b;
2) selecting a connecting line in the vertical direction and the horizontal direction, calculating an initial region boundary line d, and calculating a cross region formed by the initial region boundary line as an initial region f possibly existing in a contact e;
3) selecting connecting lines except the horizontal connecting line in the left and right directions, namely transverse inclined connecting lines, sequentially comparing the connecting lines with each initial region, if the connecting lines are intersected with each other, adding 1 to the transverse zone bit of the initial region, and accumulating the transverse zone bits of the initial region after the comparison is finished;
4) selecting connecting lines except the vertical connecting line in the vertical direction, namely longitudinal inclined connecting lines, sequentially comparing the connecting lines with each initial area, if the connecting lines are intersected with each other, adding 1 to the longitudinal zone bit of the initial area, and accumulating the longitudinal zone bits of the initial area after the comparison is finished;
5) and calculating the number of the contact points, judging whether the initial area is true or not according to the size of the zone bit of the initial area, and calculating the centroid coordinate of the true area as the coordinate of the contact point e.
In the step (3), the method for judging the boundary line of the initial region comprises the following steps:
1) as shown in fig. 3-1, a contact may intercept a vertical or horizontal connection line corresponding to a single emission sensor, and take a vertical or horizontal line corresponding to coordinates at both ends of the infrared emission sensor as an initial area boundary line;
2) as shown in fig. 3-2, one touch point may also intercept a vertical or horizontal connecting line corresponding to two consecutive ir-emitting sensors, and take the vertical or horizontal line corresponding to the midpoint coordinates of the two ir-emitting sensors as the initial area boundary line.
In step (3), the initial region being "true" means that the initial region is a region where the contact points are located, when n contact points are located on the infrared touch screen, the number of initial regions obtained by calculation by the claw type algorithm is n · n, and the initial regions are arranged in n rows and n columns, so that the number of contact points can be obtained by squaring the obtained number of initial regions, and whether the initial regions are "true" is determined according to the number of contact points and the horizontal and vertical flag bits corresponding to each initial region, as shown in fig. 4, the initial region schematic diagram is formed when the number of contact points n is 3. The calculation formula of the flag bit threshold is as follows:
flag1=2,flag2=N-1
if the horizontal flag bit and the vertical flag bit of an initial area both reach a threshold value flag2, the initial area is directly judged to be true; if both the horizontal flag bit and the vertical flag bit of an initial area do not reach the threshold value flag1, the initial area is directly judged to be false; and judging whether the rest initial regions are true or not according to the number of the contacts and the initial region condition judged as true: if the row or column in which the device is positioned has a 'true' initial region, the device is judged to be 'false'; if the sum of the horizontal flag bit and the vertical flag bit in the row and the column where the flag bit is located is maximum, the flag bit is judged to be true.