# 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
By searching the points of roads one by one in the binary image obtained by the morphological closing operation, where a road point has a gray value of 255 and a background point has a value of 0, boundary points that do not affect road connectivity are deleted. The operation has two steps:  
Step 1: Find the boundary points that meet the following requirements:  
\[2\leq\mathrm{N}_{1}\leq 6, \tag{2}\]  
\[\mathrm{T}(\mathrm{p}_{1})=1, \tag{3}\]  
In the formulas, \(\mathrm{N}_{1}\) means the number of road points among eight neighborhoods, and \(\mathrm{T}(\mathrm{p}_{1})\) is the number of transitions of gray values from 0 to 255 among eight neighborhoods. Step 2: if a boundary point found meets requirements of either group A or group B, its gray value will be changed to 0, which means it is deleted. In the formulas, \(\mathrm{p}_{i}\) means the gray value of the i-th pixel. The arrangement of pixels is shown in Figure 4.  
Group A:  
\[\mathrm{P}_{2}\cdot\mathrm{P}_{4}\cdot\mathrm{P}_{6}=0, \tag{4}\]  
\[\mathrm{P}_{4}\cdot\mathrm{P}_{6}\cdot\mathrm{P}_{8}=0, \tag{5}\]  
Group B:  
\[\mathrm{P}_{2}\cdot\mathrm{P}_{4}\cdot\mathrm{P}_{8}=0, \tag{6}\]  
\[\mathrm{P}_{2}\cdot\mathrm{P}_{6}\cdot\mathrm{P}_{8}=0, \tag{7}\]  
Repeat the two steps until no more points should be deleted. The result is shown in Figure 3d. Road Skeleton Vectorization and Optimization  
After the processing described above, a road skeleton with a single-pixel width is acquired. Compared with the raster map, the vector map is more convenient to save and modify and easier to update and use in data analysis. Therefore, it is necessary to perform vectorization processing on the road skeleton obtained. We use a tracking algorithm to vectorize the road skeleton. To obtain a relatively accurate centerline vector of the road and address the problems of overly short segments and incomplete roads, various operations are adopted, which include simplifying road segments, deleting overly short segments, modifying endpoints, and connecting roads. The strategies and algorithms used in each part are introduced below. (1) Road vectorization to generate road segments  
\[\mathrm{A}\cdot\mathrm{B}=(\mathrm{A}\oplus\mathrm{B})\ominus\mathrm{B}, \tag{1}\]0 Arrangement of pixels in the operation of morphological thinning. This method uses a road tracking algorithm to vectorize the raster road; the results of this algorithm are accurate, and its calculation speed is high. This operation can be described as the following steps:  
Step 1: Search for a starting road point (with a gray value of 255, pixel p\({}_{1}\) in Figure 4) in the whole image from top left to bottom right and record its coordinate, then record this point as the first point of a road and change its gray value to 0, that is, delete it. Step 2: search for another road point in a certain order (see Figure 5) in the eight neighborhoods of the first point and set it as a new starting point. Then record this point as the latter point of the road and also change its gray value to 0. Repeat this step until no more road points are to be recorded. Step 3: As the first point may not be the actual starting point of a road, set the first point as the starting point again and continue searching in the same order as step 2, but record the new point found as a previous point instead, indicating that the road being tracked has a certain direction. Step 4: When no new points needs to be recorded in step 3, an entire road has been recorded and all the points of it have been deleted. Start again from step 1 to track a new road and stop tracking when no road points can be found in the entire image. The simplifying algorithm and the operation of deleting overly short segments are applied after the tracking algorithm. We use the Douglas-Peucker algorithm [PERSON] (1986) for simplification; it has translation and rotation invariance and removes unnecessary points by setting a distance threshold to perform data compression.