[Gdal-dev] Compositing warped images
Robert Osfield
robert at openscenegraph.com
Thu Jan 29 07:34:46 EST 2004
Hi All,
I am currently working on adding to the OpenSceneGraph the ability to creating
scene graph from multiple source images and DEM's. Using GDAL I have
implemented the ability to warp all the source data into the same projection,
and then extract tiles from the warped source data into LOD'd geometry and
texture map tiles.
I am using the GDALWarpOperation::ChunkAndWarpImage(..) as per the GDAL Warp
API Tutorial to do the warping into the same projection, and
GDALRasterBand::RasterIO(..) method to extract the tiles. I must say that I
thoroughly impressed at the power that GDAL provides with such a compact set
of API's :)
Now onto the problem in hand... the warping itself creates black/null data
areas at the edges which when the tile data is extracted the black areas are
copied into the destination imagery/height field overwritting previous valid
values. What would be ideal for me would be for only valid values to be
copied across to the destination, with null data ignored. I havn't spotted a
way of doing this with the RasterIO method so far, is there a way of doing
this?
My fallback is to copy the extracted tile into a local tempory data area, then
copy from this to the final destination, filtering the data as I go.
However, this does mean allocating extra data. Each of these tiles is not
too big, typically around 256x256, and unlikey to get bigger than 1024x1024,
and the tempory data can always be used. So memory consumption isn't a real
issue, but peformance is, and writing more code than I have to is :)
The other option might be to have an extended version of RasterIO which can do
the filtering.
Thanks in advance for any advice that you can provide,
Robert.
More information about the Gdal-dev
mailing list