# Multilevel Regularization Method for Building Outlines
## 2 Materials and Methods
### Overall Regularization of Building Outlines Using Hausdorff Distance and MBR
#### 2.2.3 MBR Calculation Method and Its Improvement
Often, building outline extraction from remote sensing images can miss details near the corners, making the corner shapes beveled and leading to errors in the calculated results. As the Hausdorff distance can measure the similarity between two line chains in Euclidean space, it was introduced to effectively address the errors mentioned above. Thus, an MBR algorithm based on Hausdorff distance was proposed to obtain MBRs with higher similarity to the building outline. The specific steps are as follows:  
1. Compute the convex hull of the building outline. 2. Calculate the MBRs corresponding to each edge of the convex hull. 3. Set a threshold \(\delta\) (based on extensive experiments, \(\delta\) can be set to the same value as the data resolution, e.g., 0.5 m for data with resolution of 0.5 m). If the line segment on building outline \(P\) to any side of the MBR Q satisfies \(h(P,Q)<\delta\), record the length of the projected line segment on \(Q\). As shown in Figure 8, because segment \(AB\) satisfies \(h(P,Q)<\delta\), the length of its projected line segment \(EF\) on \(Q\) is recorded. For a line segment satisfying \(h(P,Q)>\delta\), if there is a part with \(h(P,Q)<\delta\), record the length of the projected segment of that part on \(Q\). As shown in Figure 8, part \(GK\) of line segment \(GH\) satisfies \(h(P,Q)<\delta\), and thus the length of its projected line segment \(OP\) on \(Q\) is recorded. Then, calculate the ratio \(p=\text{L}_{\text{sum}}/\text{C}_{\text{rec}}\), where \(\text{L}_{\text{sum}}\) is the sum of the lengths of projected segments on the current MBR outline, and \(\text{C}_{\text{rec}}\) is the perimeter of the MBR. 4. Select the MBR corresponding to the maximum \(p\) value as the result based on the Hausdorff distance. The MBR calculation results based on the Hausdorff distance are presented in Figure 7d. A comparison with the MABR calculation results in Figure 7a shows that the results of the proposed method are generally consistent for most building outlines. Nonetheless, for building types such as A and B, the MABRs obtained using the proposed method align more closely with the overall orientation of the building outline. Figure 7b  
Figure 8: Projection of line segments of the building outline with Hausdorff distances smaller than the threshold onto the MBR. shows the results of the algorithm based on the MBR with the maximum number of containing nodes. Compared with the results of the proposed method, the results of this algorithm are generally consistent for most building outlines. However, situations with severely offset orientations may occur for building outlines with uneven node distributions, such as building outlines C and D. The superior performance of the proposed method can be attributed to the fact that it simulates manual drawing and uses the Hausdorff distance to measure the similarity between building outlines and MBRs in various directions quantitatively and selects the one with the highest similarity as the result. We selected 300 buildings from the data with a resolution of 0.075 m and compared our proposed MBR calculation method with the MABR method and the MBR calculation method based on the highest number of collinear nodes. Owing to the lack of manual measurement data for the main direction of buildings and the lack of a unified method for calculating the main direction of buildings, we could only manually observe and judge on a case-by-case basis whether the calculation results are correct. The statistical results of the calculation are shown in Table 2. It can be seen that the accuracy of our proposed method is 100%, which is higher than the other two methods.