A method and device for infrared touch screen lamp layout based on Bresenham algorithm

By optimizing the layout of infrared touch screen lamps through the Bresenham algorithm, the problem of low touch accuracy of large-size infrared touch screens is solved, and a high-precision and low-cost design is achieved with a limited number of lamps.

CN116306460BActive Publication Date: 2025-09-09XIAMEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310231169.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-10
Publication Date
2025-09-09
Estimated Expiration
2043-03-10

AI Technical Summary

Technical Problem

Existing infrared touch screens have low touch accuracy in large-scale applications, which cannot be solved by unlimitedly increasing the number of lamps. It is limited by factors such as cost, scanning method and component packaging.

Method used

The Bresenham algorithm is used to rasterize the infrared model, and the optimal layout of the lamp is calculated through the objective function to ensure that the number and angle of infrared rays meet the touch accuracy requirements and optimize the lamp layout.

Benefits of technology

Under the condition of a given number of lamp tubes, the touch accuracy of the touch screen is improved, the manufacturing cost is reduced, and a better touch response effect is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116306460B_ABST
    Figure CN116306460B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of infrared touch screens and provides a method and device for arranging lamp tubes of an infrared touch screen based on a Bresenham algorithm. The method comprises the following steps: constructing an infrared touch screen window; acquiring lamp tube data and arranging the lamp tubes; determining candidate positions of the lamp tubes and constructing an infrared model; performing rasterization processing on the infrared model by using the Bresenham algorithm; calculating significance values ​​of the candidate positions by using an objective function; traversing all candidate positions and comparing them to determine a final arrangement position. The method provides a lamp tube layout method for an infrared touch screen based on the Bresenham algorithm. The method acquires initial infrared touch screen data and limited lamp tube data, constructs an infrared model, then performs rasterization processing on the infrared rays by using the Bresenham algorithm, and finally calculates the final arrangement position by using the objective function. When the number of lamp tubes is given, the optimal arrangement position of each lamp tube is selected so that the touch accuracy of the touch screen is maximized, thereby achieving low manufacturing cost and high accuracy of the touch screen and having good application value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of infrared touch screens, and in particular to a method and device for arranging lamp tubes of an infrared touch screen based on a Bresenham algorithm. Background Art

[0002] Touch screens are widely used across various industries. Large-size touch screens are primarily used in educational whiteboards used in schools, various all-in-one gaming touch-display devices, and modern touchscreen TVs in homes. Small-size touch screens are primarily used in mobile phones and tablets, which are now in almost everyone's hands. Currently, there are four main types of touch screens on the market: capacitive, resistive, ultrasonic, and infrared. Small-size touch screens primarily use capacitive and resistive screens. However, when it comes to large-size touch screens, capacitive and resistive screens are no longer suitable for these applications. First, the production cost increases significantly, and second, they only support specific touch surfaces such as the human body or a capacitive stylus, resulting in certain limitations. Infrared touch screens, on the other hand, can increase the screen size in large applications by only increasing the cost of the surrounding infrared transmitters and receivers. Furthermore, they can be touched by any touch surface. Their low cost and wide application have enabled infrared screens to gain a significant market share in the large-size touch screen market.

[0003] The sparser the optical grid between the infrared tube arrays, the larger the grid size, and the lower the infrared touchscreen's accuracy. Therefore, to improve infrared touchscreen accuracy, the density of the optical grid array should theoretically be increased. A common solution to this problem in existing technology is to increase the density of the infrared tube array, increasing the number of infrared tubes on the infrared touchscreen's border. However, in actual designs, the number of infrared tubes is affected by many factors, including product cost, the infrared touchscreen's scanning method, scanning time, and component packaging. Therefore, touch accuracy cannot be improved by simply increasing the number of tubes. Summary of the Invention

[0004] To address the problem of low touch screen accuracy caused by the limited number of lamp tubes in the above-mentioned prior art, the present invention provides an infrared touch screen lamp tube layout method based on the Bresenham algorithm. When the number of lamp tubes is given, how to select the position of each lamp tube to achieve the best touch accuracy of the touch screen.

[0005] A method for arranging lamp tubes for an infrared touch screen based on a Bresenham algorithm, wherein the lamp tubes include infrared emitting tubes and infrared receiving tubes, and wherein the method comprises: constructing a window for simulating an infrared touch screen; obtaining lamp tube data, and simulating the arrangement of the lamp tubes in the window according to the lamp tube data; determining candidate positions of the infrared emitting tubes and the infrared receiving tubes, and constructing an infrared model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube; rasterizing the infrared model using the Bresenham algorithm to obtain a plurality of grids, and counting the number of infrared rays passing through each grid; calculating the significance value of the candidate position using an objective function based on the counted number of infrared rays passing through each grid; traversing all candidate positions and comparing the significance values ​​of all candidate positions, wherein the candidate position with the largest significance value is determined as the final arrangement position of the current infrared emitting tube or infrared receiving tube; repeating the above steps and alternately determining the final arrangement positions of the infrared emitting tubes and the infrared receiving tubes until the final arrangement positions of all infrared emitting tubes and the infrared receiving tubes are determined.

