[gdal-dev] gdalwarp vs gdal_translate for resizing images

Rutger kassies at gmail.com
Fri Oct 28 08:22:58 PDT 2016


A case where this might come up is when for example resampling 10m Sentinel
to the 20m bands, although in such a scenario i usually would go from 20m to
10m. I did a quick comparison for the 'average' resample case, and compared
it to 'averaging' using Numpy:

/def resize(a, shape):
    
    yin, xin = a.shape
    yout, xout = shape
    
    sh = yout, yin//yout, xout, xin//xout

    return a.reshape(sh).mean(axis=(-1, 1))/

Since distance is calculated in map coordinates, the effect depends on the
used coordinate system.

With GDAL 2.1.0, released 2016/04/25:
<http://osgeo-org.1560.x6.nabble.com/file/n5293296/gdal_avg_sf.png> 

<http://osgeo-org.1560.x6.nabble.com/file/n5293296/numpy_avg_sf.png> 




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-gdalwarp-vs-gdal-translate-for-resizing-images-tp5293033p5293296.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list