[gdal-dev] Downsample with averaging?
Jay Jennings
Jennings.Jay at geoeye.com
Tue Feb 22 10:39:06 EST 2011
>> there is a gdal method to extract a single overview level from a tif but I can never
>> remember it maybe someone will chime in...
If so, that would be really helpful. Does anyone know how to extract a single overview from a pyramid'd image such as made from a command like:
gdaladdo XXXX.tif 2 4 8 16 32 64 128 256
From: Norman Vine [mailto:nhv at cape.com]
Sent: Tuesday, February 22, 2011 4:09 AM
To: Jay Jennings
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Downsample with averaging?
On Feb 21, 2011, at 3:26 PM, Jay Jennings wrote:
Hello list,
(using GDAL 1.8.0) I am trying to create a 32:1 down-sampled overview of a GeoTiff satellite image. My first thought was gdal_translate, with args such as "-outsize 3.125% 3.125%"... which produces surprisingly high quality given the absence of a resampling option. However I'm looking for a downsampling scheme that creates a result pixel by averaging all relevant source pixels (I know, for 32:1 downsample, that means 1024 source pixels for each result pixel !) with the hope of an output that is not "speckled" or "grainy" insofar as possible.
I also looked at gdaladdo, which does have the "-r average" resampling option... the guidance at gdal.org<http://gdal.org> seems to suggest that it can produce a 32:1 GeoTIFF external overview with a command like this:
gdaladdo -r average -ro XXXXX.tif 32
But that produces a surprising error message, namely:
ERROR 4: `XXXXX.tif.ovr' does not exist in the file system, and is not recognised as a supported dataset name.
Am I barking up the wrong tree with gdaladdo for this purpose ? Anybody have any suggestions for highest-quality down-sampling ? Thanks in advance.
Jay
I think you need to build your overlays incrementally in order to get the average
of the 'block' at each overview level as gdaladdo has a very small sampling window
gdaladdo -r average my.tif 2 4 8 16 32
better to use gauss sampling
see http://en.wikipedia.org/wiki/Pyramid_%28image_processing%29
gdaladdo -r gauss my.tiff 2 4 8 16 32
note you may want to convert your image to a floating point form first
so as not to possibly lose precision due to the multiple passes
there is a gdal method to extract a single overview level from a tif but I can never
remember it maybe someone will chime in if not you can use your gdal_translate
trick.
HTH
Norman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110222/2a0018e1/attachment.html
More information about the gdal-dev
mailing list