[0006] In one embodiment, obtaining the lamp data includes obtaining the number of infrared emitting tubes and infrared receiving tubes, determining the layout of the infrared emitting tubes and infrared receiving tubes, and determining the angle requirement for generating infrared rays between the infrared emitting tubes and the infrared receiving tubes.

[0007] In one embodiment, the infrared rays generated between the infrared emitting tube and the infrared receiving tube must satisfy both an emission angle and a receiving angle that are less than or equal to 60°.

[0008] In one embodiment, the steps of calculating the significance value of the candidate position using the objective function based on the statistical number of infrared rays passing through each grid are as follows: calculating the significance value of a grid based on the number of infrared rays in the grid; calculating the significance value of each infrared ray based on the significance value of the grid, wherein the significance value of an infrared ray is the sum of the significance values ​​of all grids passing through the infrared ray; calculating the significance value of the candidate position based on the significance value of the infrared ray, wherein the significance value of an candidate position is the sum of the significance values ​​of all infrared rays emitted or received by the candidate position.

[0009] In one embodiment, the grid divides 180° into n equal regions. The significance formula of the grid is:

[0010]

[0011] Sg represents the significance value of each grid; a1 represents the original infrared angle in the current grid. The number of infrared rays; a2 represents the original infrared angle in the current grid The amount of infrared rays; a n Indicates that the original infrared angle in the current grid belongs to The amount of infrared rays.

[0012] In one embodiment, the step of calculating the significance value of the candidate position according to the significance value of the infrared ray includes:

[0013] Assuming that each infrared ray passes through k grids, the significance value of an infrared ray is expressed as:

[0014]

[0015] Among them, sg i Indicates the significance value of the i-th grid;

[0016] Assuming that each candidate position can generate j infrared rays, the significance value of the candidate position is expressed as

[0017]

[0018] Among them, line i Indicates the significance value of the i-th candidate position;

[0019] The design program calculates the significance values ​​of all candidate positions, and determines the candidate position with the largest significance value after comparison. This candidate position is determined as the final layout position of the infrared transmitting tube or infrared receiving tube. Assuming that the quantity of the candidate position is t, the objective function is as follows:

[0020] max postion i i∈(1,t)

[0021] Among them, postion i Indicates the significance value of the i-th candidate position.

[0022] In one embodiment, the distance between adjacent infrared receiving lamps or infrared emitting lamps is greater than or equal to 5 mm.

[0023] The present invention also provides an infrared touch screen lamp tube layout device based on the Bresenham algorithm, the lamp tubes including infrared emitting tubes and infrared receiving tubes, and is characterized in that: it includes a window construction module, which constructs a window for simulating an infrared touch screen; a data acquisition module, which acquires lamp tube data and simulates the layout of the lamp tubes in the window according to the lamp tube data; an infrared model construction module, which determines the alternative positions of the infrared emitting tubes and the infrared receiving tubes, and constructs an infrared model formed by the infrared rays emitted by each infrared emitting tube to the infrared receiving tube; an algorithm module, which uses the Bresenham algorithm to rasterize the infrared model to obtain a plurality of grids, and counts the number of infrared rays passing through each grid; an objective function calculation module, which uses the objective function to calculate the significance value of the alternative position according to the counted number of infrared rays passing through each grid; a comparison and analysis module, which traverses all alternative positions and compares the significance values ​​of all alternatives, wherein the alternative position with the largest significance value is determined as the final layout position of the current infrared emitting tube or infrared receiving tube.

[0024] The present invention also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implements the infrared touch screen lamp tube layout method based on the Bresenham algorithm as described above.

[0025] The present invention also provides an electronic device, comprising at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the processor to execute an infrared touch screen lamp tube layout method based on the Bresenham algorithm as described in any of the above items.

[0026] Based on the above, compared with the existing technology, the present invention provides an infrared touch screen lamp tube layout method based on the Bresenham algorithm, which obtains initial infrared touch screen data and limited lamp tube data, constructs an infrared model, then uses the Bresenham algorithm to rasterize the infrared rays, and then uses the objective function to calculate the final layout position. When the number of lamp tubes is given, the optimal layout position of each lamp tube is selected to achieve the best touch accuracy of the touch screen, so that the touch screen manufacturing cost is low and the precision is high, and it has good application value.

[0027] Other features and beneficial effects of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The objectives and other beneficial effects of the present invention can be achieved and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work. The positional relationships described in the drawings in the following description are based on the directions of the components drawn in the diagrams, unless otherwise specified.

[0029] Figure 1 A flowchart of a method for arranging lamp tubes on an infrared touch screen based on the Bresenham algorithm according to an embodiment of the present invention;

[0030] Figure 2 Schematic diagram of the whole-edge receiving and distributing arrangement in one embodiment of the present invention;

