Geospatial Image Co-registration: Part-1
While working with geospatial data, the most generic use case a data scientist runs into is comparing or overlaying the recent rasters over the old or different source rasters. But, as luck may have it, not always these two different rasters will align. Apart from the color intensity (either due to sensor difference, or time difference) between the two rasters, one also encounters the spatial shift between the two.
This shift can be introduced due to several factors, including but not limited to, Sensor/Camera angle, the height of the camera, new constructions, geometry change, time of day, the time gap between two rasters, etc.
Spatial shift (upwards) between two rasters using the same camera 1 year apart
To do any further analysis, e.g., depth map estimation, or change detection, it is advisable to first co-register the two rasters
Co-registering two rasters is a two-step process:
- Finding common points between two rasters, called tie points
- Calculate the Affine transformation on the target raster
Finding tie-points
A tie point (TP) is a specific location that is recognizable visually in the overlap area between two or more images
Detecting reliable tie points is typically a manual process of selecting visibly matching points between the two rasters
The tie-points should be uniformly distributed across the whole raster
Correcting Shifts
Once you have the set of tie-points you can employ the following two strategies to correct the shifts:
- Global Co-registration: Calculate the affine transform for the entire raster and apply homography correction based on the affine matrix
- Local Co-registration: Calculate the shifts in a sliding window manner.
Once you have calculated the shifts, you can apply the affine transformation on the target rasters to correct the shifts. To achieve the aforementioned steps, you can use GDAL
Implementation
You can use the GDAL library to achieve the aforementioned tasks:
Calculate Spatial Shifts:
gdal_translate -of GTiff -gcp pixel line easting northing “<path_to_input_target>” “<path_to_intermittent_output>”
Apply Affine transform:
gdalwarp -r near -tps -co COMPRESS=NONE -t_srs EPSG:4326 “<path_to_intermittent_output>” “<path_to_final_coregistred_output>”