[gdal-dev] Overview scales

Even Rouault even.rouault at spatialys.com
Wed Jul 6 01:08:13 PDT 2016


Wilfried,

> 
> I'd like to use overviews for building image pyramids with a scale
> reduction of 2 for photogrammetric applications. While
> GDALDataset::BuildOverviews allows for the specification of "overview
> decimation factors" as integers only, GDAL seems to interpret these
> factors as hints only, and it generates overviews of slightly different
> scales if the base image resolution is not divisible by the decimation
> factor without remainder. The way that GDAL tries to even out the
> varying offsets between the regular image grids not only results in
> possibly anisotropic scales in the 2 coordinate directions of overview
> images, but it also means that the transformation of image coordinates
> from 1 overview to the other is not linear, but a step function (image
> content is shifted between -0.5px and +0.5px), and that the sampling
> distance is non-constant: there will be 2 neighboring rows and columns
> close to the horizontal/vertical center lines of the base image that are
> both mapped to neighboring rows and columns of the overview.

You are talking about nearest resampling right ? I'm not sure the current 
behaviour was really intended. It is more likely just a detail of 
implementation. We could potentially have a "NEAR_CONSTANT_STEP" alternate 
variant that would implement what you mention. But anyway nearest resampling 
is always more or less arbitrary. Even if you have an original image of size 
2N and you compute its overview of factor 2. Which lines do you take : the 2i 
ones or the 2i+1 ones ? For high quality overviews, people use usually other 
resampling methods, and starting with GDAL 2.0, with 
bilinear/cubic/cubicspline/lanczos, you should get "good" results.

> What is the reason for this behavior, especially as by GDAL-means, only
> integer decimation factors may be specified, anyway? 

Because 99% of people use powers of 2 ?

That said, if the overview is initialized (empty) with other means than this 
interface, the overview building should be able to take into account non 
integer decimation factor.

> Also, all other
> image processing tools that I know of (and that are not based on GDAL)
> seem to support a constant sampling distance of exactly 2.
> 

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list