help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
satellite-images
RSK World
satellite-images
Satellite Images Dataset - Land Cover Classification + Building Detection + Remote Sensing + Geospatial Analysis
satellite-images
  • __pycache__
  • data
  • visualizations
  • .gitignore780 B
  • ADVANCED_FEATURES.md7.2 KB
  • ATTRIBUTION.md1.5 KB
  • DATA_SUMMARY.md3.9 KB
  • DOWNLOAD_REAL_DATA_GUIDE.md3.4 KB
  • ERROR_FIXES_SUMMARY.md3.2 KB
  • GITHUB_RELEASE_INSTRUCTIONS.md4.9 KB
  • LICENSE1.2 KB
  • PROJECT_INFO.md3 KB
  • QUICK_DOWNLOAD_GUIDE.md2.1 KB
  • QUICK_START_ADVANCED.md2 KB
  • README.md8.1 KB
  • RELEASE_NOTES_v1.0.0.md7.1 KB
  • advanced_example.py11 KB
  • advanced_processing.py17.3 KB
  • advanced_visualization.py15.5 KB
  • batch_processing.py11.9 KB
  • batch_processor.py10.8 KB
  • check_errors.py6.9 KB
  • config.py1.1 KB
  • create_placeholder_image.py3.5 KB
  • create_sample_images.py5.3 KB
  • data_loader.py6 KB
  • download_real_images.py5 KB
  • download_real_satellite_data.py8.4 KB
  • download_with_landsatxplore.py4.6 KB
  • download_with_sentinelsat.py6 KB
  • enhanced_real_image_downloader.py17.8 KB
  • example_usage.py4.3 KB
  • generate_sample_data.py7.2 KB
  • get_real_satellite_data.py9.6 KB
  • index.html18.5 KB
  • ml_features.py11.8 KB
  • ml_integration.py13.6 KB
  • process_images.py7 KB
  • real_image_downloader.py15.7 KB
  • requirements.txt632 B
  • requirements_download.txt474 B
  • satellite-images.png2.6 MB
  • setup.py1.6 KB
  • visualize.py5.8 KB
visualize.py
visualize.py
Raw Download
Find: Go to:
#!/usr/bin/env python3
"""
Satellite Image Dataset - Visualization Script
Created by: RSK World
Website: https://rskworld.in
Email: help@rskworld.in
Phone: +91 93305 39277

This script provides visualization utilities for satellite images and labels.
"""

import matplotlib.pyplot as plt
import numpy as np
from pathlib import Path
import json
from typing import Optional
from data_loader import SatelliteDatasetLoader
from process_images import SatelliteImageProcessor


def visualize_land_cover(image: np.ndarray, labels: dict, save_path: Optional[str] = None):
    """
    Visualize satellite image with land cover classifications.
    Created by: RSK World (https://rskworld.in)
    
    Args:
        image: Satellite image array
        labels: Label data with regions
        save_path: Optional path to save the visualization
    """
    fig, axes = plt.subplots(1, 2, figsize=(16, 8))
    
    # Original image
    axes[0].imshow(image)
    axes[0].set_title('Original Satellite Image', fontsize=14, fontweight='bold')
    axes[0].axis('off')
    
    # Image with land cover overlay
    axes[1].imshow(image)
    
    if 'regions' in labels:
        # Color map for different land cover classes
        colors = plt.cm.Set3(np.linspace(0, 1, len(labels.get('classes', []))))
        class_colors = {cls: colors[i] for i, cls in enumerate(labels.get('classes', []))}
        
        for region in labels['regions']:
            if 'polygon' in region:
                polygon = np.array(region['polygon'])
                class_name = region.get('class', 'unknown')
                color = class_colors.get(class_name, 'red')
                
                axes[1].fill(polygon[:, 0], polygon[:, 1], 
                           color=color, alpha=0.3, label=class_name)
                axes[1].plot(polygon[:, 0], polygon[:, 1], 
                           color=color, linewidth=2)
    
    axes[1].set_title('Land Cover Classification', fontsize=14, fontweight='bold')
    axes[1].axis('off')
    axes[1].legend(loc='upper right', bbox_to_anchor=(1.15, 1))
    
    plt.tight_layout()
    
    if save_path:
        plt.savefig(save_path, dpi=150, bbox_inches='tight')
        print(f"Visualization saved to {save_path}")
    else:
        plt.show()
    
    plt.close()


def visualize_buildings(image: np.ndarray, buildings: dict, save_path: Optional[str] = None):
    """
    Visualize satellite image with building detections.
    Created by: RSK World (https://rskworld.in)
    
    Args:
        image: Satellite image array
        buildings: Building detection data
        save_path: Optional path to save the visualization
    """
    fig, ax = plt.subplots(1, 1, figsize=(12, 12))
    ax.imshow(image)
    
    if 'buildings' in buildings:
        for building in buildings['buildings']:
            if 'bbox' in building:
                bbox = building['bbox']
                x, y, w, h = bbox
                confidence = building.get('confidence', 1.0)
                
                # Draw bounding box
                rect = plt.Rectangle((x, y), w, h, 
                                    linewidth=2, edgecolor='red', 
                                    facecolor='none', alpha=0.8)
                ax.add_patch(rect)
                
                # Add confidence label
                ax.text(x, y - 5, f'{confidence:.2f}', 
                       color='red', fontsize=10, fontweight='bold',
                       bbox=dict(boxstyle='round', facecolor='white', alpha=0.7))
    
    ax.set_title('Building Detection', fontsize=16, fontweight='bold')
    ax.axis('off')
    
    plt.tight_layout()
    
    if save_path:
        plt.savefig(save_path, dpi=150, bbox_inches='tight')
        print(f"Visualization saved to {save_path}")
    else:
        plt.show()
    
    plt.close()


def create_summary_visualization(loader: SatelliteDatasetLoader, 
                                 output_dir: str = "visualizations"):
    """
    Create summary visualizations for the dataset.
    Created by: RSK World (https://rskworld.in)
    
    Args:
        loader: Dataset loader instance
        output_dir: Directory to save visualizations
    """
    output_path = Path(output_dir)
    output_path.mkdir(exist_ok=True)
    
    info = loader.get_dataset_info()
    
    if info['total_images'] == 0:
        print("No images found in dataset.")
        return
    
    # Create visualizations for first few images
    for i, image_file in enumerate(info['images'][:5]):
        image_id = Path(image_file).stem
        image, labels = loader.load_image_pair(image_id)
        
        if image is None:
            continue
        
        # Visualize with labels if available
        if labels:
            save_path = output_path / f"{image_id}_landcover.png"
            visualize_land_cover(image, labels, str(save_path))
        
        # Visualize buildings if available
        buildings = loader.load_building_detections(image_id)
        if buildings:
            save_path = output_path / f"{image_id}_buildings.png"
            visualize_buildings(image, buildings, str(save_path))
        
        print(f"Processed {i+1}/{min(5, len(info['images']))} images")


def main():
    """
    Main function for visualization script.
    Created by: RSK World (https://rskworld.in)
    """
    print("Satellite Image Dataset - Visualization Tool")
    print("Created by: RSK World (https://rskworld.in)")
    print("-" * 50)
    
    loader = SatelliteDatasetLoader()
    processor = SatelliteImageProcessor()
    
    # Create summary visualizations
    create_summary_visualization(loader)
    
    print("\nVisualization complete!")


if __name__ == "__main__":
    main()

179 lines•5.8 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer