[gdal-dev] Remove Black Areas From Rotated Images

Even Rouault even.rouault at spatialys.com
Thu Oct 16 01:29:43 PDT 2014


Le jeudi 16 octobre 2014 10:15:53, M Lewis a écrit :
> Thanks Even
> 
> I am assuming that even in doing this there may still be an issue with
> differentiating between pixels of pure black and this 0 'no-data' value in
> an 8 bit band where raster min gives 0 and raster max gives 255.....ah
> well.
> 
> There is another question and I have noticed that the dataset created from
> AutoCreateWarpedVRT has different raster min and max values.
> 
> One of the rasters (a single UInt16 band, rotated) has a raster min of
> 337.0 and a raster max of 872.0 when computed using ComputeRasterMinMax().
> 
> However the AutoCreateWarpedVRT dataset created from this original dataset
> has a min of 0.0 and a max of 772.0, why?????

The 0's probably come from the black collar ( ComputeRasterMinMax() cannot 
make the difference between valid pixels and the black collar, unless you define 
0 as nodata)
And the different max is probably due to the resampling done when warping that 
misses some pixels (if nearest neighbour) or "average" them. You could play 
with different resampling algorithms.

> 
> My plan (using your idea) of setting the no-data value to 0.0 would work on
> the original dataset as the minimum is > 0.0 and therefore 0.0 could be
> filtered out; however due to the conversion by the AutoCreateWarpedVRT, 0.0
> is now a valid colour and once again falls into the issue of whether 0.0 is
> 'no-data' or a genuine colour.
> 
> Thanks
> 
> Martin
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Remove-Black-Areas-From-Rotated-Images
> -tp5167665p5167762.html Sent from the GDAL - Dev mailing list archive at
> Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

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


More information about the gdal-dev mailing list