[0031] Figure 3 This is a schematic diagram of the relationship between the infrared transmitting tube, infrared receiving tube and infrared rays;

[0032] Figure 4 This is a schematic diagram of the infrared model;

[0033] Figure 5 It is a schematic diagram of infrared rays in coordinates;

[0034] Figure 6 Schematic diagram of using Bresenham algorithm to process infrared rays;

[0035] Figure 7 This is a schematic diagram after processing an infrared ray using the Bresenham algorithm;

[0036] Figure 8 To use Bresenham algorithm Figure 4 Schematic diagram after mid-infrared;

[0037] Figure 9 Schematic diagram of touch points;

[0038] Figure 10 A schematic diagram of connecting an infrared emitting tube to infrared receiving tubes at all alternative positions;

[0039] Figure 11 This is a schematic diagram of infrared rays generated by only one infrared emitting tube and one infrared receiving tube in the window;

[0040] Figure 12 A schematic diagram of connecting two infrared emitting tubes to infrared receiving tubes at all alternative positions;

[0041] Figure 13 This is a schematic diagram of the infrared rays generated after the positions of all lamps are determined. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments; the technical features designed in different implementation modes of the present invention described below can be combined with each other as long as they do not conflict with each other; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0043] In the description of the present invention, it should be noted that all terms used in the present invention (including technical terms and scientific terms) have the same meanings as those generally understood by ordinary technicians in the field to which the present invention belongs, and should not be understood as limiting the present invention; it should be further understood that the terms used in the present invention should be understood to have meanings consistent with the meanings of these terms in the context of this specification and in the relevant fields, and should not be understood in an idealized or overly formal sense, unless explicitly defined as such in the present invention.

[0044] refer to Figure 1 , which is a flow chart of a method for arranging lamp tubes for an infrared touch screen based on a Bresenham algorithm provided by an embodiment of the present invention, wherein the lamp tubes include an infrared transmitting tube and an infrared receiving tube, and the method includes:

[0045] Build a window to simulate an infrared touch screen;

[0046] Obtain lamp data and simulate the placement of lamps in the window based on the lamp data;

[0047] Determine candidate positions of infrared emitting tubes and infrared receiving tubes, and construct an infrared model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube;

[0048] The infrared model is rasterized using the Bresenham algorithm to obtain several grids, and the number of infrared rays passing through each grid is counted.

[0049] The significance value of the candidate position is calculated using the objective function according to the number of infrared rays passing through each grid;

[0050] Traversing all candidate positions and comparing the significance values ​​of all candidates, wherein the candidate position with the largest significance value is determined as the final layout position of the current infrared transmitting tube or infrared receiving tube;

[0051] Repeat the above steps and alternately determine the final layout positions of the infrared emitting tubes and the infrared receiving tubes until the final layout positions of all the infrared emitting tubes and the infrared receiving tubes are determined.

[0052] In specific implementation, constructing a window for simulating an infrared touch screen requires obtaining the length and width data of the touch screen. According to the length and width data of the real touch screen, an infrared touch screen window is simulated on a smart device, which can be a computer, mobile phone, etc.

[0053] Acquiring lamp data, and arranging the lamps in the window according to the lamp data;

[0054] Acquiring the lamp data includes acquiring the number of infrared emitting tubes and infrared receiving tubes, determining the layout of the infrared emitting tubes and the infrared receiving tubes, and determining the angle requirement for generating infrared rays between the infrared emitting tubes and the infrared receiving tubes.

[0055] It should be noted that the minimum number of light tubes must meet the requirements of the screen.

[0056] Determine candidate positions of infrared emitting tubes and infrared receiving tubes, and construct an infrared model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube;

[0057] The overall layout of infrared emitting tubes and infrared receiving tubes in infrared touch screens mainly includes two types: full-edge transmission and reception and alternating transmission and reception. The tubes are arranged on the four sides of the screen. Full-edge transmission and reception means that there is only one type of tube on one side of the screen, and the opposite side has a different type of tube. Figure 2 As shown, the infrared emitting tube is placed on the top, the infrared receiving tube is placed on the bottom, the infrared emitting tube is placed on the right, and the infrared receiving tube is placed on the left. Figure 2 and Figure 3 In the figure, the square symbol represents an infrared transmitter, and the meter symbol represents an infrared receiver. Alternating transmission and reception means that each of the four sides of the screen contains two types of lamps. Preferably, the present invention adopts an overall layout of full-edge transmission and reception.

[0058] Ideally, the lamps should be spaced apart in a way that's not too close together. A minimum spacing of 5mm is recommended. Additionally, allow for a margin during hardware installation. The two outermost lamps should be 18mm away from the screen edge. To facilitate subsequent installation measurements, the coordinates of each lamp should be rounded to millimeters.

