Added band mappings

Former-commit-id: f31c53113d
pull/1161/head
Piero Toffanin 2019-12-19 20:54:39 +00:00
rodzic 0f86eca4a6
commit 6fe2652eee
1 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -205,6 +205,19 @@ void OdmOrthoPhoto::saveTIFF(const std::string &filename, GDALDataType dataType)
for (; i < bands.size(); i++){
hBand = GDALGetRasterBand( hDstDS, static_cast<int>(i) + 1 );
// TODO: should we set these based on a command line parameter?
GDALColorInterp interp;
if (i == 0){
interp = GCI_RedBand;
}else if (i == 1){
interp = GCI_GreenBand;
}else if (i == 2){
interp = GCI_BlueBand;
}else{
interp = GCI_GrayIndex;
}
GDALSetRasterColorInterpretation(hBand, interp );
if (GDALRasterIO( hBand, GF_Write, 0, 0, width, height,
bands[i], width, height, dataType, 0, 0 ) != CE_None){
std::cerr << "Cannot write TIFF to " << filename << std::endl;