gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.51k stars 780 forks source link

Can osgEarth 3.4 handle multispectral images? #2626

Closed ZzWDlyy closed 1 month ago

ZzWDlyy commented 1 month ago

I would like to ask if osgEarth can separate the bands of multispectral images and then display them in a three-dimensional way?If it cannot separate the bands, Is there a way to display them in a representation of multispectral images rather than just showing 2D textures? The current layers: image The expected appearance: 4007af76806566f54c29e445d91d682 Looking forward to your reply,thanks.

jasonbeverage commented 1 month ago

If you are using the GDALImage layer in osgEarth to display your image you can choose which bands to map to the final RGBA display using a VRT to swap the bands around using gdal_translate

For example, if you have a 7 band multispectral image and you want to map RGB to bands 7,4,2 you could do something like this:

gdal_translate -of VRT -b 7 -b 4 -b 2 input.tif output.vrt

Then you can reference output.vrt in your GDALImage instead of the original tif and GDAL will swap the bands for you.

As far as displaying the bands in some kind of 3D representation we have no support for doing anything like that in osgEarth so if that is a requirement for your application you'd need to write something to do that yourself.