[0059] The relationship between the lamp and infrared rays is as follows Figure 3 shown. Figure 3The lamp shown in the figure has an emission angle of 60° and a receiving angle of 60°. One end of the infrared ray is the infrared emitting tube, and the other end is the infrared receiving tube. If an infrared ray satisfies both the emission angle and the receiving angle, then when the device is powered on, the infrared ray is real. Based on this principle, a mathematical model can be established to find the mathematical relationship between the infrared tube layout and the infrared grid, and then it can be displayed graphically, as shown in the following example: Figure 4 shown.

[0060] It should be noted that the emission and receiving angles here are not limited to being less than 60° and can also be greater than 60°, but choosing 60° has two good effects. First, a 60-degree angle is relatively large, and more infrared rays can be emitted and received. However, if it exceeds 60°, using a larger emission and receiving angle, the infrared receiving tube will receive more infrared rays. However, in terms of response speed, the more infrared rays, the slower the touch response speed. If you need to increase the response speed, you need to customize the touch screen, infrared emission tube, infrared receiving tube and other equipment with specific response speeds, which will be more expensive. Therefore, the amount of infrared rays cannot be increased indefinitely. The amount of infrared rays generated by the 60-degree lamp is relatively moderate, and the touch response speed also meets the requirements.

[0061] Determine candidate positions of infrared emitting tubes and infrared receiving tubes, and construct an infrared model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube;

[0062] First, determine the position of the first infrared emitting tube. Since there are no lamps in the infrared touch screen at this time, the position of the infrared emitting tube can be determined arbitrarily. Then determine the position of the first infrared receiving tube. After the positions of the first infrared emitting tube and the infrared receiving tube are determined, there is only one infrared ray emitted by the infrared emitting tube to the infrared receiving tube. Next, determine the positions of the second infrared emitting tube and the second infrared receiving tube, and set all their optional alternative positions. Then determine the infrared model formed by the infrared emitting tube emitting infrared rays to the infrared receiving tube at each alternative position. At this time, there are two infrared emitting tubes and two infrared receiving tubes. If the conditions for infrared ray generation are met, one receiving tube can receive the infrared rays emitted by the two emitting tubes. At this time, an infrared model is formed based on the multiple infrared rays generated. Different alternative positions will produce different infrared models. Since the alternative position is not limited to one, there may be multiple, and similarly, multiple infrared models will be generated.

[0063] Next, the infrared model is rasterized using the Bresenham algorithm to obtain a plurality of grids, and the number of infrared rays passing through each grid is counted;

[0064] When the infrared model is rasterized using the Bresenham algorithm, a simulated coordinate system can be established in the simulated infrared touch screen window to concretize the mapping of the Bresenham algorithm processing process and the position of the alternative position in the window for subsequent calculations; the lower left corner is regarded as the coordinate origin, and the position coordinates of the remaining three vertices are obtained in sequence; the rectangular area is the touch area, the infrared emitting tube and the infrared receiving tube placement area are the four sides of the rectangle, and each infrared ray is represented by the coordinates of the infrared emitting tube and the infrared receiving tube at both ends.

[0065] Infrared light has an infrared transmitter at one end and an infrared receiver at the other. Based on the coordinate information of the infrared transmitter and receiver, the infrared light can be viewed as a two-point line segment. The Bresenham algorithm can split any infrared light into countless points. By categorizing all coordinate data into millimeters, the infrared light is broken down into a series of integer points. A grid matrix the same size as the touch area is then constructed, with the number of rows corresponding to the y-coordinate values ​​of the points, and the number of columns corresponding to the x-coordinate values. This can be used to rasterize all infrared light, or to divide the entire screen into a matrix of countless small grids. Each element of the matrix represents a grid cell, storing all infrared light information passing through that location. These small grid cells can be 1mm*1mm, 2mm*2mm, or 6mm*6mm in size, depending on the desired accuracy. The grid size can be flexibly selected based on the required accuracy and is not limited here.

[0066] First, divide all the infrared rays on the screen into four categories: perpendicular to the x-axis, parallel to the x-axis, with a slope closer to the x-axis, and with a slope closer to the y-axis. Figure 5 You can know Figure 5 The line in the figure belongs to the third case and its slope is closer to the x-axis.

[0067] See the detailed processing process Figure 6 , the starting point is (x0, y0), the slope is k, we add one to x0 at each step, calculate the size of dy=k*(x0+1)-y0, if dy>0.5, then y0+1 at the same time as x0+1, if the condition is not met, then the second step coordinate is (x0+1, y0), each step, take the current point as the starting point to judge the condition of dy>0.5, so as to determine the position of the next step. This method can be imagined as walking up the stairs, each time moving in the east or northeast direction. Each coordinate point passed is a small grid. Taking this as an example, the straight lines in other cases can also be processed similarly, and the processing results are as follows Figure 7 shown.

[0068] Will Figure 4 The infrared rays in the image are all processed by Bresenham's line drawing method. Figure 8 As shown, the brightness of the grid on the screen is different. The brighter the color, the more infrared rays pass through, and the darker the color, the less infrared rays pass through.

[0069] Calculate the significance value of the candidate position using the objective function according to the number of infrared rays passing through each grid;

