[Gdal-dev] Re: gdalwrap - issues with overlapping images

Frank Warmerdam warmerdam at pobox.com
Thu Jul 5 14:39:46 EDT 2007


Anil Kumar wrote:
> Dear Frank Warmerdam,
> I am trying to mosaicing 2 images which are partly overlapping each 
> other using “gdalwrap”.
> One image first half is filled with white colour and second half is 
> having the required data. Similarly other image first half is filled 
> with required data and second half if filled with white colour. When I 
> mosaicing these two images which are partly overlapping each other using 
> “gdalwrap, I am getting the output with some white pixels through out 
> the coverage of 2^nd iamge.
>  
> Can you please let me know how this can be rectified using gdalwrap. I 
> found some solution in Global Mapper where we can load both images and 
> with blend mode option as “darken”. In this way I am not getting above 
> stated problem.

Anil,

Please do not send me substantial sized files by email.  My gmail account
is nearly full, and so every time I notice I have received a large file
I need to go to some trouble to login to gmail, and delete the email.

I have tried mosaicing your files with gdalwarp and discovered that some
of the white areas in the .sid files are being decompressed as "not quite
white" which means they aren't recognised as nodata.  To cope with this
I successfully converted them to TIFF and ran the "nearblack" utility
on them to convert nearly white areas to pure white.  Then the mosaic
worked well with just a wee bit of white noise on the boundary between
the tiles.  Additional fiddling with nearblack parameters might help
cope with that.

  gdal_translate 5246-913591.sid 5246.tif
  gdal_translate 5247-913591.sid 5247.tif
  nearblack -white 5246.tif
  nearblack -white 5247.tif
  gdalwarp -srcnodata "255 255 255" 5246.tif 5247.tif mosaic.tif

The nearblack utility is included in recent FWTools distributions.

I have taken the liberty of cc:ing this to gdal-dev so others can learn
from it.

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 OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list