[gdal-dev] Availability of Lanczos and cubicspline in gdaladdo

Benoit Andrieu bea at ixsea.com
Tue Mar 31 01:49:13 EDT 2009


Thanks for the answer Frank !

So in a first time I'll be looking at making a gdaladdo bis.

By the way, do you know why Mapserver does "only" support nearest, average, bilinear, bicubic ?
I thought it was using GDAL to do warping, but then it would natively support cubicspline and lanczos.
I know that speed is a concern... ^^

By the way bis, I forgot to mention that we had some artifacts with gdalwarp yesterday.
We are using FWTools 2.3.1.
We wanted to merge several pictures at 20cm x 20cm resolution and make a 1m x 1m and a 4m x 4m.
The pictures could be quite big : 30000 x 30000 pixels.

First, we used gdalwarp to do all operations in a single one : merging and downsizing.
But the resulting picture contained artifacts. In some areas, it is as if a nearest method was used instead of lanczos.

Because of this, we then asked gdalwarp to make the downsizing. In a second call, we made the merging.
There we did not find artifacts and it is ok for us to do like this.
But I fear to have the same problems with bigger pictures.

I will not be able to provide the pictures (sources or results) because of confidentiality agreements.
But I could provide screenshots.
Or try to reproduce on differents datasets.

Regards,

Benoît Andrieu


> -----Message reçu-----
> De: Frank Warmerdam <warmerdam at pobox.com>
> À: Benoit Andrieu <bea at ixsea.com>
> Cc: "gdal-dev at lists.osgeo.org" <gdal-dev at lists.osgeo.org>
> Date: 30/03/2009 23:48
> Objet: Re: [gdal-dev] Availability of Lanczos and cubicspline in gdaladdo
> 
> Benoit Andrieu wrote:
> >>> The quality after downsizing images with gdalwarp is so perfect that I 
> >>> am now willing to include this in my overviews.
> >>> Is there any chances to have this include in future releases or is there 
> >>> any difficulties I am not aware of ?
> >> It is my intention to add a cubic resampling option to the overview
> >> building for 1.7.  I am not planning to add the other options.
> > 
> > Are you not planning because there is nobody asking for (poor me) ?
> > The image quality on our datasets is really amazing between merging with bilinear / cubicspline / Lanczos !
> > I am surprised to be the first one to notice such a difference.
> > I will try to see if gdaladdo and gdalwarp give the same results. I have a doubt right now.
> 
> Benoit,
> 
> I personally would prefer not to further complicate the overview
> code with additional resampling types.  However, I have an insistent
> client who will pay, and who might become grumpy if I did not oblige.
> 
> > Ok.
> > Do you mean that producing a 1m x 1m image with 20cm x 20cm images could give bad results ?
> 
> In this case things might not be too bad, but these resampling
> kernels basically have at most 4x4 kernels, so if you are
> doing 20:1 downsampling only a small fraction of the pixels are
> having any influence.  On the other hand in them more typical
> 1:1 resampling case you get nice results as a small window of
> pixels in the area gets considered in the resampling.
> 
> For "1 step" radical downsampling something like average
> may give better results than 4x4 kernel resamplers.
> 
> However, if downsampling is done stepwise (by powers of
> 2 for instance) then the 4x4 kernel resamplers may give
> good results all the way.
> 
> > There is something I am not sure to understand.
> > You are saying to use the warp library directly from the overviewing mechanism.
> 
> I am suggesting writing a small C application that would first
> generate normal overviews, and the use the warper to overwrite
> them with nicely downsampled imagery.
> 
> > Why can't I take the lanczos/cubicspline codes, separate it from the warping code to make a "library" callable from the overviewing and warping codes ?
> > I think that the answer is a long one so if it is too much to ask, just say to me to look at the code ! ;)
> 
> This would be messy.  I am trying to avoid overcomplicating the overview
> code which is already very complicated.  In fact it is already so
> complicated that I'm mortified about extending it with cubic resampling.
> 
> 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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list