[Gdal-dev] Dither question

Frank Warmerdam warmerdam at pobox.com
Tue Apr 27 09:38:24 EDT 2004


Clay, Bruce wrote:
> I see that RasterIO can be used to effectively dither a raster file by
> skipping a certain number of pixels for both x and Y in the call.
> 
> Is there a method to extract data from the band at a specified fraction
> of a degree spacing?
> 

Bruce,

Arguments tot he RasterIO() call are always pixel/line rectangles.  You
can approximately compute a pixel/line rectangle mapping corresponding
to a particular sampling ratio in degrees but it is up to the application.

Note, that RasterIO() provides downsampling and upsampling with an
unspecified sampling approach.  In practice it is nearest neighbour sampling
with the exception of when overviews are available, in which case it is
nearest neighbour from the nearest overview of at least the same resolution
as the request.  However, since the overviews can be generated via other
mechanisms (ie. averaging) then final result may not be quite nearest neighbour.

Also, I am not acustomed to calling generic downsampling dithering.  I normally
think of dithering as a family of techniques used to convert 24bit images to
8bit, often with "error diffusion" or other means to average out radiometric
error.  There is a GDALDitherRGB2PCT() function available that will apply
Floyd-Steinberg error diffusion during dithering.

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