[Gdal-dev] Subtracting images

Frank Warmerdam warmerdam at pobox.com
Thu May 18 16:31:01 EDT 2006


Morten Nielsen wrote:
> Is it possible to subtract two images from each other using GDAL?
> 
>  
> 
> I have a large virtual raster covering a wide area, and several smaller 
> base-images.
> 
> I want to create a difference image where the part of the virtual raster 
> that covers the base-image is subtracted from the base-image. Output 
> should be the absolute difference in each band. The images are all 
> georeferenced and have the same resolution. Are there any commandline 
> tools available for this?
>
Morten,

There are no pre-built commandline tools for this.  You could write a
Python script using GDAL to load the data into Numeric arrays, and then
subtract them and save to a new GDAL file.  That process should be
pretty straight forward.

The FFT script might be a useful, if slightly overcomplicated, example of
how to do something similar.

   http://www.gdal.org/srctree/pymod/samples/fft.py

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list