# Research on Building Target Detection Based on High-Resolution Optical Remote Sensing Imagery
## 2 Data and Methodology
### Methodology
#### 2.2.1 Building Detection Based on Rectangular Approximation and Region Growth  
The geometric structure of a typical vertical top view of a building, including L-shaped building, concave building, rectangular building and cross-shaped building, has a common component of right-angle primitives composed of mutually perpendicular line segments, and the extraction of such right-angle primitives with the rectangular approximation technique based on right-angle primitives can better extract buildings with different vertical top views of geometric structures. Figure 2 presents the flowchart of the algorithm used in this study. Extracting right-angle primitives of buildings requires the detection of line segments in remote sensing images. The LSD-based line segment detection method has a faster extraction speed and has been successfully applied in airport detection and the road detection of remote sensing images. For this purpose, the line segments of remote sensing images are extracted using the LSD [14] method, and the line segment detection results are shown in Figure 3.  
Figure 3: Line segment detection results. (**a**) Image I, (**b**) Image II. Figure 2: The flowchart of building detection based on rectangular approximation. The results of LSD show that the extracted line segments are fractured at the point where the gradient changes strongly. In order to prevent the fracture of the boundary line of the building from adversely affecting the building detection results, a fractured line segment connection method is constructed to optimize the LSD detection results. Connectable broken line segments satisfy the approximate covariance as well as the small distance in the direction of covariance. Based on these two properties, the following criterion can be constructed to discriminate whether all straight-line pairs are broken pairs. \[\frac{\left\langle l_{i},l_{j}\right\rangle}{\left\|l_{i}\right\|_{2}\left\|l_ {j}\right\|_{2}}\leq\delta_{1} \tag{1}\]  
\[\frac{\left\langle d_{i1}-d_{j1},\bot\left(c_{i}-c_{j}\right)\right\rangle}{ \left\|\bot\left(c_{i}-c_{j}\right)\right\|_{2}}\leq\delta_{2} \tag{2}\]  
\[\min_{k,m\in\{1,2\}}\left(\frac{\left\langle d_{ik}-d_{jm},c_{i}-c_{j}\right \rangle}{\left\|c_{i}-c_{j}\right\|_{2}}\right)\leq\delta_{3}, \tag{3}\]  
where \(l_{i}\), \(l_{j}\), \(d_{i1}\), \(d_{j1}\), \(c_{i}\), \(c_{j}\) are the vector of the \(i\)th and the \(j\)th line segments, the coordinates of the endpoint 1 of the \(i\)th and the \(j\)th line segments, the coordinates of the midpoint of the \(i\)th and the \(j\)th line segments, respectively. \(k,m\in\{1,2\}\) represents endpoint 1 or endpoint 2 of the line segment, and \(\delta_{1}\), \(\delta_{2}\), \(\delta_{3}\) are the threshold values. The first discriminant indicates the cosine of two line segments, that is, line segment parallelism detection. \(\bot\left(c_{i}-c_{j}\right)\) indicates the zero space of \(\left(c_{i}-c_{j}\right)\). The second discriminant indicates the projection of the distance of the endpoints of the line segment in the \(\bot\left(c_{i}-c_{j}\right)\) direction is less than the threshold, that is, line segment co-linearity detection. The third discriminant indicates the projection of the line segment composed of any endpoints of two line segments in \(\left(c_{i}-c_{j}\right)\) is less than the threshold, that is, line segment break length discrimination. The above three discriminatory formulae are parallelism, covariance and fracture distance discriminations, and the current line segment pair is connected if the above conditions are satisfied. Removing vehicles and other interfering line segments further improves the accuracy of subsequent building target extraction and reduces the computational effort. We construct a right-angle primitive extraction method to detect the right-angle primitives of buildings.