[0070] like Figure 9 As shown, when touching an infrared touch screen, the touch point can be viewed as a circle with a radius of 1mm. The center of the circle is the location of the touch object. The movement of the circle on the screen is considered the movement of the touch object, and the speed of the circle's movement corresponds to the touch object's movement rate. By calculating whether the distance between all lines in the model and the touch point is less than 1mm, we can determine which infrared rays are blocked by the touch object. With each step of the circle, the blocked infrared rays are selected as the simulation data for that frame. This simulation data provides the infrared rays blocked by each touch. The selected infrared rays are then combined pairwise to determine their intersection points. Intersection points outside the screen and intersection points with angles less than 60 degrees are excluded. The remaining intersection points are averaged, and the resulting coordinates are used as the calculated touch point coordinates for locating the touch point. This method achieves positioning accuracy within ±1mm. As shown above, when a finger touches any position on the screen, the following requirements must be met: ① The number of blocked infrared rays must be at least two. ② The angle of the blocked infrared rays must be at least 60 degrees. ③The above two requirements must be met at the same time.

[0071] If these requirements are not met, feedback indicates a disconnected touch path or unrecognized touch operation, making touch point location impossible. Based on this analysis, the layout method must be aligned with the required positioning conditions. To ensure that as many areas as possible meet the positioning requirements, an objective function is constructed to calculate the significance value. When the significance value is maximized, the lamp placement is optimal.

[0072] When constructing the objective function, the Bresenham algorithm is first used to obtain infrared information within any grid position. Taking the receiving tube as an example, when the lamp is placed in a certain candidate position, the number of transmitting tubes on the opposite side is checked. Combined with the angles of the infrared transmitting tube and the infrared receiving tube in the initial conditions, the number of infrared rays generated by this candidate position can be obtained. Each infrared ray is processed by the Bresenham algorithm. On the basis of the original, 180 degrees is divided into n angle areas. If the newly generated infrared ray causes the number of infrared rays in a certain angle area of ​​a grid to change from 0 to 1, the significance value is increased by 1; if it changes from 1 to 2, the significance value is increased by 1 / 2... If it changes from i to i+1, the significance value is increased by 1 / (i+1);

[0073] The formula for the significance value of the grid is:

[0074]

[0075] Sg represents the significance value of each grid; a1 represents the original infrared angle in the current grid. Similarly, a2 represents the original infrared angle in the current grid. The amount of infrared rays; a n Indicates that the original infrared angle in the current grid belongs to The amount of infrared rays;

[0076] Preferably, n is 4. When n is 4, it ensures that the infrared rays within the current grid come from all directions, which means that these infrared rays can intersect to determine the intersection point and calculate the touch point weight. If all the infrared rays in this grid are parallel and at the same angle, they cannot intersect to determine the touch point location, and the number of lines is meaningless. Alternatively, n can be 3, 4, or 6, as long as the angle distribution of the lines is relatively uniform. The choice can be made according to actual needs during implementation.

[0077] Assuming that each infrared ray can be divided into k grids, the formula for the significance value of an infrared ray is:

[0078]

[0079] Among them, sg i Indicates the significance value of the i-th grid;

[0080] Assuming that each candidate position can generate j infrared rays, the significance value of the candidate position is:

[0081]

[0082] Among them, line i Indicates the significance value of the i-th candidate position;

[0083] Traversing all candidate positions, comparing the significance values ​​of all the candidates, and determining the candidate position with the largest significance value as the final position of the infrared emitting tube or the infrared receiving tube;

[0084] The design program calculates the significance value of all candidate positions and finds the largest candidate position, which is determined as the final selected position. Assuming the number of candidate positions is t, the objective function is as follows:

[0085] maxpostion i i∈(1,t)

[0086] Among them, postion i Indicates the significance value of the i-th candidate position.

[0087] After traversing all the candidate positions for the infrared emitting tube and infrared receiving tube, the position of the first infrared emitting tube and infrared receiving tube is determined first. That is, the position of the first infrared emitting tube and infrared receiving tube is traversed among all the candidate positions. Initially, the screen is blank. The infrared light diffusion of the infrared emitting tube and infrared receiving tube is simulated for each alternative position. Then, the infrared light simulated for each alternative position is rasterized using the Bresenham algorithm. Based on the rasterized infrared light, the objective function is used to calculate the significance value of the infrared emitting tube and infrared receiving tube at the current optional coordinates. The coordinate with the largest significance value is selected as the coordinate of the first infrared emitting tube and infrared receiving tube. Then, the coordinate within 5mm of this coordinate is excluded, and the calculation of the second infrared emitting tube, the second infrared receiving tube, the third infrared emitting tube, and the third infrared receiving tube is continued in this order until the positions of all infrared emitting tubes and infrared receiving tubes are determined.

[0088] The advantage of this objective function is that it combines the touch effect of this layout with the number of grid cells that can be covered, and expresses it numerically. A larger significance value means that this arrangement can affect more grid cells, which means that more touch-unrecognizable areas can be turned into touch-recognizable areas, resulting in a better touch effect.

