[gdal-dev] Remove Black Areas From Rotated Images

Even Rouault even.rouault at spatialys.com
Wed Oct 15 08:02:29 PDT 2014


Le mercredi 15 octobre 2014 16:30:19, M Lewis a écrit :
> I have searched and found lots of similar queries but nothing that quite
> gives me the answer that I am looking for (as they all appear to be related
> to gdal_translate rather than the C++ API.)
> 
> We have a set of strips of grey scale satellite imagery that are rotated.
> 
> I use AutoCreateWarpedVRT to generate a 'north-up' image that is converted
> to a bitmap and displayed to the user.
> When displayed the image has a black area surrounding it which tends to
> mask other images that tile alongside.
> 
> From searching around I assume it is to do with the GDALWarpOptions that
> can be passed to the AutoCreateWarpedVRT function but the 'no-data' value
> of the dataset when queried fails and just returns a default of -10000.0.
> Therefore I am unsure of what to set in the padfDstNoDataReal etc
> variables to mask out the areas where there is no data.
> 
> The image is grey scale, the 'non-data' areas come out as black once the
> image is returned from the RasterIO call so it makes it difficult to
> post-process the image data.
> 
> Anybody got any tips on the way to do this and maybe set up the
> GDALWarpOptions to pass to the AutoCreateWarpedVRT function?
> Is it even possible on a grey-scale dataset with no 'no-data' value?

You can try assigning 0 in padfDstNoDataReal AND assigning 0 as nodata value 
to the dataset returned by AutoCreateWarpedVRT() with 
ds.GetRasterBand(1).SetNoDataValue(0)

> 
> Thanks
> 
> Martin
> 
> 
> 
> 
> --
> View this message in context:
> http://osgeo-org.1560.x6.nabble.com/Remove-Black-Areas-From-Rotated-Images
> -tp5167665.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