## 3 Overall System
### Visual Recognition System
#### 3.1.3 Intersection Point Recognition System
To eliminate redundant line segments and merge adjacent parallel lines, we identify parallel lines and calculate the distance between them. Based on these criteria, line segments are deduplicated and merged. For those segments that are parallel and close to each other, we extend or merge them by taking the midpoint of their endpoints, forming longer, continuous lines. The process of endpoint merging is determined by checking whether the distance between the endpoints is small enough to justify merging, thus generating a simpler and more accurate line representation. During the merging process, a vector-based approach is employed, treating line segments as vectors and directly calculating the weighted average of the endpoints for those lines that are similar in direction and position. This method reduces redundant midpoint calculations and efficiently generates the merged vector. Before merging the line segments, the following conditions must be satisfied:  
* Parallelism: The direction vectors of the two line segments should be approximately parallel. This is typically determined by calculating the angular difference between the segments or by evaluating the dot product of their direction vectors. * Proximity: The distance between the endpoints or midpoints of the two line segments should be within a certain threshold, ensuring that they are sufficiently close. A distance threshold can be set to determine whether the proximity condition is met. The specific calculation method is as follows. Assume that there are two line segments, \(L_{1}\) and \(L_{2}\). First, the direction vectors of each line segment are calculated, followed by computing the cosine of the angle between the vectors to determine if the two line segments are parallel. If \(\cos\theta\) is close to \(1\) or \(-1\) (within a small threshold), the two line segments are considered parallel. The proximity condition is determined by calculating the Euclidean distance between all pairs of endpoints from \(L_{1}\) and \(L_{2}\) and selecting the minimum distance  
Figure 7: Flowchart of the Probabilistic Hough Transform with hash table optimization. as the proximity measure. If the minimum distance \(d_{\text{min}}\) is smaller than the set proximity threshold, the two line segments are considered sufficiently close and eligible for merging. In this paper, a bidirectional projection method is used to merge two closely positioned line segments, as shown in Figure 8. The bidirectional projection method projects the endpoints of one line segment onto the direction of the other line segment, allowing for a more accurate determination of each segment's coverage along the other's direction. The bidirectional projection ensures that, even if the two line segments are not perfectly aligned, a reasonable merging area can still be identified, rather than relying solely on a single directional judgment. The projection \(P^{\prime}\) of any point \(P\) onto the line segment \(AB\) is given by Equation (6). \[P^{\prime}\mathcal{O}=\vec{A}\mathcal{O}+\frac{\vec{P}\vec{A}\cdot\vec{v_{1}} }{\|\vec{v_{1}}\|^{2}}\cdot\vec{v_{1}} \tag{6}\]  
By calculating the dot product of the vector from point \(P\) to point \(A\) with the direction vector \(\vec{v_{1}}\), the projection length onto the direction vector is obtained. This projection length is then multiplied by the direction vector to determine the position of the projected point \(P^{\prime}\). After the projection, the two projection points closest to the image boundary are selected to form a new line segment. The line segments in the image are detected using the Hough Transform. Each pair of line segments is then compared to ensure that they meet the angular criterion, avoiding the misidentification of parallel segments as intersections. For pairs that satisfy the angular condition, the line equations are computed and the intersection point is found by solving the system of equations.