[0089] Evaluate the layout plan to determine whether adjustments are necessary.

[0090] By using the Bresenham algorithm to rasterize infrared light, we can obtain infrared information within each grid position on the screen. The information within each grid is then processed again. Based on the aforementioned conditions for touch point location, the Bresenham algorithm must first locate any position on the screen. This location must meet the following requirements: ① The number of blocked infrared rays must be greater than or equal to two. ② The angle of the blocked infrared rays must be greater than or equal to 60 degrees. A program is designed to check whether all grids meet these two conditions. If both conditions are met, the grid is assigned a value of 100; if not, the grid is assigned a value of 0. This process is referred to as binarization.

[0091] After binarizing the raster information, the layout scheme is evaluated based on image display and statistical data, including:

[0092] Image display: After binarization, the grid contains only two values: 0 and 100. 100 is displayed as bright yellow, and 0 is displayed as dark blue. You can intuitively see that the dark blue area is the touch blind area.

[0093] Statistics: Count the number of dark blue grids. If the result is 0, it means that the touch screen has no blind spots. If the result is between 0 and the preset value, it means that the touch screen has a small number of blind spots. If the result exceeds the preset value, it means that the touch screen has a large number of blind spots and the solution needs to be adjusted.

[0094] The embodiment of the present invention will cite a specific embodiment below to specifically illustrate the lamp tube layout method provided by the present invention. Specific embodiment:

[0096] This layout method is mainly divided into the following steps, which are implemented in the Matlab program:

[0097] Step 1: Obtain the initial conditions required for lamp layout, including:

[0098] The angle between the infrared emitting tube and the infrared receiving tube is 52°. The required number of tubes is: 62 infrared emitting tubes, 62 infrared receiving tubes, 38 long-side tubes, and 24 wide-side tubes. The overall layout is for full-edge transmission and reception, with infrared emitting tubes on the top and infrared receiving tubes on the bottom, and infrared emitting tubes on the left and infrared receiving tubes on the right. The touch screen size is 281mm*481mm. The initial position coordinates of the first tube are SF(1,:) = (19,281). SF represents the infrared emitting tube on the top, and XJ represents the infrared receiving tube on the bottom.

[0099] The layout of the entire screen is divided into two modules. The first module is the layout of the upper and lower light tubes, and the second module is the layout of the left and right light tubes. The layout process of the two modules is the same, and here we only introduce the layout process of the upper and lower light tubes in detail.

[0100] According to the touch screen size of 281mm*481mm, the optional range of the lamp is obtained: the layout range of the infrared emitting tube has an x ​​value of 24:463; the y value is 281 and remains unchanged. This range is called the infrared emitting tube optional area. Similarly, the layout range of the infrared receiving tube has an x ​​value of 19:463; the y value is 1 and remains unchanged. This range is called the infrared receiving tube optional area.

[0101] Step 2: Based on the initial information, the currently determined lamp coordinates only have one infrared transmitter. Since there is no infrared light on the screen, we begin to find the optimal infrared receiver placement within the available layout range.

[0102] Step 3: Figure 10 As shown, when there is only one determined infrared emitting tube, when the first infrared receiving tube needs to be determined, a schematic diagram of connecting this infrared emitting tube with the infrared receiving tubes in all optional layout areas is provided.

[0103] Step 4: Since there is no infrared light on the screen before, we divide 180 degrees into 4 equal angle areas and use the empty initial grid to calculate the significance value generated by infrared light at each optional position.

[0104] The formula for the significance value of the grid is:

[0105]

[0106] Sg represents the significance value of each grid; a1 represents the number of infrared rays with an original infrared angle of 0° to 45° in the current grid; similarly, a2 represents the number of infrared rays with an original infrared angle of 45° to 90° in the current grid; a3 represents the number of infrared rays with an original infrared angle of 90° to 135° in the current grid; a4 represents the number of infrared rays with an original infrared angle of 135° to 180° in the current grid;

[0107] Assuming that each infrared ray can be divided into k grids, the formula for the significance of an infrared ray is:

[0108]

[0109] Among them, sg i Indicates the significance value of the i-th grid;

[0110] Assuming that each candidate position can generate j infrared rays, the significance value of the candidate position is:

[0111]

[0112] Among them, line i Indicates the significance value of the i-th candidate position;

[0113] The design program calculates the significance value of all candidate positions and finds the largest candidate position, which is determined as the final selected position. Assuming the number of candidate positions is t, the objective function is as follows:

[0114] maxpostion i i∈(1,t)

[0115] Among them, postion i Indicates the significance value of the i-th candidate position.

[0116] Step 5: Select the final layout position of the first infrared receiving tube based on the significance value result.

[0117] Since the layout has just begun, each alternative position of the infrared receiving tube and the determined position of the infrared transmitting tube are connected by an infrared line, and both turn an empty grid into a grid with a line. We substitute the formula and get the significance value of each optional position is 281. When the maximum significance values ​​are the same, take the first optional position with the maximum significance value, that is, XJ(:, 1) = (19, 1).

