# A Line Segment Detector for Space Target Images Robust to Complex Illumination
## 2 Methods
### Line Segment Validation and Aggregation  
Local strong light may make it impossible to extract effective anchors, which may cause the number of effective anchors to decrease, similar to the partial structure being partially occluded. After anchor map extraction, active grouping, and line segment validation, there may be a situation that the adjacent small line segments from the same line segment fail to connect. Figure 5 shows this false alarm caused by the change in anchor density. In Figure 4(a), there is an obvious line segment. Due to the interference of strong light or noise in the  
Figure 4: Flow chart of the algorithm. middle of the line segment, the anchor extraction has problems, as shown in Figure 5b, where the number of red anchors in the middle of the line segment (the blue circular region) is less than the threshold of anchor density. After the anchor density method along the line segment, the complete line segment is segmented into two small blue adjacent line segments as shown in Figure 5c. This type of false alarm is likely to occur under complex illumination and noise interference. To solve this problem, an aggregation method for complex illumination is used, which realizes the aggregation of line segments by connecting disjoint line segments that probably came from the same line segment. Suppose the line segment obtained during the validation phase of the line segment is \(l_{a}\). We call adjacent disjoint segments that probably came from the same line segment as an aggregate candidate line segment \(l_{b}\). The angle difference between the line segments, the distance between endpoints, and the overlap of the line segments are used to judge whether the aggregate candidate line segment \(l_{b}\) can be aggregated. The angle difference between the line segments and the distance between the endpoints are defined as shown in Figure 6.  
First, we consider the angle difference between line segments as the first aggregate condition for candidate line segments. Let the angle difference between line segments \(l_{a}\) and \(l_{b}\) be \(\theta\). When \(\theta\) is less than a certain angle difference threshold \(\tau_{\theta}\), the two line segments may meet the aggregation requirements and enter the next aggregation conditional validation phase. The angle difference threshold \(\tau_{\theta}\) is calculated by:  
\[\tau_{\theta}=\bigg{(}1-\frac{1}{1+e^{\alpha(\lambda+\beta)}}\bigg{)}\gamma \tag{17}\]  
where \(\alpha\), \(\beta\), and \(\gamma\) are coefficients and \(\lambda\) is a combined normalization coefficient, which can be expressed as:  
\[\lambda=\frac{|l_{b}|}{|l_{a}|}+\frac{d}{\tau_{d}} \tag{18}\]  
where \(|l_{a}|\) and \(|l_{b}|\) represent the lengths of the line segments \(l_{a}\) and \(l_{b}\), respectively, and \(d\) and \(\tau_{d}\) are described below. Second, we use the endpoint distance between the line segments as the second aggregate condition, as shown in Figure 7. We calculate the Euclidean distance between each  
Figure 5: False alarm caused by anchor density change. (**a**) The original image. (**b**) Errors in anchor map extraction. (**c**) The complete line segment is divided into two small line segments. Figure 6: Schematic diagram of the angle difference between segments and the distance between endpoints. endpoint of \(l_{a}\) and \(l_{b}\) and select the smallest endpoint distance as the endpoint distance between \(l_{a}\) and \(l_{b}\). When the two line segments are close enough--in other words, the endpoint distance \(d\) meets a certain endpoint distance threshold--it is possible for the two line segments to further aggregate. Set the endpoint distance threshold as \(\tau_{d}\), which is proportional to the length of the line segment:  
\[\tau_{d}=\varepsilon|\text{max}\{|l_{a}|,|l_{b}|\}| \tag{19}\]  
where \(\varepsilon\) is a custom coefficient that satisfies \(0<\varepsilon<1\).