An integrated pipeline for two-level road slope analysis from single panoramic street view images
Vision2Slope is a comprehensive pipeline designed to analyze road slopes using single panoramic street view images. The pipeline leverages advanced computer vision techniques to extract and compute slope information along the road, including both point-level and segment-level analyses, which can be useful for various applications such as urban planning, navigation, and infrastructure development.
-
Panorama Support: Automatically converts panoramic street view images to perspective views (left and right) for accurate slope analysis.
-
Side-view Deskewing: Transforms panoramic images into side-view perspectives and corrects vertical distortions to ensure accurate analysis using semantic and geometric prompts.
-
Point-level Slope Estimation: Computes the slope of the road surface at specific points using the segmented road areas and their 3D geometry.
-
Segment-level Slope Estimation: Analyzes the slope over larger road segments to provide a comprehensive understanding of road gradients and relief.
Please refer to the Tutorial or Script for detailed instructions on how to use Vision2Slope for slope estimation from street view images.
- Install from source:
python -m pip install -e ./src/Vision2Slope- Import the pipeline in Python:
from vision2slope import (
PipelineConfig,
VisualizationConfig,
ProcessingConfig,
Vision2SlopePipeline
)- Optional: download Mapillary panoramas (requires an API key):
from zensvi.download import MLYDownloader
mly_api_key = "YOUR_MAPILLARY_API_KEY_HERE"
downloader = MLYDownloader(mly_api_key=mly_api_key)
downloader.download_svi(
"sf",
lat=37.797423890238,
lon=-122.44403351517,
buffer=5,
resolution=2048,
image_type="pano"
)- Configure and run panoramic processing:
config_panorama = PipelineConfig(
input_dir="sf/mly_svi/batch_1",
output_dir="sf/mly_svi/output_pano",
processing_config=ProcessingConfig(
is_panorama=True,
panorama_fov=90,
panorama_phi=0.0,
panorama_aspects=(10, 10),
panorama_show_size=100,
log_level="INFO"
),
viz_config=VisualizationConfig(
save_visualizations=True,
save_corrected_images=True,
save_intermediate_results=True
)
)
pipeline_panorama = Vision2SlopePipeline(config_panorama)
results_panorama = pipeline_panorama.process_batch()- Optional: Configure and run perspective images (non-panoramic):
config_perspective = PipelineConfig(
input_dir="input",
output_dir="output"
)
pipeline_perspective = Vision2SlopePipeline(config_perspective)
results_perspective = pipeline_perspective.process_batch()The pipeline generates detailed slope analysis results, including visualizations of slope distributions and numerical slope values for both point-level and segment-level analyses.
Figure: Two-level road slope maps using Vision2Slope.
- ✅ Release the codebase
- ✅ Add installation instructions
- ✅ Provide usage examples
- ✅ Support panoramic image input
- ✅ Integrate more SVI platforms into Vision2Slope
- Expand study to diverse geographic locations
This project is inspired and supported by the Google Street View, OpenStreetMap, and Opentopography communities for providing open access to their valuable data resources. Additional thanks to the developers of the open-source libraries utilized in this project, including OpenCV, NumPy, Pandas, Matplotlib, PIL, ZenSVI and streetlevel.
This project is licensed under the MIT License - see the LICENSE file for details.