[0118] Step 6: Select the infrared receiving tube and erase this position from the set of alternative positions, including the optional positions 5mm to the left and right of this position.

[0119] Step 7: Now we have a definite transmitting tube and a definite receiving tube, and there is a definite infrared ray on the screen, such as Figure 11 , and the infrared rays are rasterized and used as the initial raster map for calculating the significance value.

[0120] Step 8: Based on the existing value, calculate the significance value to find the layout position of the second infrared transmitting tube. The process is similar to that of finding the first infrared receiving tube. The calculation result is SF(:, 2) = (90, 281).

[0121] Step 9: There are currently two infrared emitting tubes and one infrared receiving tube. You need to find another infrared receiving tube and connect the optional area with the known tube to calculate the significance value again. This time the significance value calculation tends to be more complicated. Some areas can generate two infrared rays and some areas can generate one infrared ray. Figure 12 .

[0122] Step 10: Figure 13 The figure shows a grid diagram when 24 infrared emitting tubes and 24 infrared receiving tubes are laid out. The brighter the color, the more infrared rays there are in the current grid, and the darker the color, the fewer infrared rays there are passing through the current grid.

[0123] Step 11: When the number of found tubes equals the required number of tubes, the program exits the loop. The coordinates of the infrared transmitter and receiver tubes found are the final layout plan.

[0124] The advantage of this method is that once the initial conditions are given, the program can automatically derive an optimal layout solution. Compared with traditional layout, it is more efficient and does not require repeated adjustments based on subsequent evaluation results.

[0125] Finally, it should be noted that the present invention can also use an infrared lamp tube layout method that alternates between transmitting and receiving. The only difference from the entire side transmitting and receiving is that the lamp tube layout method that alternates between transmitting and receiving can first determine an infrared transmitting tube, then determine the infrared receiving tube on the same side, and then determine the infrared transmitting tube and infrared receiving tube on the opposite side, and so on. The other principles are the same as the entire side transmitting and receiving lamp tube layout method.

[0126] The present invention also provides an infrared touch screen lamp tube layout device based on the Bresenham algorithm, comprising a window construction module for constructing a window for simulating an infrared touch screen; a data acquisition module for acquiring lamp tube data and arranging the lamp tubes in the window according to the lamp tube data; an infrared model construction module for determining alternative positions of infrared emitting tubes and infrared receiving tubes, and constructing an infrared model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube; an algorithm module for rasterizing the infrared model using the Bresenham algorithm to obtain a plurality of grids, and counting the number of infrared rays passing through each grid; an objective function calculation module for calculating the significance value of the alternative position using an objective function based on the counted number of infrared rays passing through each grid and a pre-set alternative position; and a comparison and analysis module for traversing all alternative positions and comparing the significance values ​​of all alternatives, wherein the alternative position with the largest significance value is determined as the final position of the infrared emitting tube or the infrared receiving tube.

[0127] The present invention also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by a processor, any of the above-mentioned infrared touch screen lamp tube layout methods based on the Bresenham algorithm can be implemented.

[0128] In specific implementation, the computer-readable storage medium is a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (HDD) or a solid-state drive (SSD), etc.; the computer-readable storage medium may also include a combination of the above types of memory.

[0129] The present invention also provides an electronic device, comprising at least one processor and a memory communicatively connected to the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the processor executes an infrared touch screen lamp tube layout method based on the Bresenham algorithm as described in any of the above items.

[0130] In a specific implementation, the number of processors may be one or more, and the processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips. The general-purpose processor may be a microprocessor or any conventional processor.

[0131] The memory and the processor can be communicatively connected via a bus or other means. The memory stores instructions that can be executed by at least one processor. The instructions are executed by at least one processor to enable the processor to execute an infrared touch screen lamp tube layout method based on the Bresenham algorithm as described in any of the above items.

