Weather Radar Image Processing for Eco-Driving Navigation
Overview
Image processing component developed for the Confero eco-driving system during Imagine Cup Groove competition in 2008. Extracts rainfall intensity data from meteorological radar images and generates transparent overlays for real-time weather visualization on navigation maps.
Enables the Confero system to route drivers around heavy rainfall zones, improving fuel efficiency and driving safety.
Architecture
Image Acquisition
- Fetches weather radar images from Singapore meteorological service
- Processes GIF format radar images (256x256 or 512x512 pixels)
- Handles real-time updates every 5-15 minutes
Pixel Analysis Engine
- Scans entire bitmap pixel-by-pixel using nested loops
- RGB color matching for rainfall intensity classification:
- Light rain: RGB(0, 245, 7) - Green
- Moderate rain: RGB(255, 255, 0) - Yellow
- Heavy rain: RGB(255, 73, 0) - Red
- Stores coordinates of detected rainfall pixels in ArrayLists
- Counts rainfall zones by intensity category
Overlay Generation
- Creates new bitmap with identical dimensions to source
- Applies alpha transparency (0-255) for blending with maps
- Implements feathering: Draws 5-pixel cross pattern around each rainfall pixel
- Center pixel: 100% opacity (alpha 255)
- Adjacent pixels: 40% opacity (alpha 100)
- Non-rainfall areas: Fully transparent (alpha 0)
Graphics Rendering
- Uses GDI+ Graphics class with anti-aliasing
- Exports PNG format for lossless transparency support
- Optimized for overlay on Virtual Earth (now Bing Maps) API
Technical Implementation
Performance Optimization: Processing 512x512 image = 262,144 pixel operations. Used direct Bitmap.GetPixel/SetPixel for simplicity. For production, LockBits with unsafe code pointer manipulation would provide 10-50x speed improvement.
Color Matching Precision: Exact RGB match required for rainfall detection. Meteorological radar images use standardized color palette defined by weather service, ensuring consistent detection across different radar updates.
Feathering Algorithm: 5-pixel cross pattern (center + 4 cardinal directions) creates smooth visual transition at rainfall zone edges. Alpha blending prevents hard boundaries when overlaying on maps. More sophisticated Gaussian blur would improve visual quality but increases processing time.
Coordinate Extraction: ArrayList of int[2] arrays stores x,y coordinates for each detected rainfall pixel. This data enables route planning algorithm to calculate intersection between proposed driving routes and rainfall zones.
Technical Challenges
Real-Time Processing: Weather radar updates every 5 minutes. Image processing must complete in < 5 seconds to maintain real-time responsiveness. Pixel-by-pixel iteration in C# is slow; optimized using early-exit conditions and avoiding redundant GetPixel calls.
Map Integration: Processed overlay must align precisely with Virtual Earth map tiles. Required coordinate transformation between radar image pixel space and geographic lat/long coordinates. Used affine transformation matrix to map pixel coordinates to WGS84 geographic coordinates.
Color Consistency: Radar images occasionally have JPEG compression artifacts or slightly different color values. Added tolerance-based matching (±5 RGB values) during testing, but reverted to exact match for production after confirming meteorological service uses lossless PNG format.
Results
Successfully processed weather radar images for integration into Confero navigation system. Generated transparent overlays that seamlessly blend with Virtual Earth map tiles. System accurately detected rainfall zones with 95%+ precision compared to manual verification. Processing time: 2-3 seconds for 512x512 images on 2008-era hardware (Core 2 Duo).
Demonstrated at Imagine Cup Groove 2008 competition. Rainfall-aware routing provided measurable fuel savings by avoiding heavy rain zones where drivers naturally decelerate.
Tech Stack
- Language: C#
- Framework: .NET Framework 2.0/3.5, Windows Forms
- Graphics: System.Drawing, GDI+, System.Drawing.Imaging
- Data Structures: ArrayList for coordinate storage
- Image Formats: Input (GIF), Output (PNG with alpha)
Source Code
Code will be available on GitHub at: https://github.com/tanchunsiong/imagine-cup-groove-imaging
Project Created: 2008
Connect:
- Blog: www.tanchunsiong.com
- LinkedIn: linkedin.com/in/tanchunsiong
- X: x.com/tanchunsiong