(a) (b)
Figure 12. Distribution of Linear Voting Numbers under Different Values
of m
2.4 Improved clustering centroid calculation
method
The clustering centroid for k-means will eventually move to the average
of all samples within the cluster, which is greatly affected by errors.
This article proposes an improved clustering centroid calculation method
to replace the original clustering centroid of k-means as the basis for
line fitting. Take the weight of the votes of each line into the
calculation formula. Figure 13 shows the local image of line detection.
When the edge image is affected by uncontrollable factors such as
lighting, a small portion of correct edge pixels are lost, but the
overall linear relationship does not change much. Therefore, this type
of straight line still has some reference value for line fitting and
cannot be directly removed. Using the optimal adaptive threshold method
proposed in 2.3, find a series of lines with high voting numbers in each
cluster. In Figure 13a, in detection lines 1, 2, and 3, detection line 2
shows the detection results of missing edge pixels, but its linear
relationship is basically consistent with other detection lines, with
slight errors. Therefore, based on the weight of the number of straight
line votes, a formula is proposed:
The improved clustering centroid calculation method proposed in this
article takes into account the weight proportion of each line, and the
calculation results are theoretically more in line with the linear
relationship of real edge points. By using the method of determining
adaptive thresholds based on the number of votes counted, lines with low
votes are deleted, improving the reliability of the lines to be fitted
in each cluster. And the improved clustering centroid calculation method
further brings the straight line fitting results closer to the real edge
in theory. The detection results are shown in Figure 13c.