[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for arranging infrared touch screen lamp tubes based on the Bresenham algorithm, wherein the lamp tubes include an infrared transmitting tube and an infrared receiving tube, characterized in that: include Build a window to simulate an infrared touch screen; Acquiring lamp data, and simulating the placement of lamps in the window according to the lamp data; Determining candidate positions of the infrared emitting tube and the infrared receiving tube, and constructing an infrared ray model formed by infrared rays emitted by each infrared emitting tube to the infrared receiving tube; Using the Bresenham algorithm to perform rasterization processing on the infrared model to obtain a plurality of grids, and counting the number of infrared rays passing through each grid; The step of rasterizing the infrared model to obtain a plurality of grids comprises the following steps: All infrared rays are divided into four situations: perpendicular to the x-axis, parallel to the x-axis, with a slope closer to the x-axis, and with a slope closer to the y-axis; the starting point is (x0, y0), and the slope is k. Then, for each step, x0 is incremented by one, and dy=k*(x0+1)-y0 is calculated. If dy>0.5, y0+1 is incremented at the same time as x0+1. If the condition is not met, the second step coordinate is (x0+1, y0). For each step, the current point is used as the starting point to determine the condition of dy>0.5, thereby determining the next step position. Each coordinate point passed through is a small grid. Calculate the significance value of the candidate position using an objective function according to the number of infrared rays passing through each grid; Traversing all candidate positions and comparing the significance values ​​of all the candidates, wherein the candidate position with the largest significance value is determined as the final arrangement position of the current infrared emitting tube or the infrared receiving tube; Repeat the above steps and alternately determine the final layout positions of the infrared emitting tubes and the infrared receiving tubes until the final layout positions of all the infrared emitting tubes and the infrared receiving tubes are determined; The steps of calculating the significance value of the candidate position using the objective function according to the statistical number of infrared rays passing through each grid are as follows: Calculating the significance value of a grid according to the amount of infrared rays in the grid; Calculate the significance value of each infrared ray according to the significance value of the grid, wherein the significance value of an infrared ray is the sum of the significance values ​​of all grids passing through the infrared ray; Calculating the significance value of the candidate position according to the significance value of the infrared rays, wherein the significance value of a candidate position is the sum of the significance values ​​of all infrared rays emitted or received by the candidate position; Divide the infrared angle into n areas of 180°; The formula for the significance value of the grid is: Sg represents the significance value of each grid; Indicates that the original infrared angle in the current grid is 0°~ The amount of infrared rays; Indicates that the original infrared angle in the current grid belongs to ~ The amount of infrared rays; Indicates that the original infrared angle in the current grid belongs to The amount of infrared light is ~180°.

2. The infrared touch screen lamp tube layout method based on the Bresenham algorithm according to claim 1, characterized in that: Acquiring the lamp data includes acquiring the number of the infrared emitting tubes and the infrared receiving tubes, determining the layout of the infrared emitting tubes and the infrared receiving tubes, and determining the angle requirement for generating the infrared rays between the infrared emitting tubes and the infrared receiving tubes.

3. The infrared touch screen lamp tube layout method based on the Bresenham algorithm according to claim 2, characterized in that: The infrared rays generated between the infrared emitting tube and the infrared receiving tube must simultaneously satisfy an emission angle and a receiving angle that are less than or equal to 60°.

4. The infrared touch screen lamp tube layout method based on Bresenham algorithm according to claim 1, characterized in that: The step of calculating the significance value of the candidate position according to the significance value of the infrared ray comprises: Assuming that each infrared ray passes through k grids, the significance value of an infrared ray is Expressed as: in, Indicates the significance value of the i-th grid; Assuming that each candidate position can generate j infrared rays, the significance value of the candidate position is expressed as in, Indicates the significance value of the i-th candidate position; Calculate the significance values ​​of all candidate positions, compare and determine the candidate position with the maximum significance value. This candidate position is determined as the final layout position of the infrared transmitting tube or infrared receiving tube. Assuming that the number of candidate positions is t, the objective function is as follows: in, Indicates the significance value of the i-th candidate position.

5. The infrared touch screen lamp tube layout method based on the Bresenham algorithm according to claim 4, characterized in that: The distance between adjacent infrared receiving lamps or infrared emitting lamps is greater than or equal to 5 mm.

6. A device for arranging infrared touch screen lamp tubes based on the Bresenham algorithm, employing the method for arranging infrared touch screen lamp tubes based on the Bresenham algorithm according to any one of claims 1 to 5, wherein the lamp tubes include infrared transmitting tubes and infrared receiving tubes, and are characterized in that: Window construction module, which constructs a window for simulating an infrared touch screen; A data acquisition module, which acquires lamp data and simulates the arrangement of lamps in the window according to the lamp data; an infrared model building module, which determines candidate positions of the infrared emitting tube and the infrared receiving tube, and builds an infrared model formed by the infrared rays emitted by each of the infrared emitting tubes to the infrared receiving tube; an algorithm module, which uses a Bresenham algorithm to perform a gridding process on the infrared model to obtain a plurality of grids, and counts the number of infrared rays passing through each grid; An objective function calculation module, which uses an objective function to calculate the significance value of the candidate position according to the number of infrared rays passing through each grid; The comparison and analysis module traverses all candidate positions and compares the significance values ​​of all the candidates, wherein the candidate position with the largest significance value is determined as the final layout position of the current infrared emitting tube or the infrared receiving tube.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium contains computer instructions, and when the computer is executed by a processor, the computer implements the infrared touch screen lamp tube layout method based on the Bresenham algorithm as described in any one of claims 1 to 5.

8. An electronic device, characterized in that: The invention comprises at least one processor and a memory in communication with the processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the processor executes the infrared touch screen lamp tube layout method based on the Bresenham algorithm as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Implementation method from 3D sparse point cloud to 2D grid map based on VSLAM

    CN110675307A

  • Infrared touch screen lamp tube layout detection method and related device

    CN114201790A