# Semi-Automatic Method of Extracting Road Networks from High-Resolution Remote-Sensing Images
## 2 Materials and Methods
### Methodology
#### 2.2.1 Interactive Single-Road Extraction
This algorithm mainly includes these following steps:  
Step 1: Connect the two endpoints A and B and record them as reserved points. Calculate the Euclidean distance from each point between the two ends to line \(\overline{\text{AB}}\), and find the point P with the greatest distance. If there is no point between the two ends, all points have been simplified, and the simplifying operation exits. Step 2: Compare the distance from point P to line \(\overline{\text{AB}}\) and the simplifying threshold T, delete point P when the distance is less than T, otherwise, keep it. Step 3: Repeat the steps above with points A and P as endpoints and with B and P as endpoints, respectively. The simplifying threshold T is defined as:  
\[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]1  
where resolution is the image resolution in meters; k is a simplifying parameter, which is set to 3.0. Figure 6 shows the principle of the Douglas-Peucker algorithm: the endpoints are determined and deleted in turn, and finally a five-point polyline is used to describe the  
\[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]2 Arrangement order of pixels in the road tracking algorithm. initial seven-point polyline. Blue points are the ones being judged and then kept, and the red points are the ones judged and then deleted. Red dashed lines show the distances between the judged point P and the connecting line of endpoints A and B (blue line) and black dashed lines are the segments to be deleted in each step. During the road tracking process, due to the influence of intersections, shadows, etc., on the road, some overly short segments may be generated, as shown in Figure 7a,b. These overly short segments are not part of the road and are likely to cause interference in the subsequent connection algorithms. Therefore, we delete them by setting a length threshold. The length threshold \(\mathrm{d}_{\mathrm{t}}\) is defined as:  
\[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]3  
This definition is based on the characteristics of long and thin roads; according to experience, the aspect ratio of roads is generally greater than 10. The road vectorization algorithm is shown in Algorithm 1:  
\[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]4 Principle of the Douglas–Peucker algorithm: (**a**) initial polyline; (**b–d**) judgment and processing step by step; (**e**) simplified result. \[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]5 Vectorization to obtain segments: (**a**) result after thinning; (**b**) result after applying the tracking algorithm; (**c**) result after deleting overly short segments; (**d**) result after simplification. Among the functions above, findFirstPoint (image, firstPt) is used to globally search for the first point firstPt, findNextPoint (neighbor, image, currPt, nextPt) is used to search for the next point nextPt, and line.simplify (T) is used to simplify the line segment according to the threshold T.  
Figure 7 shows the result of vectorization processing: (a) is a local road thinning result, (b) shows the road segments obtained by the tracking algorithm, (c) is the result of deleting overly short segments, and (d) is the result of the simplifying algorithm. (2) Road segment optimization and connection  
The vectorization operation mentioned above generates a series of separate road segments, and the offset problem occurring at the head and tail segments during the thinning process cannot be solved, as shown in Figure 8a,c. Therefore, the road segments generated need to be further optimized and connected to form the entire road. Considering the smoothness of roads, branches and offsets are eliminated by judging the direction of the endpoints and the neighboring nodes. The principle of endpoint modification is shown in Figure 9, where the dotted line indicates the direction of vector \(\overline{\text{BA}}\).