This is the python code for detecting rooftops from Aerial RGBD (and IR if available) data using simple image processing techniques. It uses moderate computational resources and has low interface time for segmenting rooftops. Works best on elevation data generated from photogrammetry with around 5cm ground resolution. The two inputs are the RGB (ortho-photo) and the Digital Elevation Model (DEM) geotifs. IR band data may be additionally provided for using NDVI in removing tree canopies more accurately. The shape files for the roofs and clutter in roof are generated as output which can be opened in any GIS software like QGIS.
Why this works?
[1] No viewpoint variations.
[2] Scale variation: Ground resolution is already known. (5cm/px in this example)
[3] No deformation in shape of object segmented. (Building images don't deform like the images of a cat)
[4] Minimal Occulusion: Only trees cover certain rooftops. (Since we are interested in solar panel deployment, this doesn't matter)
[5] Illumination variation: We use DEM for segmentation and NIR for detecting vegetation. Other than that, drone data is generally recorded in ideal environmental conditions.
Kritik Soman. 2019. Rooftop Detection using Aerial Drone Imagery. In Proceedings of the ACM India Joint International Conference on Data Science and Management of Data (CoDS-COMAD '19). ACM, New York, NY, USA, 281-284. https://dlnext.acm.org/doi/abs/10.1145/3297001.3297041
cv2
gdal
scipy
skimage
matplotlib
numpy
multiprocessing
osgeo
[1] Download the repository zip and upload on Colab.
[2] Unzip using the command! unzip Rooftop-Segmentation.zip
[3] Open demo.ipynb, change directory using % cd Rooftop-Segmentation
and run cells.
[1] Rooftop segmentation
Our Dataset | ISPRS Potsdam Dataset |
---|---|
![]() |
![]() |
[2] Clutter and Rooftop segmentation
DEM consisting of rooftops | Ortho-photo of rooftops | The detected rooftops along with clutter |
---|---|---|
![]() |
![]() |
![]() |
[4] Rooftop segmentation when roof is covered with grass
Ortho-photo | Segmented rooftops |
---|---|
![]() |
![]() |
This code was tested with following version of packages:
cv2 3.3.0
gdal 2.1.3
scipy 0.19.1
skimage 0.13.0
matplotlib 2.1.1
numpy 1.13.3