[gdal-dev] Filling in holes when warping

Frank Warmerdam warmerdam at pobox.com
Thu Jul 24 14:19:31 EDT 2008


Andrew Brooks wrote:
> On Tue, 22 Jul 2008 17:18:18 +0100, Frank Warmerdam <warmerdam at pobox.com> wrote:
>> I imagine this is a limitation of the "hole filling" code:
>>
>> http://trac.osgeo.org/gdal/browser/trunk/gdal/alg/gdalgeoloc.cpp#L267
>>
>> You might want to try changing this code to go more than 3 iterations and
>> see if it helps.
> 
> The loop serves no purpose at the moment (other than wasting some time!)
> because iterations after the first simply do the same thing again.  I think
> you want to mark a newly-filled pixel as valid, for example something like
> 	pabyValidFlag[iBMX+iBMY*nBMXSize] = 1 ??
> 
> Obviously I don't understand the code because I found that increasing the
> size of the backmap (currently 1.3 times bigger than something else) made
> the holes worse.  Using a factor of 0.5 actually gave me an image without
> any holes at all!  Maybe the output image wasn't actually correct but at
> first glance it seemed fine :-)

Andrew,

Ouch - how embarrassing.  I've filed a ticket, and will fix this - at least
in trunk.

   http://trac.osgeo.org/gdal/ticket/2501

The *theory* behind the 1.3 times multipler for the backmap is that the
resolution of the geolocation information is not generally completely
uniform, so by producing the backmap at a higher resolution and filling
in the holes we avoid losing much of the information in the original map.

In practice, things still break down if the geolocation array is very
irregular in resolution.

If we oversample too much then the current interpolation mechanism
collapses because the interpolator is no longer filling holes with values
bilinearly interpolated from all directions, but instead is just spreading
values.

Anyways, thanks for the analysis, and I'll fix the iteration thing.

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