Write band descriptions

pull/1246/head
Piero Toffanin 2021-03-23 16:22:08 -04:00
rodzic 1a15daa39b
commit 2032d35580
4 zmienionych plików z 20 dodań i 7 usunięć

Wyświetl plik

@ -2,6 +2,9 @@
#include <sstream>
#include <fstream>
#include <Eigen/StdVector>
#include <algorithm>
#include <cctype>
#include <string>
#include "OdmOrthoPhoto.hpp"
@ -168,15 +171,20 @@ void OdmOrthoPhoto::parseArguments(int argc, char *argv[])
std::stringstream ss(bandsOrder);
std::string item;
while(std::getline(ss, item, ',')){
if (item == "red" || item == "r"){
std::string itemL = item;
// To lower case
std::transform(itemL.begin(), itemL.end(), itemL.begin(), [](unsigned char c){ return std::tolower(c); });
if (itemL == "red" || itemL == "r"){
colorInterps.push_back(GCI_RedBand);
}else if (item == "green" || item == "g"){
}else if (itemL == "green" || itemL == "g"){
colorInterps.push_back(GCI_GreenBand);
}else if (item == "blue" || item == "b"){
}else if (itemL == "blue" || itemL == "b"){
colorInterps.push_back(GCI_BlueBand);
}else{
colorInterps.push_back(GCI_GrayIndex);
}
bandDescriptions.push_back(item);
}
}
@ -238,6 +246,10 @@ void OdmOrthoPhoto::saveTIFF(const std::string &filename, GDALDataType dataType)
}
GDALSetRasterColorInterpretation(hBand, interp );
if (i < bandDescriptions.size()){
GDALSetDescription(hBand, bandDescriptions[i].c_str());
}
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;

Wyświetl plik

@ -183,6 +183,7 @@ private:
std::vector<void *> bands;
std::vector<GDALColorInterp> colorInterps;
std::vector<std::string> bandDescriptions;
void *alphaBand; // Keep alpha band separate
int currentBandIndex;

Wyświetl plik

@ -211,9 +211,9 @@ def config(argv=None, parser=None):
default='none',
choices=['none', 'camera', 'camera+sun'],
help=('Set the radiometric calibration to perform on images. '
'When processing multispectral images you should set this option '
'to obtain reflectance values (otherwise you will get digital number values). '
'[camera] applies black level, vignetting, row gradient gain/exposure compensation (if appropriate EXIF tags are found). '
'When processing multispectral and thermal images you should set this option '
'to obtain reflectance/temperature values (otherwise you will get digital number values). '
'[camera] applies black level, vignetting, row gradient gain/exposure compensation (if appropriate EXIF tags are found) and computes absolute temperature values. '
'[camera+sun] is experimental, applies all the corrections of [camera], plus compensates for spectral radiance registered via a downwelling light sensor (DLS) taking in consideration the angle of the sun. '
'Can be one of: %(choices)s. Default: '
'%(default)s'))

Wyświetl plik

@ -63,7 +63,7 @@ class ODMOrthoPhotoStage(types.ODM_Stage):
if not primary:
subdir = band['name'].lower()
models.append(os.path.join(base_dir, subdir, model_file))
kwargs['bands'] = '-bands %s' % (','.join([quote(b['name'].lower()) for b in reconstruction.multi_camera]))
kwargs['bands'] = '-bands %s' % (','.join([quote(b['name']) for b in reconstruction.multi_camera]))
else:
models.append(os.path.join(base_dir, model_file))