# 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
Given that the mutually perpendicular line segments of buildings in remote sensing images may not be adjacent, the right-angle primitive detection method needs to be ambiguous to tolerate the case of non-adjacent perpendicular line segments. A position-angle voting space \(V\in R^{M\times N\times A}\) is created for extracting potential right-angle primitives, where \(M\) is the number of rows of the image, \(N\) is the number of columns of the image, and \(A\) is the number of intervals of the angle. For each straight-line segment \(l\), the neighboring entrances centered at each endpoint at the corresponding entrance of the position angle voting space are voted simultaneously as shown in Equation (4). \[V(i+\tau,j+\tau,\alpha+\tau)=V(i+\tau,j+\tau,\alpha+\tau)+1\ \ -\varepsilon\leq\tau\leq\varepsilon, \tag{4}\]  
where \(i\), \(j\) and \(\alpha\) are the row and column coordinates of an endpoint of the line segment and the direction of the line segment, respectively. The line segment direction can be calculated simply using the inverse cosine, which is shown in Equation (5). \[\alpha=round\left(\arccos\left(\frac{\left\langle l_{i},\beta\right\rangle}{ \left\|l_{i}\right\|_{2}}\right)/\Delta\alpha\right), \tag{5}\]where \(\beta\) is the horizontal unit vector and \(\Delta\alpha\) is the angular interval. After traversing all the line segments, the potential right-angle primitives are extracted using the following Equation (6). \[R=V\delta V\times_{3}F\] \[F(i,j)=\left\{ \begin{array}{l}1\text{ }if\ |j-i|=A/2\\ 0\text{ }otherwise\end{array} \right. \tag{6}\]  
where \(F\) is the shift matrix, \(R\) is the right-angle primitive detection result, \(\times_{3}\) represents the third dimension of \(V\) is multiplied by \(F\), and \(A\) is the number of intervals of the angle. For a typical L-shaped and cross-shaped building, the endpoints of the right-angle edges of the outer corners of the building are dependent on the two inner corners of the building and are oriented in the opposite direction to the right-angle primitives of the outer corners. Using this feature, all right-angle primitives in the voting space are traversed, and whether the right-angle primitive is the building outer corner primitive is determined by Equation (7). \[\max\{\alpha-\alpha_{1},\alpha-\alpha_{2}\}\leq\delta, \tag{7}\]  
where \(\alpha\) is the right-angle primitive to be identified, \(\alpha_{1}\) and \(\alpha_{2}\) are the right-angle primitives at the endpoints of the right-angle edges of the primitive, and \(\delta\) is the outer-angle threshold. If the above conditions are satisfied, then \(\alpha\) is considered to be an exterior right-angle primitive, otherwise \(\alpha\) is an interior right-angle primitive. Based on the final right-angle primitive extraction results, a rectangular region can be obtained using the right-angle and the two sides enclosing the right-angle, which can be considered as the building region. Since the studied building targets include L-shaped buildings, concave buildings, rectangular buildings and cross-shaped buildings, a single rectangular approximation can only obtain a local area of the building top surface. In order to obtain the complete building top surface, we combine the similar spectral characteristics of the building top surface, extract the seed points in the rectangular area formed by the right-angle edges, and use the proposed restricted region growth algorithm to obtain complete building top surface. The specific steps are as follows. Step 1: Extract the seed points contained in the right-angle edges. Step 2: The larger rectangular area enclosed by the extensions of the right-angled edges is used as the maximum growth region. Step 3: Execution of region growth algorithm. The complete segmentation of the building is achieved using the region growing algorithm to obtain the final detection results.