(a) (b) (c)
Figure 11. Parameter Coordinate Clustering Analysis of Lines in Hough Space

2.3 Determine the optimal adaptive threshold by counting the number of votes

To ensure that there is no missed detection during Hough transform, it is necessary to detect straight lines at low voting thresholds. However, the detection results at low voting thresholds are often affected by interfering pixel points, resulting in the detection of many interfering straight lines. Under this premise, the straight line fitting results obtained by k-means clustering often have significant errors, and in extreme cases, the detection method may even fail. Based on the above situation, this article proposes a method for determining the optimal adaptive threshold . After the clustering analysis is completed, this method calculates the distribution of voting numbers, degree of dispersion, and the relationship between the mean and standard deviation of the calculated voting numbers of coordinate points in the parameter space. By observing the distribution of these data points, the optimal adaptive threshold is set. Specifically, the low threshold ensures that Hough transform does not miss detection, and k-means clustering is performed on the data points in the parameter space detected by the low threshold, ensuring that there are four straight lines in the fitting result. Calculate the mean and standard deviation of the number of straight line votes in the i-th cluster clustering results, and set. The value of is generally determined based on experimental conditions and is generally within the range of [0,2]. Using the piecewise function to place the element in the i-th cluster that satisfies into a new set. After setting an adaptive threshold for each cluster result, 4 new clustering results will be generated,The number of votes in these four new clustering results is all high, which means that the interference lines detected under low thresholds have been filtered out. Figure 12a shows that when m=1, there are many lines in the first cluster that are lower than the green dashed line, all of which are interference lines, Figure 12b shows the distribution of votes when m=2. Based on the experimental analysis, this article takes m=1. From the experimental results, it can be seen that the method proposed in this article for determining adaptive thresholds based on the number of votes is to identify the lines with high voting numbers in each cluster, preparing for the improved clustering centroid calculation and line fitting method proposed in Section 2.4.