Cairo University - Faculty of Engineering
Computer Engineering Department
Digital Image Processing Lab - Term Project 2025
This project implements a complete satellite image processing pipeline for detecting and classifying roads and buildings from aerial/satellite imagery. The system uses traditional digital image processing techniques (no deep learning in the main pipeline) and outputs results in both raster (PNG) and vector (SVG) formats.
- β SLIC superpixel segmentation for boundary-preserving regions
- β Region merging to reduce over-segmentation
- β Road-focused feature extraction (skeleton, linearity, color uniformity)
- β Adaptive soft-scoring classification (no hard thresholds)
- β Morphological cleanup for connected road networks
- β SVG vectorization using Douglas-Peucker line simplification (from scratch)
- β User-friendly GUI application
Imaging/
βββ Module1/ # Input images (satellite/aerial imagery)
βββ Module2/
β βββ color/ # Preprocessed color images
β βββ gray/ # Preprocessed grayscale images
βββ Module3/
β βββ edges/ # Edge detection results
β βββ segmentation/ # SLIC segmentation results
βββ Module4/
β βββ region_features/ # Extracted features per region
β βββ region_clusters/ # Classification results
βββ Module5/
β βββ visualization/ # Final PNG visualizations with overlays
βββ Module6/ # Final SVG vector outputs β
βββ Module_DL/ # Deep Learning outputs (optional)
β
βββ phase1_preprocessing.py # Phase 1: Preprocessing (resize, denoise, enhance)
βββ phase2_improved.py # Phase 2: SLIC Segmentation
βββ phase3_improved.py # Phase 3: Feature Extraction
βββ phase4_improved.py # Phase 4: Classification
βββ phase5_improved.py # Phase 5: Visualization
βββ phase6_vectorization.py # Phase 6: SVG Vectorization β
βββ phase_dl_classification.py # Deep Learning comparison (optional) π§
βββ gui_app.py # GUI Application β
βββ run_improved_pipeline.py # Pipeline runner script
βββ README.md # This file
- Python 3.8 or higher (tested on Python 3.12)
- Operating System: Windows, Linux, or macOS
Install all dependencies using pip:
pip install numpy opencv-python scikit-image scikit-learn scipy pillow| Library | Version | Purpose |
|---|---|---|
numpy |
>= 1.21.0 | Array operations and numerical computing |
opencv-python |
>= 4.5.0 | Image processing (cv2) |
scikit-image |
>= 0.18.0 | SLIC superpixels, morphological operations |
scikit-learn |
>= 0.24.0 | K-means clustering, StandardScaler |
scipy |
>= 1.7.0 | Scientific computing, ndimage operations |
pillow |
>= 8.0.0 | Image display in GUI (PIL/ImageTk) |
- Windows: Tkinter is included with Python by default
- Linux (Ubuntu/Debian):
sudo apt-get install python3-tk
- macOS: Tkinter is included with Python by default
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/macOS:
source venv/bin/activate
# Install dependencies
pip install numpy opencv-python scikit-image scikit-learn scipy pillowStep 1: Activate your virtual environment (if using one)
# Linux/macOS
source venv/bin/activate
# Windows
venv\Scripts\activateStep 2: Run the GUI application
python gui_app.pyStep 3: Using the GUI
- Select an image from the list on the left panel (images from Module1 folder)
- Click "βΆ Start Processing" button in the right panel
- Wait for all 6 phases to complete (green checkmarks indicate success)
- View results using the tabs: Overlay, Roads, Buildings
- Click "π Open SVG Output" to open the vector file
- Click "π Open Folder" to browse all output files
Process all images in Module1 at once:
python run_improved_pipeline.pyThis will:
- Process all
.jpg,.png,.jpeg,.tifimages in Module1 - Run all 6 phases sequentially
- Save outputs to Module5 (visualizations) and Module6 (SVG files)
Process a specific image by running each phase with the --image flag:
python phase2_improved.py --image your_image.jpg
python phase3_improved.py --image your_image.jpg
python phase4_improved.py --image your_image.jpg
python phase5_improved.py --image your_image.jpg
python phase6_vectorization.py --image your_image.jpgRun each phase separately on all images:
python phase2_improved.py # SLIC Segmentation
python phase3_improved.py # Feature Extraction
python phase4_improved.py # Classification
python phase5_improved.py # Visualization
python phase6_vectorization.py # SVG Vectorization- Place your satellite/aerial images in the
Module1/folder - Run
python gui_app.py - Select an image and click "Start Processing"
- Find your results in
Module6/(SVG) andModule5/visualization/(PNG)
| Issue | Solution |
|---|---|
ModuleNotFoundError: No module named 'cv2' |
Run pip install opencv-python |
ModuleNotFoundError: No module named 'skimage' |
Run pip install scikit-image |
_tkinter.TclError: no display name |
Set display: export DISPLAY=:0 (Linux) |
TclError: bad argument "zoomed" |
Already fixed - update to latest code |
| Images not appearing in list | Check that images are in Module1/ folder |
| SVG file not opening | Install SVG viewer or use a web browser |
If running on Linux, ensure you have:
# Install Tkinter
sudo apt-get install python3-tk
# Install xdg-utils for opening files
sudo apt-get install xdg-utils- Converts input images to color and grayscale versions
- Applies brightness/contrast normalization (GUI handles this)
- Uses SLIC superpixels for boundary-respecting segmentation
- Merges similar regions based on LAB color distance
- Removes small noise regions
- Skeleton features: Length, ratio, linearity (key for roads)
- Shape features: Compactness, elongation, rectangularity, solidity
- Color features: Saturation, gray-ness, uniformity
- Edge features: Internal edge density, boundary strength
- Soft-scoring approach for roads and buildings
- Roads: High elongation, high linearity, low saturation
- Buildings: High compactness, high rectangularity, small area
- Morphological cleanup of road networks
- Connected component analysis
- Overlay generation with legend
- Extracts contours from classification masks
- Applies Douglas-Peucker line simplification (implemented from scratch)
- Generates SVG files compatible with mapping tools
{image}_overlay.png- Classification overlay on original{image}_overlay_with_legend.png- With classification legend{image}_roads_only.png- Binary road mask{image}_buildings_only.png- Binary building mask
{image}.svg- Scalable vector graphics with roads & buildings{image}_vectorized_overlay.png- Vector overlay preview
| Algorithm | File | Description |
|---|---|---|
| Douglas-Peucker | phase6_vectorization.py |
Line simplification for vector output |
| Region Merging | phase2_improved.py |
Merge similar adjacent superpixels |
| Skeleton Features | phase3_improved.py |
Road linearity detection |
| Soft Scoring | phase4_improved.py |
Adaptive classification without hard thresholds |
| Morphological Filter | phase5_improved.py |
Road network cleanup |
- β High elongation (> 2.5)
- β High linearity (long skeleton relative to area)
- β Low saturation (gray colors)
- β High color uniformity
- β Moderate consistent width
- β High rectangularity (> 0.5)
- β High compactness (circular shape factor > 0.25)
- β High solidity (convex shape)
- β Low elongation (< 3.0)
- β Smaller area (< 6000 pixels)
| Name | Role |
|---|---|
| [Team Member 1: mohamed emad] | Segmentation & Preprocessing |
| [Team Member 2: mohamed yasser nabil] | Feature Extraction |
| [Team Member 3: mazen hatem] | Classification & ML |
| [Team Member 4: karim yasser] | Visualization & GUI |
-
Garg, R.D. (2024). Integrated approaches for road extraction and de-noising from high resolution satellite image using adaptive global thresholding and morphological operations.
-
Chen, Z. et al. (2022). Road extraction in remote sensing data: A survey.
-
Pang, Z. et al. (2024). A Building Extraction Method for High-Resolution Remote Sensing Images.
-
Achanta, R. et al. (2012). SLIC Superpixels compared to state-of-the-art superpixel methods. IEEE TPAMI.
-
Douglas, D.H. & Peucker, T.K. (1973). Algorithms for the reduction of the number of points required to represent a digitized line.
- This project uses no deep learning in the main pipeline (as per project requirements)
- A pretrained DNN comparison can be added for bonus marks
- All non-primitive functions are attributed in the code
- Output SVG is compatible with GIS/mapping tools
This project is for educational purposes only (Cairo University DIP Lab 2025).